summaryrefslogtreecommitdiff
path: root/deps/v8/src/wasm/wasm-engine.h
diff options
context:
space:
mode:
authorRefael Ackermann <refack@gmail.com>2019-05-28 08:46:21 -0400
committerRefael Ackermann <refack@gmail.com>2019-06-01 09:55:12 -0400
commited74896b1fae1c163b3906163f3bf46326618ddb (patch)
tree7fb05c5a19808e0c5cd95837528e9005999cf540 /deps/v8/src/wasm/wasm-engine.h
parent2a850cd0664a4eee51f44d0bb8c2f7a3fe444154 (diff)
downloadandroid-node-v8-ed74896b1fae1c163b3906163f3bf46326618ddb.tar.gz
android-node-v8-ed74896b1fae1c163b3906163f3bf46326618ddb.tar.bz2
android-node-v8-ed74896b1fae1c163b3906163f3bf46326618ddb.zip
deps: update V8 to 7.5.288.22
PR-URL: https://github.com/nodejs/node/pull/27375 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'deps/v8/src/wasm/wasm-engine.h')
-rw-r--r--deps/v8/src/wasm/wasm-engine.h40
1 files changed, 35 insertions, 5 deletions
diff --git a/deps/v8/src/wasm/wasm-engine.h b/deps/v8/src/wasm/wasm-engine.h
index 01c353e3c9..c990005090 100644
--- a/deps/v8/src/wasm/wasm-engine.h
+++ b/deps/v8/src/wasm/wasm-engine.h
@@ -163,19 +163,38 @@ class V8_EXPORT_PRIVATE WasmEngine {
// {AddIsolate}.
void EnableCodeLogging(Isolate*);
+ // This is called from the foreground thread of the Isolate to log all
+ // outstanding code objects (added via {LogCode}).
+ void LogOutstandingCodesForIsolate(Isolate*);
+
// Create a new NativeModule. The caller is responsible for its
// lifetime. The native module will be given some memory for code,
// which will be page size aligned. The size of the initial memory
// is determined with a heuristic based on the total size of wasm
// code. The native module may later request more memory.
// TODO(titzer): isolate is only required here for CompilationState.
- std::unique_ptr<NativeModule> NewNativeModule(
+ std::shared_ptr<NativeModule> NewNativeModule(
Isolate* isolate, const WasmFeatures& enabled_features,
size_t code_size_estimate, bool can_request_more,
std::shared_ptr<const WasmModule> module);
void FreeNativeModule(NativeModule*);
+ // Sample the code size of the given {NativeModule} in all isolates that have
+ // access to it. Call this after top-tier compilation finished.
+ // This will spawn foreground tasks that do *not* keep the NativeModule alive.
+ void SampleTopTierCodeSizeInAllIsolates(const std::shared_ptr<NativeModule>&);
+
+ // Called by each Isolate to report its live code for a GC cycle.
+ void ReportLiveCodeForGC(Isolate*, Vector<WasmCode*> live_code);
+
+ // Add potentially dead code. The occurrence in the set of potentially dead
+ // code counts as a reference, and is decremented on the next GC.
+ // Returns {true} if the code was added to the set of potentially dead code,
+ // {false} if an entry already exists. The ref count is *unchanged* in any
+ // case.
+ V8_WARN_UNUSED_RESULT bool AddPotentiallyDeadCode(WasmCode*);
+
// Call on process start and exit.
static void InitializeOncePerProcess();
static void GlobalTearDown();
@@ -185,7 +204,9 @@ class V8_EXPORT_PRIVATE WasmEngine {
static std::shared_ptr<WasmEngine> GetWasmEngine();
private:
+ struct CurrentGCInfo;
struct IsolateInfo;
+ struct NativeModuleInfo;
AsyncCompileJob* CreateAsyncCompileJob(
Isolate* isolate, const WasmFeatures& enabled,
@@ -193,6 +214,8 @@ class V8_EXPORT_PRIVATE WasmEngine {
Handle<Context> context,
std::shared_ptr<CompilationResultResolver> resolver);
+ void TriggerGC();
+
WasmMemoryTracker memory_tracker_;
WasmCodeManager code_manager_;
AccountingAllocator allocator_;
@@ -219,10 +242,17 @@ class V8_EXPORT_PRIVATE WasmEngine {
// Set of isolates which use this WasmEngine.
std::unordered_map<Isolate*, std::unique_ptr<IsolateInfo>> isolates_;
- // Maps each NativeModule to the set of Isolates that have access to that
- // NativeModule. The isolate sets currently only grow, they never shrink.
- std::unordered_map<NativeModule*, std::unordered_set<Isolate*>>
- isolates_per_native_module_;
+ // Set of native modules managed by this engine.
+ std::unordered_map<NativeModule*, std::unique_ptr<NativeModuleInfo>>
+ native_modules_;
+
+ // Size of code that became dead since the last GC. If this exceeds a certain
+ // threshold, a new GC is triggered.
+ size_t new_potentially_dead_code_size_ = 0;
+
+ // If an engine-wide GC is currently running, this pointer stores information
+ // about that.
+ std::unique_ptr<CurrentGCInfo> current_gc_info_;
// End of fields protected by {mutex_}.
//////////////////////////////////////////////////////////////////////////////