Skip to content

Commit

Permalink
deps: V8: cherry-pick e395d1698453
Browse files Browse the repository at this point in the history
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 <adamk@chromium.org>
    Commit-Queue: Clemens Backes <clemensb@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#66096}

Refs: v8/v8@e395d16

PR-URL: #32885
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
  • Loading branch information
addaleax authored and BethGriggs committed Apr 20, 2020
1 parent dfc66a6 commit 2ee8b4a
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 70 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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 #####

Expand Down
18 changes: 0 additions & 18 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<WasmModuleObject> DeserializeOrCompile(
Isolate* isolate, MemorySpan<const uint8_t> serialized_module,
MemorySpan<const uint8_t> wire_bytes);

V8_INLINE static WasmModuleObject* Cast(Value* obj);

private:
static MaybeLocal<WasmModuleObject> Deserialize(
Isolate* isolate, MemorySpan<const uint8_t> serialized_module,
MemorySpan<const uint8_t> wire_bytes);
static MaybeLocal<WasmModuleObject> Compile(Isolate* isolate,
const uint8_t* start,
size_t length);

static void CheckCast(Value* obj);
};

Expand Down
51 changes: 0 additions & 51 deletions deps/v8/src/api/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7181,57 +7181,6 @@ MaybeLocal<WasmModuleObject> WasmModuleObject::FromCompiledModule(
Utils::ToLocal(i::Handle<i::JSObject>::cast(module_object)));
}

MaybeLocal<WasmModuleObject> WasmModuleObject::Deserialize(
Isolate* isolate, MemorySpan<const uint8_t> serialized_module,
MemorySpan<const uint8_t> wire_bytes) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
i::MaybeHandle<i::WasmModuleObject> maybe_module_object =
i::wasm::DeserializeNativeModule(
i_isolate, {serialized_module.data(), serialized_module.size()},
{wire_bytes.data(), wire_bytes.size()}, {});
i::Handle<i::WasmModuleObject> module_object;
if (!maybe_module_object.ToHandle(&module_object)) {
return MaybeLocal<WasmModuleObject>();
}
return Local<WasmModuleObject>::Cast(
Utils::ToLocal(i::Handle<i::JSObject>::cast(module_object)));
}

MaybeLocal<WasmModuleObject> WasmModuleObject::DeserializeOrCompile(
Isolate* isolate, MemorySpan<const uint8_t> serialized_module,
MemorySpan<const uint8_t> wire_bytes) {
MaybeLocal<WasmModuleObject> ret =
Deserialize(isolate, serialized_module, wire_bytes);
if (!ret.IsEmpty()) {
return ret;
}
return Compile(isolate, wire_bytes.data(), wire_bytes.size());
}

MaybeLocal<WasmModuleObject> WasmModuleObject::Compile(Isolate* isolate,
const uint8_t* start,
size_t length) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
if (!i::wasm::IsWasmCodegenAllowed(i_isolate, i_isolate->native_context())) {
return MaybeLocal<WasmModuleObject>();
}
i::MaybeHandle<i::JSObject> 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<WasmModuleObject>();
}
return Local<WasmModuleObject>::Cast(
Utils::ToLocal(maybe_compiled.ToHandleChecked()));
}

WasmModuleObjectBuilderStreaming::WasmModuleObjectBuilderStreaming(
Isolate* isolate) {
USE(isolate_);
Expand Down

0 comments on commit 2ee8b4a

Please sign in to comment.