Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Unified Diff: src/wasm/wasm-js.cc

Issue 2263953002: [wasm] Use the right context in the wasm-to-js wrapper. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Cleanup the test. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/wasm/wasm-js.cc
diff --git a/src/wasm/wasm-js.cc b/src/wasm/wasm-js.cc
index 5b2020bc27d6f969ea838a430aab187dbed0d8d8..3d0032c9bd82f80ebd272b0fefcd31bb33984d09 100644
--- a/src/wasm/wasm-js.cc
+++ b/src/wasm/wasm-js.cc
@@ -156,6 +156,8 @@ i::MaybeHandle<i::JSObject> InstantiateModule(
const v8::FunctionCallbackInfo<v8::Value>& args, const byte* start,
const byte* end, ErrorThrower* thrower,
internal::wasm::ModuleOrigin origin = i::wasm::kWasmOrigin) {
+ i::Handle<i::Context> context =
+ v8::Utils::OpenHandle(*(args.GetIsolate()->GetCurrentContext()));
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate());
// Decode but avoid a redundant pass over function bodies for verification.
@@ -187,7 +189,7 @@ i::MaybeHandle<i::JSObject> InstantiateModule(
if (!thrower->error()) {
DCHECK(!compiled_module.is_null());
object = i::wasm::WasmModule::Instantiate(
- isolate, compiled_module.ToHandleChecked(), ffi, memory);
+ isolate, context, compiled_module.ToHandleChecked(), ffi, memory);
if (!object.is_null()) {
args.GetReturnValue().Set(v8::Utils::ToLocal(object.ToHandleChecked()));
}
@@ -394,8 +396,8 @@ void WebAssemblyInstance(const v8::FunctionCallbackInfo<v8::Value>& args) {
i::Handle<i::Object> mem_obj = v8::Utils::OpenHandle(*obj);
memory = i::Handle<i::JSArrayBuffer>(i::JSArrayBuffer::cast(*mem_obj));
}
- i::MaybeHandle<i::JSObject> instance =
- i::wasm::WasmModule::Instantiate(i_isolate, compiled_code, ffi, memory);
+ i::MaybeHandle<i::JSObject> instance = i::wasm::WasmModule::Instantiate(
+ i_isolate, i_context, compiled_code, ffi, memory);
if (instance.is_null()) {
thrower.Error("Could not instantiate module");
return;

Powered by Google App Engine
This is Rietveld 408576698