| Index: src/wasm/module-compiler.cc
|
| diff --git a/src/wasm/module-compiler.cc b/src/wasm/module-compiler.cc
|
| index 9d83480c01d2e9b45498b139c28abea1956bcbb0..fdaf5a9b63e6feb76af6ab41d680cf3f4d859e2d 100644
|
| --- a/src/wasm/module-compiler.cc
|
| +++ b/src/wasm/module-compiler.cc
|
| @@ -71,7 +71,6 @@ ModuleCompiler::ModuleCompiler(Isolate* isolate,
|
| counters_shared_(isolate->counters_shared()),
|
| is_sync_(is_sync),
|
| executed_units_(isolate->random_number_generator()) {
|
| - counters_ = counters_shared_.get();
|
| }
|
|
|
| // The actual runnable task that performs compilations in the background.
|
| @@ -125,10 +124,8 @@ size_t ModuleCompiler::InitializeParallelCompilation(
|
| compilation_units_.reserve(funcs_to_compile);
|
| for (uint32_t i = start; i < num_funcs; ++i) {
|
| const WasmFunction* func = &functions[i];
|
| - constexpr bool is_sync = true;
|
| compilation_units_.push_back(std::unique_ptr<compiler::WasmCompilationUnit>(
|
| - new compiler::WasmCompilationUnit(isolate_, &module_env, func,
|
| - !is_sync)));
|
| + new compiler::WasmCompilationUnit(isolate_, &module_env, func)));
|
| }
|
| return funcs_to_compile;
|
| }
|
| @@ -322,18 +319,9 @@ MaybeHandle<WasmModuleObject> ModuleCompiler::CompileToModuleObject(
|
| function_tables->set(i, *temp_instance.function_tables[i]);
|
| signature_tables->set(i, *temp_instance.signature_tables[i]);
|
| }
|
| -
|
| - if (is_sync_) {
|
| - // TODO(karlschimpf): Make this work when asynchronous.
|
| - // https://bugs.chromium.org/p/v8/issues/detail?id=6361
|
| - HistogramTimerScope wasm_compile_module_time_scope(
|
| - module_->is_wasm()
|
| - ? isolate_->counters()->wasm_compile_wasm_module_time()
|
| - : isolate_->counters()->wasm_compile_asm_module_time());
|
| - return CompileToModuleObjectInternal(
|
| - thrower, wire_bytes, asm_js_script, asm_js_offset_table_bytes, factory,
|
| - &temp_instance, &function_tables, &signature_tables);
|
| - }
|
| + TimedHistogramScope wasm_compile_module_time_scope(
|
| + module_->is_wasm() ? counters()->wasm_compile_wasm_module_time()
|
| + : counters()->wasm_compile_asm_module_time());
|
| return CompileToModuleObjectInternal(
|
| thrower, wire_bytes, asm_js_script, asm_js_offset_table_bytes, factory,
|
| &temp_instance, &function_tables, &signature_tables);
|
| @@ -567,8 +555,8 @@ MaybeHandle<WasmModuleObject> ModuleCompiler::CompileToModuleObjectInternal(
|
| if (is_sync_)
|
| // TODO(karlschimpf): Make this work when asynchronous.
|
| // https://bugs.chromium.org/p/v8/issues/detail?id=6361
|
| - (module_->is_wasm() ? isolate_->counters()->wasm_functions_per_wasm_module()
|
| - : isolate_->counters()->wasm_functions_per_asm_module())
|
| + (module_->is_wasm() ? counters()->wasm_functions_per_wasm_module()
|
| + : counters()->wasm_functions_per_asm_module())
|
| ->AddSample(static_cast<int>(module_->functions.size()));
|
|
|
| if (!lazy_compile) {
|
| @@ -602,7 +590,7 @@ MaybeHandle<WasmModuleObject> ModuleCompiler::CompileToModuleObjectInternal(
|
| i < temp_instance->function_code.size(); ++i) {
|
| Code* code = *temp_instance->function_code[i];
|
| code_table->set(static_cast<int>(i), code);
|
| - RecordStats(code, counters_);
|
| + RecordStats(code, counters());
|
| }
|
|
|
| // Create heap objects for script, module bytes and asm.js offset table to
|
| @@ -668,7 +656,7 @@ MaybeHandle<WasmModuleObject> ModuleCompiler::CompileToModuleObjectInternal(
|
| isolate_, module, wasm_code, exp.index);
|
| int export_index = static_cast<int>(module->functions.size() + func_index);
|
| code_table->set(export_index, *wrapper_code);
|
| - RecordStats(*wrapper_code, counters_);
|
| + RecordStats(*wrapper_code, counters());
|
| func_index++;
|
| }
|
|
|
| @@ -721,7 +709,6 @@ InstanceBuilder::InstanceBuilder(
|
| memory_(memory.is_null() ? Handle<JSArrayBuffer>::null()
|
| : memory.ToHandleChecked()),
|
| instance_finalizer_callback_(instance_finalizer_callback) {
|
| - counters_ = counters_shared_.get();
|
| }
|
|
|
| // Build an instance, in all of its glory.
|
| @@ -736,9 +723,8 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
|
|
|
| // Record build time into correct bucket, then build instance.
|
| HistogramTimerScope wasm_instantiate_module_time_scope(
|
| - module_->is_wasm()
|
| - ? isolate_->counters()->wasm_instantiate_wasm_module_time()
|
| - : isolate_->counters()->wasm_instantiate_asm_module_time());
|
| + module_->is_wasm() ? counters()->wasm_instantiate_wasm_module_time()
|
| + : counters()->wasm_instantiate_asm_module_time());
|
| Factory* factory = isolate_->factory();
|
|
|
| //--------------------------------------------------------------------------
|
| @@ -812,7 +798,7 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
|
| UNREACHABLE();
|
| }
|
| }
|
| - RecordStats(code_table, counters_);
|
| + RecordStats(code_table, counters());
|
| } else {
|
| // There was no owner, so we can reuse the original.
|
| compiled_module_ = original;
|
| @@ -891,8 +877,8 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
|
| // Set up the memory for the new instance.
|
| //--------------------------------------------------------------------------
|
| uint32_t min_mem_pages = module_->min_mem_pages;
|
| - (module_->is_wasm() ? isolate_->counters()->wasm_wasm_min_mem_pages_count()
|
| - : isolate_->counters()->wasm_asm_min_mem_pages_count())
|
| + (module_->is_wasm() ? counters()->wasm_wasm_min_mem_pages_count()
|
| + : counters()->wasm_asm_min_mem_pages_count())
|
| ->AddSample(min_mem_pages);
|
|
|
| if (!memory_.is_null()) {
|
| @@ -1093,7 +1079,7 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
|
| Handle<WasmExportedFunction> startup_fct = WasmExportedFunction::New(
|
| isolate_, instance, MaybeHandle<String>(), start_index,
|
| static_cast<int>(sig->parameter_count()), wrapper_code);
|
| - RecordStats(*startup_code, counters_);
|
| + RecordStats(*startup_code, counters());
|
| // Call the JS function.
|
| Handle<Object> undefined = factory->undefined_value();
|
| MaybeHandle<Object> retval =
|
| @@ -1291,7 +1277,7 @@ int InstanceBuilder::ProcessImports(Handle<FixedArray> code_table,
|
| return -1;
|
| }
|
| code_table->set(num_imported_functions, *import_wrapper);
|
| - RecordStats(*import_wrapper, counters_);
|
| + RecordStats(*import_wrapper, counters());
|
| num_imported_functions++;
|
| break;
|
| }
|
| @@ -1857,7 +1843,6 @@ AsyncCompileJob::AsyncCompileJob(Isolate* isolate,
|
| context_ = Handle<Context>(*context);
|
| module_promise_ = Handle<JSPromise>(*promise);
|
| deferred_handles_.push_back(deferred.Detach());
|
| - counters_ = counters_shared_.get();
|
| }
|
|
|
| void AsyncCompileJob::Start() {
|
| @@ -1946,10 +1931,9 @@ class AsyncCompileJob::DecodeModule : public AsyncCompileJob::AsyncCompileTask {
|
| DisallowHeapAllocation no_allocation;
|
| // Decode the module bytes.
|
| TRACE_COMPILE("(1) Decoding module...\n");
|
| - constexpr bool is_sync = true;
|
| - result = DecodeWasmModule(job_->isolate_, job_->wire_bytes_.start(),
|
| - job_->wire_bytes_.end(), false, kWasmOrigin,
|
| - !is_sync);
|
| + result = AsyncDecodeWasmModule(job_->isolate_, job_->wire_bytes_.start(),
|
| + job_->wire_bytes_.end(), false,
|
| + kWasmOrigin, job_->counters_shared_);
|
| }
|
| if (result.failed()) {
|
| // Decoding failure; reject the promise and clean up.
|
| @@ -2035,7 +2019,7 @@ class AsyncCompileJob::PrepareAndStartCompile : public SyncCompileTask {
|
| job_->temp_instance_->function_code[i] = illegal_builtin;
|
| }
|
|
|
| - job_->isolate_->counters()->wasm_functions_per_wasm_module()->AddSample(
|
| + job_->counters()->wasm_functions_per_wasm_module()->AddSample(
|
| static_cast<int>(module_->functions.size()));
|
|
|
| // Transfer ownership of the {WasmModule} to the {ModuleCompiler}, but
|
| @@ -2214,7 +2198,7 @@ class AsyncCompileJob::FinishCompile : public SyncCompileTask {
|
| for (size_t i = FLAG_skip_compiling_wasm_funcs;
|
| i < job_->temp_instance_->function_code.size(); ++i) {
|
| Code* code = Code::cast(job_->code_table_->get(static_cast<int>(i)));
|
| - RecordStats(code, job_->counters_);
|
| + RecordStats(code, job_->counters());
|
| }
|
|
|
| // Create heap objects for script and module bytes to be stored in the
|
| @@ -2290,7 +2274,7 @@ class AsyncCompileJob::CompileWrappers : public SyncCompileTask {
|
| int export_index =
|
| static_cast<int>(module->functions.size() + func_index);
|
| job_->code_table_->set(export_index, *wrapper_code);
|
| - RecordStats(*wrapper_code, job_->counters_);
|
| + RecordStats(*wrapper_code, job_->counters());
|
| func_index++;
|
| }
|
|
|
|
|