Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Unified Diff: src/wasm/wasm-module.cc

Issue 2772773004: Separate module instantiate counter for asm and wasm. (Closed)
Patch Set: Fix switch default fallthru. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/counters.h ('K') | « src/counters.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-module.cc
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
index fbe9a91c1a130ead3b125dd1b5f1e5b21fe31510..6df2da1139ecb86de60bb7eb9e0f656072291a26 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -1153,8 +1153,58 @@ class InstantiationHelper {
return {};
}
- HistogramTimerScope wasm_instantiate_module_time_scope(
- isolate_->counters()->wasm_instantiate_module_time());
+ // Record build time into correct bucket, then build instance.
+ if (module_->origin == ModuleOrigin::kWasmOrigin) {
+ HistogramTimerScope wasm_instantiate_module_time_scope(
+ isolate_->counters()->wasm_instantiate_wasm_module_time());
+ return BuildInstance();
+ } else {
+ HistogramTimerScope wasm_instantiate_module_time_scope(
+ isolate_->counters()->wasm_instantiate_asm_module_time());
+ return BuildInstance();
+ }
bbudge 2017/03/23 22:04:58 Why not return BuildInstance() here? Or why not ju
bbudge 2017/03/23 22:14:48 I didn't see the scope objects before. You could c
Karl 2017/03/24 16:49:19 I factored out the rest of the code, as you note,
+ }
+
+ private:
+ // Represents the initialized state of a table.
+ struct TableInstance {
+ Handle<WasmTableObject> table_object; // WebAssembly.Table instance
+ Handle<FixedArray> js_wrappers; // JSFunctions exported
+ Handle<FixedArray> function_table; // internal code array
+ Handle<FixedArray> signature_table; // internal sig array
+ };
+
+ Isolate* isolate_;
+ WasmModule* const module_;
+ ErrorThrower* thrower_;
+ Handle<WasmModuleObject> module_object_;
+ Handle<JSReceiver> ffi_; // TODO(titzer): Use MaybeHandle
+ Handle<JSArrayBuffer> memory_; // TODO(titzer): Use MaybeHandle
+ Handle<JSArrayBuffer> globals_;
+ Handle<WasmCompiledModule> compiled_module_;
+ std::vector<TableInstance> table_instances_;
+ std::vector<Handle<JSFunction>> js_wrappers_;
+ JSToWasmWrapperCache js_to_wasm_cache_;
+
+ // Helper routines to print out errors with imports.
+ void ReportLinkError(const char* error, uint32_t index,
+ Handle<String> module_name, Handle<String> import_name) {
+ thrower_->LinkError(
+ "Import #%d module=\"%.*s\" function=\"%.*s\" error: %s", index,
+ module_name->length(), module_name->ToCString().get(),
+ import_name->length(), import_name->ToCString().get(), error);
+ }
+
+ MaybeHandle<Object> ReportLinkError(const char* error, uint32_t index,
+ Handle<String> module_name) {
+ thrower_->LinkError("Import #%d module=\"%.*s\" error: %s", index,
+ module_name->length(), module_name->ToCString().get(),
+ error);
+ return MaybeHandle<Object>();
+ }
+
+ // Build an instance, in all its glory.
+ MaybeHandle<WasmInstanceObject> BuildInstance() {
Factory* factory = isolate_->factory();
//--------------------------------------------------------------------------
@@ -1524,44 +1574,6 @@ class InstantiationHelper {
return instance;
}
- private:
- // Represents the initialized state of a table.
- struct TableInstance {
- Handle<WasmTableObject> table_object; // WebAssembly.Table instance
- Handle<FixedArray> js_wrappers; // JSFunctions exported
- Handle<FixedArray> function_table; // internal code array
- Handle<FixedArray> signature_table; // internal sig array
- };
-
- Isolate* isolate_;
- WasmModule* const module_;
- ErrorThrower* thrower_;
- Handle<WasmModuleObject> module_object_;
- Handle<JSReceiver> ffi_; // TODO(titzer): Use MaybeHandle
- Handle<JSArrayBuffer> memory_; // TODO(titzer): Use MaybeHandle
- Handle<JSArrayBuffer> globals_;
- Handle<WasmCompiledModule> compiled_module_;
- std::vector<TableInstance> table_instances_;
- std::vector<Handle<JSFunction>> js_wrappers_;
- JSToWasmWrapperCache js_to_wasm_cache_;
-
- // Helper routines to print out errors with imports.
- void ReportLinkError(const char* error, uint32_t index,
- Handle<String> module_name, Handle<String> import_name) {
- thrower_->LinkError(
- "Import #%d module=\"%.*s\" function=\"%.*s\" error: %s", index,
- module_name->length(), module_name->ToCString().get(),
- import_name->length(), import_name->ToCString().get(), error);
- }
-
- MaybeHandle<Object> ReportLinkError(const char* error, uint32_t index,
- Handle<String> module_name) {
- thrower_->LinkError("Import #%d module=\"%.*s\" error: %s", index,
- module_name->length(), module_name->ToCString().get(),
- error);
- return MaybeHandle<Object>();
- }
-
// Look up an import value in the {ffi_} object.
MaybeHandle<Object> LookupImport(uint32_t index, Handle<String> module_name,
Handle<String> import_name) {
« src/counters.h ('K') | « src/counters.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698