From 35fefc597688be7c4922f341e1f0a5e6d716de32 Mon Sep 17 00:00:00 2001 From: Jakob Kummerow Date: Thu, 17 Feb 2022 00:10:41 +0100 Subject: [PATCH] [wasm] Enable and fix GCMole for Wasm which the "no-wasm" build refactoring had accidentally disabled. Bug: v8:11238 Change-Id: Ia2a4be89024f0bc22a1548dcef21e065e4bb5268 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3468341 Reviewed-by: Thibaud Michaud Commit-Queue: Jakob Kummerow Cr-Commit-Position: refs/heads/main@{#79140} --- BUILD.gn | 2 +- src/wasm/wasm-js.cc | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index fb68d0ec4d..533ec48b85 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -4451,7 +4451,7 @@ v8_source_set("v8_base_without_compiler") { ] if (v8_enable_webassembly) { - sources += [ + sources += [ ### gcmole(all) ### "src/asmjs/asm-js.cc", "src/asmjs/asm-parser.cc", "src/asmjs/asm-scanner.cc", diff --git a/src/wasm/wasm-js.cc b/src/wasm/wasm-js.cc index 4bdc389ffe..07e1675dd0 100644 --- a/src/wasm/wasm-js.cc +++ b/src/wasm/wasm-js.cc @@ -1668,7 +1668,7 @@ uint32_t GetEncodedSize(i::Handle tag_object) { } void EncodeExceptionValues(v8::Isolate* isolate, - i::PodArray signature, + i::Handle> signature, const Local& arg, ScheduledErrorThrower* thrower, i::Handle values_out) { @@ -1679,10 +1679,10 @@ void EncodeExceptionValues(v8::Isolate* isolate, return; } auto values = arg.As(); - for (int i = 0; i < signature.length(); ++i) { + for (int i = 0; i < signature->length(); ++i) { MaybeLocal maybe_value = values->Get(context, i); Local value = maybe_value.ToLocalChecked(); - i::wasm::ValueType type = signature.get(i); + i::wasm::ValueType type = signature->get(i); switch (type.kind()) { case i::wasm::kI32: { int32_t i32 = 0; @@ -1761,17 +1761,19 @@ void WebAssemblyException(const v8::FunctionCallbackInfo& args) { thrower.TypeError("Argument 0 must be a WebAssembly tag"); return; } - auto tag_object = i::Handle::cast(arg0); - auto tag = i::Handle( + i::Handle tag_object = + i::Handle::cast(arg0); + i::Handle tag( i::WasmExceptionTag::cast(tag_object->tag()), i_isolate); uint32_t size = GetEncodedSize(tag_object); i::Handle runtime_exception = i::WasmExceptionPackage::New(i_isolate, tag, size); // The constructor above should guarantee that the cast below succeeds. - auto values = i::Handle::cast( + i::Handle values = i::Handle::cast( i::WasmExceptionPackage::GetExceptionValues(i_isolate, runtime_exception)); - auto signature = tag_object->serialized_signature(); + i::Handle> signature( + tag_object->serialized_signature(), i_isolate); EncodeExceptionValues(isolate, signature, args[1], &thrower, values); if (thrower.error()) return; args.GetReturnValue().Set(