Commit 30e84538 authored by mtrofin's avatar mtrofin Committed by Commit bot

[wasm] No need for ModuleEnv when building import wrappers.

Yanking out in an effort to reduce dependencies. We probably want to
separate codegen into instance-specific and module-generic purpose -
eventually.

BUG=

Review-Url: https://codereview.chromium.org/2085863003
Cr-Commit-Position: refs/heads/master@{#37126}
parent f99c419b
...@@ -3022,7 +3022,7 @@ Handle<JSFunction> CompileJSToWasmWrapper( ...@@ -3022,7 +3022,7 @@ Handle<JSFunction> CompileJSToWasmWrapper(
return function; return function;
} }
Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module, Handle<Code> CompileWasmToJSWrapper(Isolate* isolate,
Handle<JSFunction> function, Handle<JSFunction> function,
wasm::FunctionSig* sig, wasm::FunctionSig* sig,
wasm::WasmName module_name, wasm::WasmName module_name,
...@@ -3042,7 +3042,6 @@ Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module, ...@@ -3042,7 +3042,6 @@ Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module,
WasmGraphBuilder builder(&zone, &jsgraph, sig); WasmGraphBuilder builder(&zone, &jsgraph, sig);
builder.set_control_ptr(&control); builder.set_control_ptr(&control);
builder.set_effect_ptr(&effect); builder.set_effect_ptr(&effect);
builder.set_module(module);
builder.BuildWasmToJSWrapper(function, sig); builder.BuildWasmToJSWrapper(function, sig);
Handle<Code> code = Handle<Code>::null(); Handle<Code> code = Handle<Code>::null();
......
...@@ -77,7 +77,7 @@ class WasmCompilationUnit final { ...@@ -77,7 +77,7 @@ class WasmCompilationUnit final {
}; };
// Wraps a JS function, producing a code object that can be called from WASM. // Wraps a JS function, producing a code object that can be called from WASM.
Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module, Handle<Code> CompileWasmToJSWrapper(Isolate* isolate,
Handle<JSFunction> function, Handle<JSFunction> function,
wasm::FunctionSig* sig, wasm::FunctionSig* sig,
wasm::WasmName module_name, wasm::WasmName module_name,
......
...@@ -486,12 +486,9 @@ struct CodeStats { ...@@ -486,12 +486,9 @@ struct CodeStats {
} }
}; };
bool CompileWrappersToImportedFunctions(Isolate* isolate, bool CompileWrappersToImportedFunctions(
const WasmModule* module, Isolate* isolate, const WasmModule* module, const Handle<JSReceiver> ffi,
const Handle<JSReceiver> ffi, WasmModuleInstance* instance, ErrorThrower* thrower, Factory* factory) {
WasmModuleInstance* instance,
ErrorThrower* thrower, Factory* factory,
ModuleEnv* module_env) {
if (module->import_table.size() > 0) { if (module->import_table.size() > 0) {
instance->import_code.reserve(module->import_table.size()); instance->import_code.reserve(module->import_table.size());
for (uint32_t index = 0; index < module->import_table.size(); ++index) { for (uint32_t index = 0; index < module->import_table.size(); ++index) {
...@@ -505,8 +502,8 @@ bool CompileWrappersToImportedFunctions(Isolate* isolate, ...@@ -505,8 +502,8 @@ bool CompileWrappersToImportedFunctions(Isolate* isolate,
if (function.is_null()) return false; if (function.is_null()) return false;
Handle<Code> code = compiler::CompileWasmToJSWrapper( Handle<Code> code = compiler::CompileWasmToJSWrapper(
isolate, module_env, function.ToHandleChecked(), import.sig, isolate, function.ToHandleChecked(), import.sig, module_name,
module_name, function_name); function_name);
instance->import_code[index] = code; instance->import_code[index] = code;
} }
} }
...@@ -837,7 +834,7 @@ MaybeHandle<JSObject> WasmModule::Instantiate( ...@@ -837,7 +834,7 @@ MaybeHandle<JSObject> WasmModule::Instantiate(
// Compile wrappers to imported functions. // Compile wrappers to imported functions.
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
if (!CompileWrappersToImportedFunctions(isolate, this, ffi, &instance, if (!CompileWrappersToImportedFunctions(isolate, this, ffi, &instance,
&thrower, factory, &module_env)) { &thrower, factory)) {
return MaybeHandle<JSObject>(); return MaybeHandle<JSObject>();
} }
......
...@@ -188,7 +188,7 @@ class TestingModule : public ModuleEnv { ...@@ -188,7 +188,7 @@ class TestingModule : public ModuleEnv {
uint32_t index = AddFunction(sig, Handle<Code>::null()); uint32_t index = AddFunction(sig, Handle<Code>::null());
WasmName module_name = ArrayVector("test"); WasmName module_name = ArrayVector("test");
WasmName function_name; WasmName function_name;
Handle<Code> code = CompileWasmToJSWrapper(isolate_, this, jsfunc, sig, Handle<Code> code = CompileWasmToJSWrapper(isolate_, jsfunc, sig,
module_name, function_name); module_name, function_name);
instance->function_code[index] = code; instance->function_code[index] = code;
return index; return index;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment