Commit 007e183e authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Reuse existing {ModuleEnv} during lazy compilation.

R=clemensh@chromium.org

Change-Id: I6b109a596ba4bbeeab4189003b902f026ab79ac9
Reviewed-on: https://chromium-review.googlesource.com/1107809Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53885}
parent 34d1cf28
...@@ -370,13 +370,6 @@ MaybeHandle<WasmInstanceObject> InstantiateToInstanceObject( ...@@ -370,13 +370,6 @@ MaybeHandle<WasmInstanceObject> InstantiateToInstanceObject(
return {}; return {};
} }
ModuleEnv CreateModuleEnvFromNativeModule(NativeModule* native_module) {
WasmModule* module = native_module->module_object()->module();
wasm::UseTrapHandler use_trap_handler =
native_module->use_trap_handler() ? kUseTrapHandler : kNoTrapHandler;
return ModuleEnv(module, use_trap_handler, wasm::kRuntimeExceptionSupport);
}
wasm::WasmCode* LazyCompileFunction(Isolate* isolate, wasm::WasmCode* LazyCompileFunction(Isolate* isolate,
NativeModule* native_module, NativeModule* native_module,
int func_index) { int func_index) {
...@@ -397,18 +390,18 @@ wasm::WasmCode* LazyCompileFunction(Isolate* isolate, ...@@ -397,18 +390,18 @@ wasm::WasmCode* LazyCompileFunction(Isolate* isolate,
TRACE_LAZY("Compiling function '%s' (#%d).\n", func_name.c_str(), func_index); TRACE_LAZY("Compiling function '%s' (#%d).\n", func_name.c_str(), func_index);
ModuleEnv module_env = CreateModuleEnvFromNativeModule(native_module); ModuleEnv* module_env = native_module->compilation_state()->module_env();
const uint8_t* module_start = const uint8_t* module_start =
native_module->module_object()->module_bytes()->GetChars(); native_module->module_object()->module_bytes()->GetChars();
const WasmFunction* func = &module_env.module->functions[func_index]; const WasmFunction* func = &module_env->module->functions[func_index];
FunctionBody body{func->sig, func->code.offset(), FunctionBody body{func->sig, func->code.offset(),
module_start + func->code.offset(), module_start + func->code.offset(),
module_start + func->code.end_offset()}; module_start + func->code.end_offset()};
ErrorThrower thrower(isolate, "WasmLazyCompile"); ErrorThrower thrower(isolate, "WasmLazyCompile");
WasmCompilationUnit unit(isolate, &module_env, native_module, body, WasmCompilationUnit unit(isolate, module_env, native_module, body,
CStrVector(func_name.c_str()), func_index); CStrVector(func_name.c_str()), func_index);
unit.ExecuteCompilation(); unit.ExecuteCompilation();
wasm::WasmCode* wasm_code = unit.FinishCompilation(&thrower); wasm::WasmCode* wasm_code = unit.FinishCompilation(&thrower);
......
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