diff --git a/deps/v8/include/v8-profiler.h b/deps/v8/include/v8-profiler.h index 0e203511f55205..b58534c89d9ffb 100644 --- a/deps/v8/include/v8-profiler.h +++ b/deps/v8/include/v8-profiler.h @@ -371,6 +371,20 @@ class V8_EXPORT CpuProfiler { */ CpuProfile* StopProfiling(Local title); + /** + * Force collection of a sample. Must be called on the VM thread. + * Recording the forced sample does not contribute to the aggregated + * profile statistics. + */ + V8_DEPRECATED("Use static CollectSample(Isolate*) instead.") + void CollectSample(); + + /** + * Tells the profiler whether the embedder is idle. + */ + V8_DEPRECATED("Use Isolate::SetIdle(bool) instead.") + void SetIdle(bool is_idle); + /** * Generate more detailed source positions to code objects. This results in * better results when mapping profiling samples to script source. diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index 0b7f331c8c00c7..dc75012b2e4921 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -1275,8 +1275,9 @@ class V8_EXPORT SealHandleScope { // --- Special objects --- + /** - * The superclass of objects that can reside on V8's heap. + * The superclass of values and API object templates. */ class V8_EXPORT Data { private: @@ -1423,7 +1424,7 @@ class V8_EXPORT UnboundScript { /** * A compiled JavaScript module, not yet tied to a Context. */ -class V8_EXPORT UnboundModuleScript : public Data { +class V8_EXPORT UnboundModuleScript { // Only used as a container for code caching. }; @@ -1446,7 +1447,7 @@ class V8_EXPORT Location { /** * A compiled JavaScript module. */ -class V8_EXPORT Module : public Data { +class V8_EXPORT Module { public: /** * The different states a module can be in. @@ -4644,37 +4645,47 @@ class V8_EXPORT CompiledWasmModule { // An instance of WebAssembly.Module. class V8_EXPORT WasmModuleObject : public Object { public: - WasmModuleObject() = delete; - /** * An opaque, native heap object for transferring wasm modules. It * supports move semantics, and does not support copy semantics. + * TODO(wasm): Merge this with CompiledWasmModule once code sharing is always + * enabled. */ - using TransferrableModule = CompiledWasmModule; + class TransferrableModule final { + public: + TransferrableModule(TransferrableModule&& src) = default; + TransferrableModule(const TransferrableModule& src) = delete; + + TransferrableModule& operator=(TransferrableModule&& src) = default; + TransferrableModule& operator=(const TransferrableModule& src) = delete; + + private: + typedef std::shared_ptr SharedModule; + friend class WasmModuleObject; + explicit TransferrableModule(SharedModule shared_module) + : shared_module_(std::move(shared_module)) {} + TransferrableModule(OwnedBuffer serialized, OwnedBuffer bytes) + : serialized_(std::move(serialized)), wire_bytes_(std::move(bytes)) {} + + SharedModule shared_module_; + OwnedBuffer serialized_ = {nullptr, 0}; + OwnedBuffer wire_bytes_ = {nullptr, 0}; + }; /** * Get an in-memory, non-persistable, and context-independent (meaning, * suitable for transfer to another Isolate and Context) representation * of this wasm compiled module. */ - V8_DEPRECATED("Use GetCompiledModule") TransferrableModule GetTransferrableModule(); /** * Efficiently re-create a WasmModuleObject, without recompiling, from * a TransferrableModule. */ - V8_DEPRECATED("Use FromCompiledModule") static MaybeLocal FromTransferrableModule( Isolate* isolate, const TransferrableModule&); - /** - * Efficiently re-create a WasmModuleObject, without recompiling, from - * a CompiledWasmModule. - */ - static MaybeLocal FromCompiledModule( - Isolate* isolate, const CompiledWasmModule&); - /** * Get the compiled module for this module object. The compiled module can be * shared by several module objects. @@ -4697,7 +4708,11 @@ class V8_EXPORT WasmModuleObject : public Object { static MaybeLocal Compile(Isolate* isolate, const uint8_t* start, size_t length); + static MemorySpan AsReference(const OwnedBuffer& buff) { + return {buff.buffer.get(), buff.size}; + } + WasmModuleObject(); static void CheckCast(Value* obj); }; @@ -5053,6 +5068,12 @@ class V8_EXPORT ArrayBuffer : public Object { */ bool IsDetachable() const; + // TODO(913887): fix the use of 'neuter' in the API. + V8_DEPRECATED("Use IsDetachable() instead.") + inline bool IsNeuterable() const { + return IsDetachable(); + } + /** * Detaches this ArrayBuffer and all its views (typed arrays). * Detaching sets the byte length of the buffer and all typed arrays to zero, @@ -5061,6 +5082,10 @@ class V8_EXPORT ArrayBuffer : public Object { */ void Detach(); + // TODO(913887): fix the use of 'neuter' in the API. + V8_DEPRECATED("Use Detach() instead.") + inline void Neuter() { Detach(); } + /** * Make this ArrayBuffer external. The pointer to underlying memory block * and byte length are returned as |Contents| structure. After ArrayBuffer @@ -7670,9 +7695,7 @@ class V8_EXPORT EmbedderHeapTracer { virtual void RegisterV8References( const std::vector >& embedder_fields) = 0; - V8_DEPRECATE_SOON("Use version taking TracedReferenceBase argument") void RegisterEmbedderReference(const TracedReferenceBase& ref); - void RegisterEmbedderReference(const TracedReferenceBase& ref); /** * Called at the beginning of a GC cycle. @@ -7849,7 +7872,6 @@ class V8_EXPORT Isolate { create_histogram_callback(nullptr), add_histogram_sample_callback(nullptr), array_buffer_allocator(nullptr), - array_buffer_allocator_shared(), external_references(nullptr), allow_atomics_wait(true), only_terminate_in_safe_scope(false) {} @@ -7896,7 +7918,6 @@ class V8_EXPORT Isolate { * management for the allocator instance. */ ArrayBuffer::Allocator* array_buffer_allocator; - std::shared_ptr array_buffer_allocator_shared; /** * Specifies an optional nullptr-terminated array of raw addresses in the @@ -7918,6 +7939,9 @@ class V8_EXPORT Isolate { bool only_terminate_in_safe_scope; }; + void SetArrayBufferAllocatorShared( + std::shared_ptr allocator); + /** * Stack-allocated class which sets the isolate for all operations @@ -9192,6 +9216,8 @@ class V8_EXPORT V8 { */ static void SetFlagsFromString(const char* str); static void SetFlagsFromString(const char* str, size_t length); + V8_DEPRECATED("use size_t version") + static void SetFlagsFromString(const char* str, int length); /** * Sets V8 flags from the command line. diff --git a/deps/v8/src/api/api.cc b/deps/v8/src/api/api.cc index eed4ee6d9d290a..c6fdeec9028fa9 100644 --- a/deps/v8/src/api/api.cc +++ b/deps/v8/src/api/api.cc @@ -907,6 +907,11 @@ void V8::SetFlagsFromString(const char* str, size_t length) { i::FlagList::EnforceFlagImplications(); } +void V8::SetFlagsFromString(const char* str, int length) { + CHECK_LE(0, length); + SetFlagsFromString(str, static_cast(length)); +} + void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) { i::FlagList::SetFlagsFromCommandLine(argc, argv, remove_flags); } @@ -7111,7 +7116,21 @@ MemorySpan CompiledWasmModule::GetWireBytesRef() { WasmModuleObject::TransferrableModule WasmModuleObject::GetTransferrableModule() { - return GetCompiledModule(); + if (i::FLAG_wasm_shared_code) { + i::Handle obj = + i::Handle::cast(Utils::OpenHandle(this)); + return TransferrableModule(obj->shared_native_module()); + } else { + CompiledWasmModule compiled_module = GetCompiledModule(); + OwnedBuffer serialized_module = compiled_module.Serialize(); + MemorySpan wire_bytes_ref = + compiled_module.GetWireBytesRef(); + size_t wire_size = wire_bytes_ref.size(); + std::unique_ptr wire_bytes_copy(new uint8_t[wire_size]); + memcpy(wire_bytes_copy.get(), wire_bytes_ref.data(), wire_size); + return TransferrableModule(std::move(serialized_module), + {std::move(wire_bytes_copy), wire_size}); + } } CompiledWasmModule WasmModuleObject::GetCompiledModule() { @@ -7123,17 +7142,17 @@ CompiledWasmModule WasmModuleObject::GetCompiledModule() { MaybeLocal WasmModuleObject::FromTransferrableModule( Isolate* isolate, const WasmModuleObject::TransferrableModule& transferrable_module) { - return FromCompiledModule(isolate, transferrable_module); -} - -MaybeLocal WasmModuleObject::FromCompiledModule( - Isolate* isolate, const CompiledWasmModule& compiled_module) { - i::Isolate* i_isolate = reinterpret_cast(isolate); - i::Handle module_object = - i_isolate->wasm_engine()->ImportNativeModule( - i_isolate, Utils::Open(compiled_module)); - return Local::Cast( - Utils::ToLocal(i::Handle::cast(module_object))); + if (i::FLAG_wasm_shared_code) { + i::Isolate* i_isolate = reinterpret_cast(isolate); + i::Handle module_object = + i_isolate->wasm_engine()->ImportNativeModule( + i_isolate, transferrable_module.shared_module_); + return Local::Cast( + Utils::ToLocal(i::Handle::cast(module_object))); + } else { + return Deserialize(isolate, AsReference(transferrable_module.serialized_), + AsReference(transferrable_module.wire_bytes_)); + } } MaybeLocal WasmModuleObject::Deserialize( @@ -8167,20 +8186,20 @@ Isolate* Isolate::Allocate() { return reinterpret_cast(i::Isolate::New()); } +void Isolate::SetArrayBufferAllocatorShared( + std::shared_ptr allocator) { + i::Isolate* isolate = reinterpret_cast(this); + CHECK_EQ(allocator.get(), isolate->array_buffer_allocator()); + isolate->set_array_buffer_allocator_shared(std::move(allocator)); +} + // static // This is separate so that tests can provide a different |isolate|. void Isolate::Initialize(Isolate* isolate, const v8::Isolate::CreateParams& params) { i::Isolate* i_isolate = reinterpret_cast(isolate); - if (auto allocator = params.array_buffer_allocator_shared) { - CHECK(params.array_buffer_allocator == nullptr || - params.array_buffer_allocator == allocator.get()); - i_isolate->set_array_buffer_allocator(allocator.get()); - i_isolate->set_array_buffer_allocator_shared(std::move(allocator)); - } else { - CHECK_NOT_NULL(params.array_buffer_allocator); - i_isolate->set_array_buffer_allocator(params.array_buffer_allocator); - } + CHECK_NOT_NULL(params.array_buffer_allocator); + i_isolate->set_array_buffer_allocator(params.array_buffer_allocator); if (params.snapshot_blob != nullptr) { i_isolate->set_snapshot_blob(params.snapshot_blob); } else { @@ -10221,6 +10240,10 @@ void CpuProfiler::SetUsePreciseSampling(bool use_precise_sampling) { use_precise_sampling); } +void CpuProfiler::CollectSample() { + reinterpret_cast(this)->CollectSample(); +} + void CpuProfiler::StartProfiling(Local title, CpuProfilingOptions options) { reinterpret_cast(this)->StartProfiling( @@ -10248,6 +10271,12 @@ CpuProfile* CpuProfiler::StopProfiling(Local title) { *Utils::OpenHandle(*title))); } +void CpuProfiler::SetIdle(bool is_idle) { + i::CpuProfiler* profiler = reinterpret_cast(this); + i::Isolate* isolate = profiler->isolate(); + isolate->SetIdle(is_idle); +} + void CpuProfiler::UseDetailedSourcePositionsForProfiling(Isolate* isolate) { reinterpret_cast(isolate) ->set_detailed_source_positions_for_profiling(true); @@ -10639,15 +10668,6 @@ void EmbedderHeapTracer::DecreaseAllocatedSize(size_t bytes) { } } -void EmbedderHeapTracer::RegisterEmbedderReference( - const TracedReferenceBase& ref) { - if (ref.IsEmpty()) return; - - i::Heap* const heap = reinterpret_cast(isolate_)->heap(); - heap->RegisterExternallyReferencedObject( - reinterpret_cast(ref.val_)); -} - void EmbedderHeapTracer::RegisterEmbedderReference( const TracedReferenceBase& ref) { if (ref.IsEmpty()) return; diff --git a/deps/v8/src/api/api.h b/deps/v8/src/api/api.h index a518670c798e9b..907a68c4c26538 100644 --- a/deps/v8/src/api/api.h +++ b/deps/v8/src/api/api.h @@ -276,11 +276,6 @@ class Utils { return CompiledWasmModule{std::move(native_module)}; } - static inline const std::shared_ptr& Open( - const CompiledWasmModule& compiled_module) { - return compiled_module.native_module_; - } - private: static void ReportApiFailure(const char* location, const char* message); }; diff --git a/deps/v8/src/d8/d8.cc b/deps/v8/src/d8/d8.cc index 33f2b70b1425c4..7129b9dc30f19d 100644 --- a/deps/v8/src/d8/d8.cc +++ b/deps/v8/src/d8/d8.cc @@ -3329,7 +3329,7 @@ class Serializer : public ValueSerializer::Delegate { size_t index = wasm_modules_.size(); wasm_modules_.emplace_back(isolate_, module); - data_->compiled_wasm_modules_.push_back(module->GetCompiledModule()); + data_->transferrable_modules_.push_back(module->GetTransferrableModule()); return Just(static_cast(index)); } @@ -3455,9 +3455,11 @@ class Deserializer : public ValueDeserializer::Delegate { MaybeLocal GetWasmModuleFromId( Isolate* isolate, uint32_t transfer_id) override { DCHECK_NOT_NULL(data_); - if (transfer_id >= data_->compiled_wasm_modules().size()) return {}; - return WasmModuleObject::FromCompiledModule( - isolate_, data_->compiled_wasm_modules().at(transfer_id)); + if (transfer_id < data_->transferrable_modules().size()) { + return WasmModuleObject::FromTransferrableModule( + isolate_, data_->transferrable_modules().at(transfer_id)); + } + return MaybeLocal(); } private: diff --git a/deps/v8/src/d8/d8.h b/deps/v8/src/d8/d8.h index 458bad858ab17a..58bfbcb3b91b5b 100644 --- a/deps/v8/src/d8/d8.h +++ b/deps/v8/src/d8/d8.h @@ -123,8 +123,9 @@ class SerializationData { const std::vector>& sab_backing_stores() { return sab_backing_stores_; } - const std::vector& compiled_wasm_modules() { - return compiled_wasm_modules_; + const std::vector& + transferrable_modules() { + return transferrable_modules_; } private: @@ -136,7 +137,7 @@ class SerializationData { size_t size_; std::vector> backing_stores_; std::vector> sab_backing_stores_; - std::vector compiled_wasm_modules_; + std::vector transferrable_modules_; private: friend class Serializer; diff --git a/deps/v8/src/flags/flag-definitions.h b/deps/v8/src/flags/flag-definitions.h index b05c36ccdd1f5f..3b0f6de650c48f 100644 --- a/deps/v8/src/flags/flag-definitions.h +++ b/deps/v8/src/flags/flag-definitions.h @@ -733,6 +733,9 @@ DEFINE_BOOL(wasm_math_intrinsics, true, DEFINE_BOOL(wasm_shared_engine, true, "shares one wasm engine between all isolates within a process") DEFINE_IMPLICATION(future, wasm_shared_engine) +DEFINE_BOOL(wasm_shared_code, true, + "shares code underlying a wasm module when it is transferred") +DEFINE_IMPLICATION(future, wasm_shared_code) DEFINE_BOOL(wasm_trap_handler, true, "use signal handlers to catch out of bounds memory access in wasm" " (currently Linux x86_64 only)") diff --git a/deps/v8/src/wasm/wasm-code-manager.cc b/deps/v8/src/wasm/wasm-code-manager.cc index 55695259f019be..df70b1ac06902b 100644 --- a/deps/v8/src/wasm/wasm-code-manager.cc +++ b/deps/v8/src/wasm/wasm-code-manager.cc @@ -1801,7 +1801,7 @@ WasmCode* WasmCodeManager::LookupCode(Address pc) const { } // TODO(v8:7424): Code protection scopes are not yet supported with shared code -// enabled and need to be revisited. +// enabled and need to be revisited to work with --wasm-shared-code as well. NativeModuleModificationScope::NativeModuleModificationScope( NativeModule* native_module) : native_module_(native_module) { diff --git a/deps/v8/test/cctest/heap/test-embedder-tracing.cc b/deps/v8/test/cctest/heap/test-embedder-tracing.cc index 8ff4acc05beb53..11f154f936f9d3 100644 --- a/deps/v8/test/cctest/heap/test-embedder-tracing.cc +++ b/deps/v8/test/cctest/heap/test-embedder-tracing.cc @@ -62,7 +62,7 @@ class TestEmbedderHeapTracer final : public v8::EmbedderHeapTracer { bool AdvanceTracing(double deadline_in_ms) final { for (auto global : to_register_with_v8_) { - RegisterEmbedderReference(global->As()); + RegisterEmbedderReference(global->As()); } to_register_with_v8_.clear(); return true; diff --git a/deps/v8/test/cctest/test-api-array-buffer.cc b/deps/v8/test/cctest/test-api-array-buffer.cc index 9afdf047f07b73..fea80dfa42e022 100644 --- a/deps/v8/test/cctest/test-api-array-buffer.cc +++ b/deps/v8/test/cctest/test-api-array-buffer.cc @@ -634,69 +634,3 @@ class DummyAllocator final : public v8::ArrayBuffer::Allocator { std::unique_ptr allocator_; uint64_t allocation_count_ = 0; }; - -TEST(BackingStore_HoldAllocatorAlive_UntilIsolateShutdown) { - std::shared_ptr allocator = - std::make_shared(); - std::weak_ptr allocator_weak(allocator); - - v8::Isolate::CreateParams create_params; - create_params.array_buffer_allocator_shared = allocator; - v8::Isolate* isolate = v8::Isolate::New(create_params); - isolate->Enter(); - - allocator.reset(); - create_params.array_buffer_allocator_shared.reset(); - CHECK(!allocator_weak.expired()); - CHECK_EQ(allocator_weak.lock()->allocation_count(), 0); - - { - // Create an ArrayBuffer and do not garbage collect it. This should make - // the allocator be released automatically once the Isolate is disposed. - v8::HandleScope handle_scope(isolate); - v8::Context::Scope context_scope(Context::New(isolate)); - v8::ArrayBuffer::New(isolate, 8); - - // This should be inside the HandleScope, so that we can be sure that - // the allocation is not garbage collected yet. - CHECK(!allocator_weak.expired()); - CHECK_EQ(allocator_weak.lock()->allocation_count(), 1); - } - - isolate->Exit(); - isolate->Dispose(); - CHECK(allocator_weak.expired()); -} - -TEST(BackingStore_HoldAllocatorAlive_AfterIsolateShutdown) { - std::shared_ptr allocator = - std::make_shared(); - std::weak_ptr allocator_weak(allocator); - - v8::Isolate::CreateParams create_params; - create_params.array_buffer_allocator_shared = allocator; - v8::Isolate* isolate = v8::Isolate::New(create_params); - isolate->Enter(); - - allocator.reset(); - create_params.array_buffer_allocator_shared.reset(); - CHECK(!allocator_weak.expired()); - CHECK_EQ(allocator_weak.lock()->allocation_count(), 0); - - std::shared_ptr backing_store; - { - // Create an ArrayBuffer and do not garbage collect it. This should make - // the allocator be released automatically once the Isolate is disposed. - v8::HandleScope handle_scope(isolate); - v8::Context::Scope context_scope(Context::New(isolate)); - v8::Local ab = v8::ArrayBuffer::New(isolate, 8); - backing_store = ab->GetBackingStore(); - } - - isolate->Exit(); - isolate->Dispose(); - CHECK(!allocator_weak.expired()); - CHECK_EQ(allocator_weak.lock()->allocation_count(), 1); - backing_store.reset(); - CHECK(allocator_weak.expired()); -} diff --git a/deps/v8/test/cctest/wasm/test-wasm-serialization.cc b/deps/v8/test/cctest/wasm/test-wasm-serialization.cc index c6486650efe093..ad5d5b13825279 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-serialization.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-serialization.cc @@ -271,8 +271,9 @@ TEST(BlockWasmCodeGenAtDeserialization) { Cleanup(); } -UNINITIALIZED_TEST(CompiledWasmModulesTransfer) { - FlagScope flag_scope_engine(&FLAG_wasm_shared_engine, true); +namespace { + +void TestTransferrableWasmModules(bool should_share) { i::wasm::WasmEngine::InitializeOncePerProcess(); v8::internal::AccountingAllocator allocator; Zone zone(&allocator, ZONE_NAME); @@ -283,7 +284,7 @@ UNINITIALIZED_TEST(CompiledWasmModulesTransfer) { v8::Isolate::CreateParams create_params; create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); v8::Isolate* from_isolate = v8::Isolate::New(create_params); - std::vector store; + std::vector store; std::shared_ptr original_native_module; { v8::HandleScope scope(from_isolate); @@ -291,7 +292,7 @@ UNINITIALIZED_TEST(CompiledWasmModulesTransfer) { Isolate* from_i_isolate = reinterpret_cast(from_isolate); testing::SetupIsolateForWasmModule(from_i_isolate); - ErrorThrower thrower(from_i_isolate, "TestCompiledWasmModulesTransfer"); + ErrorThrower thrower(from_i_isolate, "TestTransferrableWasmModules"); auto enabled_features = WasmFeaturesFromIsolate(from_i_isolate); MaybeHandle maybe_module_object = from_i_isolate->wasm_engine()->SyncCompile( @@ -302,7 +303,7 @@ UNINITIALIZED_TEST(CompiledWasmModulesTransfer) { v8::Local v8_module = v8::Local::Cast( v8::Utils::ToLocal(Handle::cast(module_object))); - store.push_back(v8_module->GetCompiledModule()); + store.push_back(v8_module->GetTransferrableModule()); original_native_module = module_object->shared_native_module(); } @@ -313,13 +314,14 @@ UNINITIALIZED_TEST(CompiledWasmModulesTransfer) { LocalContext env(to_isolate); v8::MaybeLocal transferred_module = - v8::WasmModuleObject::FromCompiledModule(to_isolate, store[0]); + v8::WasmModuleObject::FromTransferrableModule(to_isolate, store[0]); CHECK(!transferred_module.IsEmpty()); Handle module_object = Handle::cast( v8::Utils::OpenHandle(*transferred_module.ToLocalChecked())); std::shared_ptr transferred_native_module = module_object->shared_native_module(); - CHECK_EQ(original_native_module, transferred_native_module); + bool is_sharing = (original_native_module == transferred_native_module); + CHECK_EQ(should_share, is_sharing); } to_isolate->Dispose(); } @@ -327,6 +329,19 @@ UNINITIALIZED_TEST(CompiledWasmModulesTransfer) { from_isolate->Dispose(); } +} // namespace + +UNINITIALIZED_TEST(TransferrableWasmModulesCloned) { + FlagScope flag_scope_code(&FLAG_wasm_shared_code, false); + TestTransferrableWasmModules(false); +} + +UNINITIALIZED_TEST(TransferrableWasmModulesShared) { + FlagScope flag_scope_engine(&FLAG_wasm_shared_engine, true); + FlagScope flag_scope_code(&FLAG_wasm_shared_code, true); + TestTransferrableWasmModules(true); +} + #undef EMIT_CODE_WITH_END } // namespace test_wasm_serialization diff --git a/deps/v8/test/unittests/objects/value-serializer-unittest.cc b/deps/v8/test/unittests/objects/value-serializer-unittest.cc index d5583d5a69cc1e..a509ae293bf77e 100644 --- a/deps/v8/test/unittests/objects/value-serializer-unittest.cc +++ b/deps/v8/test/unittests/objects/value-serializer-unittest.cc @@ -2509,32 +2509,35 @@ class ValueSerializerTestWithWasm : public ValueSerializerTest { class SerializeToTransfer : public ValueSerializer::Delegate { public: - explicit SerializeToTransfer(std::vector* modules) + SerializeToTransfer( + std::vector* modules) : modules_(modules) {} Maybe GetWasmModuleTransferId( Isolate* isolate, Local module) override { - modules_->push_back(module->GetCompiledModule()); + modules_->push_back(module->GetTransferrableModule()); return Just(static_cast(modules_->size()) - 1); } void ThrowDataCloneError(Local message) override { UNREACHABLE(); } private: - std::vector* modules_; + std::vector* modules_; }; class DeserializeFromTransfer : public ValueDeserializer::Delegate { public: - explicit DeserializeFromTransfer(std::vector* modules) + DeserializeFromTransfer( + std::vector* modules) : modules_(modules) {} MaybeLocal GetWasmModuleFromId(Isolate* isolate, uint32_t id) override { - return WasmModuleObject::FromCompiledModule(isolate, modules_->at(id)); + return WasmModuleObject::FromTransferrableModule(isolate, + modules_->at(id)); } private: - std::vector* modules_; + std::vector* modules_; }; ValueSerializer::Delegate* GetSerializerDelegate() override { @@ -2614,7 +2617,7 @@ class ValueSerializerTestWithWasm : public ValueSerializerTest { private: static bool g_saved_flag; - std::vector transfer_modules_; + std::vector transfer_modules_; SerializeToTransfer serialize_delegate_; DeserializeFromTransfer deserialize_delegate_; ValueSerializer::Delegate* current_serializer_delegate_ = nullptr;