| Index: src/wasm/wasm-module.cc
|
| diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
|
| index 4e63648c912be82608df1e418f8c3fdf1fa7a3cf..f16810c72c71716dd22849c5235d5afbcaab6e53 100644
|
| --- a/src/wasm/wasm-module.cc
|
| +++ b/src/wasm/wasm-module.cc
|
| @@ -636,6 +636,7 @@ Handle<FixedArray> GetImportsMetadata(Factory* factory,
|
| }
|
|
|
| bool CompileWrappersToImportedFunctions(Isolate* isolate,
|
| + Handle<Context> context,
|
| const Handle<JSReceiver> ffi,
|
| std::vector<Handle<Code>>& imports,
|
| Handle<FixedArray> import_data,
|
| @@ -708,8 +709,8 @@ bool CompileWrappersToImportedFunctions(Isolate* isolate,
|
| sizeof(MachineRepresentation) * sig_data_size);
|
| FunctionSig sig(ret_count, param_count, reps);
|
|
|
| - code = compiler::CompileWasmToJSWrapper(isolate, target, &sig, index,
|
| - module_name, function_name);
|
| + code = compiler::CompileWasmToJSWrapper(
|
| + isolate, context, target, &sig, index, module_name, function_name);
|
| }
|
| imports.push_back(code);
|
| }
|
| @@ -947,9 +948,9 @@ bool SetupInstanceHeap(Isolate* isolate, Handle<FixedArray> compiled_module,
|
| return true;
|
| }
|
|
|
| -bool SetupImports(Isolate* isolate, Handle<FixedArray> compiled_module,
|
| - Handle<JSObject> instance, ErrorThrower* thrower,
|
| - Handle<JSReceiver> ffi) {
|
| +bool SetupImports(Isolate* isolate, Handle<Context> context,
|
| + Handle<FixedArray> compiled_module, Handle<JSObject> instance,
|
| + ErrorThrower* thrower, Handle<JSReceiver> ffi) {
|
| //-------------------------------------------------------------------------
|
| // Compile wrappers to imported functions.
|
| //-------------------------------------------------------------------------
|
| @@ -958,7 +959,7 @@ bool SetupImports(Isolate* isolate, Handle<FixedArray> compiled_module,
|
| compiled_module->GetValue<FixedArray>(isolate, kImportData);
|
| Handle<FixedArray> import_data;
|
| if (maybe_import_data.ToHandle(&import_data)) {
|
| - if (!CompileWrappersToImportedFunctions(isolate, ffi, import_code,
|
| + if (!CompileWrappersToImportedFunctions(isolate, context, ffi, import_code,
|
| import_data, thrower)) {
|
| return false;
|
| }
|
| @@ -1323,8 +1324,9 @@ Handle<FixedArray> CloneModuleForInstance(Isolate* isolate,
|
| // * installs named properties on the object for exported functions
|
| // * compiles wasm code to machine code
|
| MaybeHandle<JSObject> WasmModule::Instantiate(
|
| - Isolate* isolate, Handle<FixedArray> compiled_module,
|
| - Handle<JSReceiver> ffi, Handle<JSArrayBuffer> memory) {
|
| + Isolate* isolate, Handle<Context> context,
|
| + Handle<FixedArray> compiled_module, Handle<JSReceiver> ffi,
|
| + Handle<JSArrayBuffer> memory) {
|
| HistogramTimerScope wasm_instantiate_module_time_scope(
|
| isolate->counters()->wasm_instantiate_module_time());
|
| ErrorThrower thrower(isolate, "WasmModule::Instantiate()");
|
| @@ -1357,7 +1359,8 @@ MaybeHandle<JSObject> WasmModule::Instantiate(
|
| if (!(SetupInstanceHeap(isolate, compiled_module, js_object, memory,
|
| &thrower) &&
|
| SetupGlobals(isolate, compiled_module, js_object, &thrower) &&
|
| - SetupImports(isolate, compiled_module, js_object, &thrower, ffi) &&
|
| + SetupImports(isolate, context, compiled_module, js_object, &thrower,
|
| + ffi) &&
|
| SetupExportsObject(compiled_module, isolate, js_object, &thrower))) {
|
| return nothing;
|
| }
|
| @@ -1623,7 +1626,8 @@ int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start,
|
|
|
| if (compiled_module.is_null()) return -1;
|
| Handle<JSObject> instance =
|
| - WasmModule::Instantiate(isolate, compiled_module.ToHandleChecked(),
|
| + WasmModule::Instantiate(isolate, handle(isolate->context(), isolate),
|
| + compiled_module.ToHandleChecked(),
|
| Handle<JSReceiver>::null(),
|
| Handle<JSArrayBuffer>::null())
|
| .ToHandleChecked();
|
|
|