| Index: src/wasm/wasm-module.cc
|
| diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
|
| index f27f613f4c26e6666c211b671185ad636c7e006c..cd5fa420628e1d75b3f2985865fb9825b10cd09a 100644
|
| --- a/src/wasm/wasm-module.cc
|
| +++ b/src/wasm/wasm-module.cc
|
| @@ -359,7 +359,7 @@ class CompilationHelper {
|
| compilation_units_.push_back(
|
| new compiler::WasmCompilationUnit(isolate_, &module_env, func));
|
| }
|
| - return num_funcs;
|
| + return funcs_to_compile;
|
| }
|
|
|
| void InitializeHandles() {
|
| @@ -625,9 +625,6 @@ class CompilationHelper {
|
| // object.
|
| Handle<WasmCompiledModule> compiled_module = WasmCompiledModule::New(
|
| isolate_, shared, code_table, function_tables, signature_tables);
|
| - if (function_table_count > 0) {
|
| - compiled_module->set_function_tables(function_tables);
|
| - }
|
|
|
| // If we created a wasm script, finish it now and make it public to the
|
| // debugger.
|
| @@ -2699,6 +2696,17 @@ class AsyncCompileJob {
|
| size_t outstanding_units_ = 0;
|
| size_t num_background_tasks_ = 0;
|
|
|
| + void ReopenHandlesInDeferredScope() {
|
| + DeferredHandleScope deferred(isolate_);
|
| + module_wrapper_ = handle(*module_wrapper_, isolate_);
|
| + function_tables_ = handle(*function_tables_, isolate_);
|
| + signature_tables_ = handle(*signature_tables_, isolate_);
|
| + code_table_ = handle(*code_table_, isolate_);
|
| + temp_instance_->ReopenHandles(isolate_);
|
| + helper_->InitializeHandles();
|
| + deferred_handles_.push_back(deferred.Detach());
|
| + }
|
| +
|
| //==========================================================================
|
| // Step 1: (async) Decode the module.
|
| //==========================================================================
|
| @@ -2787,9 +2795,7 @@ class AsyncCompileJob {
|
| size_t num_functions =
|
| module_->functions.size() - module_->num_imported_functions;
|
| if (num_functions == 0) {
|
| - DeferredHandleScope deferred(isolate_);
|
| - module_wrapper_ = handle(*module_wrapper_, isolate_);
|
| - deferred_handles_.push_back(deferred.Detach());
|
| + ReopenHandlesInDeferredScope();
|
| // Degenerate case of an empty module.
|
| return DoSync(&AsyncCompileJob::FinishCompile);
|
| }
|
| @@ -2807,15 +2813,7 @@ class AsyncCompileJob {
|
| module_->functions, *module_bytes_env_);
|
|
|
| // Reopen all handles which should survive in the DeferredHandleScope.
|
| - DeferredHandleScope deferred(isolate_);
|
| - module_wrapper_ = handle(*module_wrapper_, isolate_);
|
| - function_tables_ = handle(*function_tables_, isolate_);
|
| - signature_tables_ = handle(*signature_tables_, isolate_);
|
| - code_table_ = handle(*code_table_, isolate_);
|
| - temp_instance_->ReopenHandles(isolate_);
|
| - helper_->InitializeHandles();
|
| - deferred_handles_.push_back(deferred.Detach());
|
| -
|
| + ReopenHandlesInDeferredScope();
|
| task_ids_ =
|
| std::unique_ptr<uint32_t[]>(new uint32_t[num_background_tasks_]);
|
| for (size_t i = 0; i < num_background_tasks_; ++i) {
|
| @@ -2863,7 +2861,7 @@ class AsyncCompileJob {
|
| failed_ = true;
|
| } else {
|
| DCHECK(func_index >= 0);
|
| - code_table_->set(func_index + module_->num_imported_functions, *(result));
|
| + code_table_->set(func_index, *(result));
|
| }
|
| if (failed_ || --outstanding_units_ == 0) {
|
| // All compilation units are done. We still need to wait for the
|
|
|