From 2ee8b4a512aa6ad616283fba3c7157bbf2c0b847 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 16 Apr 2020 18:18:30 +0200 Subject: [PATCH] deps: V8: cherry-pick e395d1698453 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original commit message: [api] Remove deprecated DeserializeOrCompile method This method was used to implement deserialization via the value serializer. It was deprecated since this functionality is not used any more, and hence untested. This CL cleans up by removing the deprecated method and two private helper methods. R=adamk@chromium.org Bug: v8:10155 Change-Id: I4dda1949fd4f1b499cb6f8d6e6a76b642179303a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2033171 Reviewed-by: Adam Klein Commit-Queue: Clemens Backes Cr-Commit-Position: refs/heads/master@{#66096} Refs: https://github.com/v8/v8/commit/e395d16984537c0767dc8152c7f273dbf2a555f5 PR-URL: https://github.com/nodejs/node/pull/32885 Reviewed-By: Michaël Zasso Reviewed-By: Ujjwal Sharma Reviewed-By: Gerhard Stöbich Reviewed-By: Beth Griggs --- common.gypi | 2 +- deps/v8/include/v8.h | 18 --------------- deps/v8/src/api/api.cc | 51 ------------------------------------------ 3 files changed, 1 insertion(+), 70 deletions(-) diff --git a/common.gypi b/common.gypi index e0325c50efa..d2f21b77257 100644 --- a/common.gypi +++ b/common.gypi @@ -35,7 +35,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.19', + 'v8_embedder_string': '-node.20', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index 63a1b6e686f..58438b0db65 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -4757,27 +4757,9 @@ class V8_EXPORT WasmModuleObject : public Object { */ CompiledWasmModule GetCompiledModule(); - /** - * If possible, deserialize the module, otherwise compile it from the provided - * uncompiled bytes. - */ - V8_DEPRECATED( - "Use WasmStreaming for deserialization from cache or the " - "CompiledWasmModule to transfer between isolates") - static MaybeLocal DeserializeOrCompile( - Isolate* isolate, MemorySpan serialized_module, - MemorySpan wire_bytes); - V8_INLINE static WasmModuleObject* Cast(Value* obj); private: - static MaybeLocal Deserialize( - Isolate* isolate, MemorySpan serialized_module, - MemorySpan wire_bytes); - static MaybeLocal Compile(Isolate* isolate, - const uint8_t* start, - size_t length); - static void CheckCast(Value* obj); }; diff --git a/deps/v8/src/api/api.cc b/deps/v8/src/api/api.cc index 4b71d6a446d..8e342d10d00 100644 --- a/deps/v8/src/api/api.cc +++ b/deps/v8/src/api/api.cc @@ -7181,57 +7181,6 @@ MaybeLocal WasmModuleObject::FromCompiledModule( Utils::ToLocal(i::Handle::cast(module_object))); } -MaybeLocal WasmModuleObject::Deserialize( - Isolate* isolate, MemorySpan serialized_module, - MemorySpan wire_bytes) { - i::Isolate* i_isolate = reinterpret_cast(isolate); - i::MaybeHandle maybe_module_object = - i::wasm::DeserializeNativeModule( - i_isolate, {serialized_module.data(), serialized_module.size()}, - {wire_bytes.data(), wire_bytes.size()}, {}); - i::Handle module_object; - if (!maybe_module_object.ToHandle(&module_object)) { - return MaybeLocal(); - } - return Local::Cast( - Utils::ToLocal(i::Handle::cast(module_object))); -} - -MaybeLocal WasmModuleObject::DeserializeOrCompile( - Isolate* isolate, MemorySpan serialized_module, - MemorySpan wire_bytes) { - MaybeLocal ret = - Deserialize(isolate, serialized_module, wire_bytes); - if (!ret.IsEmpty()) { - return ret; - } - return Compile(isolate, wire_bytes.data(), wire_bytes.size()); -} - -MaybeLocal WasmModuleObject::Compile(Isolate* isolate, - const uint8_t* start, - size_t length) { - i::Isolate* i_isolate = reinterpret_cast(isolate); - if (!i::wasm::IsWasmCodegenAllowed(i_isolate, i_isolate->native_context())) { - return MaybeLocal(); - } - i::MaybeHandle maybe_compiled; - { - i::wasm::ErrorThrower thrower(i_isolate, "WasmModuleObject::Compile()"); - auto enabled_features = i::wasm::WasmFeatures::FromIsolate(i_isolate); - maybe_compiled = i_isolate->wasm_engine()->SyncCompile( - i_isolate, enabled_features, &thrower, - i::wasm::ModuleWireBytes(start, start + length)); - } - CHECK_EQ(maybe_compiled.is_null(), i_isolate->has_pending_exception()); - if (maybe_compiled.is_null()) { - i_isolate->OptionalRescheduleException(false); - return MaybeLocal(); - } - return Local::Cast( - Utils::ToLocal(maybe_compiled.ToHandleChecked())); -} - WasmModuleObjectBuilderStreaming::WasmModuleObjectBuilderStreaming( Isolate* isolate) { USE(isolate_);