Chromium Code Reviews| Index: src/wasm/wasm-module.cc |
| diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc |
| index 7e9725075e4741cd7a81cb449ca67223f1fe629c..e29ef20953dd814aefd8c83f488ec7bd4b87f903 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. |
| @@ -2735,6 +2732,17 @@ class AsyncCompileJob { |
| size_t outstanding_units_ = 0; |
| size_t num_background_tasks_ = 0; |
| + void MoveHandlesToDeferred() { |
| + 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. |
| //========================================================================== |
| @@ -2823,9 +2831,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()); |
| + MoveHandlesToDeferred(); |
|
ahaas
2017/04/10 07:01:38
The usual name that is used elsewhere in V8 is {Re
Mircea Trofin
2017/04/10 13:35:09
Thanks - I assume you mean ReopenHandles as a suff
|
| // Degenerate case of an empty module. |
| return DoSync(&AsyncCompileJob::FinishCompile); |
| } |
| @@ -2843,15 +2849,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()); |
| - |
| + MoveHandlesToDeferred(); |
| task_ids_ = |
| std::unique_ptr<uint32_t[]>(new uint32_t[num_background_tasks_]); |
| for (size_t i = 0; i < num_background_tasks_; ++i) { |
| @@ -2899,7 +2897,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 |