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

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

Issue 1828223002: [wasm] Fix formal parameter count and parameter indexes in JS->wasm wrappers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | test/mjsunit/wasm/adapter-frame.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/wasm-compiler.cc
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc
index c47f5495e4646852d68a7bfa9d9859a393d2cb93..6d5f20ee876ceb4e758ff21493dab34e1198755a 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -2075,19 +2075,22 @@ void WasmGraphBuilder::BuildJSToWasmWrapper(Handle<Code> wasm_code,
Node** args = Buffer(count);
// Build the start and the JS parameter nodes.
- Node* start = Start(params + 3);
+ Node* start = Start(params + 5);
*control_ = start;
*effect_ = start;
- // JS context is the last parameter.
+ // Create the context parameter
Node* context = graph()->NewNode(
- jsgraph()->common()->Parameter(params + 1, "context"), start);
+ jsgraph()->common()->Parameter(
+ Linkage::GetJSCallContextParamIndex(params + 1), "%context"),
+ graph()->start());
int pos = 0;
args[pos++] = Constant(wasm_code);
// Convert JS parameters to WASM numbers.
for (int i = 0; i < params; i++) {
- Node* param = graph()->NewNode(jsgraph()->common()->Parameter(i), start);
+ Node* param =
+ graph()->NewNode(jsgraph()->common()->Parameter(i + 1), start);
args[pos++] = FromJS(param, context, sig->GetParam(i));
}
@@ -2384,7 +2387,7 @@ Handle<JSFunction> CompileJSToWasmWrapper(
isolate->factory()->NewSharedFunctionInfo(name, wasm_code, false);
int params = static_cast<int>(func->sig->parameter_count());
shared->set_length(params);
- shared->set_internal_formal_parameter_count(1 + params);
+ shared->set_internal_formal_parameter_count(params);
Handle<JSFunction> function = isolate->factory()->NewFunction(
isolate->wasm_function_map(), name, MaybeHandle<Code>());
function->SetInternalField(0, *module_object);
« no previous file with comments | « no previous file | test/mjsunit/wasm/adapter-frame.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698