Index: src/wasm/wasm-module.cc |
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc |
index f297d749fec39e5fa3e9c8b325272b3ef635e552..0c10a52c932d5c2ef6f8fa410c0ef2a6ef961c2a 100644 |
--- a/src/wasm/wasm-module.cc |
+++ b/src/wasm/wasm-module.cc |
@@ -411,7 +411,7 @@ bool FetchAndExecuteCompilationUnit( |
compiler::WasmCompilationUnit* unit = compilation_units->at(index); |
if (unit != nullptr) { |
- compiler::ExecuteCompilation(unit); |
+ unit->ExecuteCompilation(); |
{ |
base::LockGuard<base::Mutex> guard(result_mutex); |
executed_units->push(unit); |
@@ -498,7 +498,7 @@ void InitializeParallelCompilation( |
} |
for (uint32_t i = FLAG_skip_compiling_wasm_funcs; i < functions.size(); i++) { |
- compilation_units[i] = compiler::CreateWasmCompilationUnit( |
+ compilation_units[i] = new compiler::WasmCompilationUnit( |
&thrower, isolate, &module_env, &functions[i], i); |
} |
} |
@@ -553,8 +553,9 @@ void FinishCompilationUnits( |
unit = executed_units.front(); |
executed_units.pop(); |
} |
- int j = compiler::GetIndexOfWasmCompilationUnit(unit); |
- results[j] = compiler::FinishCompilation(unit); |
+ int j = unit->index(); |
+ results[j] = unit->FinishCompilation(); |
+ delete unit; |
} |
} |
@@ -580,8 +581,8 @@ bool FinishCompilation(Isolate* isolate, WasmModule* module, |
code = results[i]; |
} else { |
// Compile the function. |
- code = |
- compiler::CompileWasmFunction(&thrower, isolate, &module_env, &func); |
+ code = compiler::WasmCompilationUnit::CompileWasmFunction( |
+ &thrower, isolate, &module_env, &func); |
} |
if (code.is_null()) { |
thrower.Error("Compilation of #%d:%.*s failed.", i, str.length(), |
@@ -772,7 +773,7 @@ MaybeHandle<JSObject> WasmModule::Instantiate(Isolate* isolate, |
if (!FinishCompilation(isolate, this, ffi, results, instance, code_table, |
thrower, factory, module_env, total_code_size, |
desc)) { |
- return MaybeHandle<JSObject>(); |
+ instance.js_object = Handle<JSObject>::null(); |
} |
// Patch all direct call sites. |
@@ -930,8 +931,8 @@ int32_t CompileAndRunWasmModule(Isolate* isolate, WasmModule* module) { |
for (const WasmFunction& func : module->functions) { |
DCHECK_EQ(index, func.func_index); |
// Compile the function and install it in the code table. |
- Handle<Code> code = |
- compiler::CompileWasmFunction(&thrower, isolate, &module_env, &func); |
+ Handle<Code> code = compiler::WasmCompilationUnit::CompileWasmFunction( |
+ &thrower, isolate, &module_env, &func); |
if (!code.is_null()) { |
if (func.exported) { |
main_code = code; |