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

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

Issue 2483193002: [wasm] Wrap start function in a JS->WASM wrapper before calling it during initialization. (Closed)
Patch Set: Created 4 years, 1 month 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/start-function.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-module.cc
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
index fe6fb60dce3a188445d75e8461237de8807abe75..5b4b8e0f2895bab32b4e6402663e9b1bf7ae7157 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -1233,12 +1233,18 @@ class WasmInstanceBuilder {
//--------------------------------------------------------------------------
if (module_->start_function_index >= 0) {
HandleScope scope(isolate_);
+ ModuleEnv module_env;
+ module_env.module = module_;
+ module_env.instance = nullptr;
+ module_env.origin = module_->origin;
int start_index = module_->start_function_index;
Handle<Code> startup_code =
code_table->GetValueChecked<Code>(isolate_, start_index);
FunctionSig* sig = module_->functions[start_index].sig;
+ Handle<Code> wrapper_code = compiler::CompileJSToWasmWrapper(
+ isolate_, &module_env, startup_code, start_index);
Handle<JSFunction> startup_fct = WrapExportCodeAsJSFunction(
- isolate_, startup_code, factory->InternalizeUtf8String("start"), sig,
+ isolate_, wrapper_code, factory->InternalizeUtf8String("start"), sig,
start_index, instance);
RecordStats(isolate_, *startup_code);
// Call the JS function.
« no previous file with comments | « no previous file | test/mjsunit/wasm/start-function.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698