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

Unified Diff: src/compiler/wasm-compiler.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/compiler/wasm-compiler.cc
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc
index cd2cd81a70d8ad871314334a380ef5f29853fa1b..797ba412a29e701b683faad39dae713e7432cc56 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -2566,7 +2566,8 @@ void WasmGraphBuilder::BuildJSToWasmWrapper(Handle<Code> wasm_code,
MergeControlToEnd(jsgraph(), ret);
}
-void WasmGraphBuilder::BuildWasmToJSWrapper(Handle<JSReceiver> target,
+void WasmGraphBuilder::BuildWasmToJSWrapper(Handle<Context> context,
+ Handle<JSReceiver> target,
wasm::FunctionSig* sig) {
DCHECK(target->IsCallable());
@@ -2587,7 +2588,7 @@ void WasmGraphBuilder::BuildWasmToJSWrapper(Handle<JSReceiver> target,
Node** args = Buffer(wasm_count + 7);
// The default context of the target.
- Handle<Context> target_context = isolate->native_context();
+ Handle<Context> target_context = context;
// Optimization: check if the target is a JSFunction with the right arity so
// that we can call it directly.
@@ -2657,7 +2658,7 @@ void WasmGraphBuilder::BuildWasmToJSWrapper(Handle<JSReceiver> target,
// Convert the return value back.
Node* ret;
Node* val =
- FromJS(call, HeapConstant(isolate->native_context()),
+ FromJS(call, HeapConstant(context),
sig->return_count() == 0 ? wasm::kAstStmt : sig->GetReturn());
if (jsgraph()->machine()->Is32() && sig->return_count() > 0 &&
sig->GetReturn() == wasm::kAstI64) {
@@ -3013,7 +3014,8 @@ Handle<Code> CompileJSToWasmWrapper(Isolate* isolate, wasm::ModuleEnv* module,
return code;
}
-Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, Handle<JSReceiver> target,
+Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, Handle<Context> context,
+ Handle<JSReceiver> target,
wasm::FunctionSig* sig, uint32_t index,
Handle<String> import_module,
MaybeHandle<String> import_function) {
@@ -3032,7 +3034,7 @@ Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, Handle<JSReceiver> target,
WasmGraphBuilder builder(&zone, &jsgraph, sig);
builder.set_control_ptr(&control);
builder.set_effect_ptr(&effect);
- builder.BuildWasmToJSWrapper(target, sig);
+ builder.BuildWasmToJSWrapper(context, target, sig);
Handle<Code> code = Handle<Code>::null();
{

Powered by Google App Engine
This is Rietveld 408576698