Index: src/wasm/wasm-module.cc |
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc |
index 386a9ce5af8a2994d11bd5182ed246e9950cd30d..e77afcf71297459b24561b35bed05d98aa47b551 100644 |
--- a/src/wasm/wasm-module.cc |
+++ b/src/wasm/wasm-module.cc |
@@ -490,10 +490,12 @@ struct CodeStats { |
} |
}; |
-bool CompileWrappersToImportedFunctions( |
- Isolate* isolate, const WasmModule* module, const Handle<JSReceiver> ffi, |
- WasmModuleInstance* instance, ErrorThrower* thrower, Factory* factory, |
- ModuleEnv* module_env, CodeStats& code_stats) { |
+bool CompileWrappersToImportedFunctions(Isolate* isolate, |
+ const WasmModule* module, |
+ const Handle<JSReceiver> ffi, |
+ WasmModuleInstance* instance, |
+ ErrorThrower* thrower, Factory* factory, |
+ ModuleEnv* module_env) { |
if (module->import_table.size() > 0) { |
instance->import_code.reserve(module->import_table.size()); |
for (uint32_t index = 0; index < module->import_table.size(); ++index) { |
@@ -510,7 +512,6 @@ bool CompileWrappersToImportedFunctions( |
isolate, module_env, function.ToHandleChecked(), import.sig, |
module_name, function_name); |
instance->import_code[index] = code; |
- code_stats.Record(*code); |
} |
} |
return true; |
@@ -703,7 +704,6 @@ void SetDeoptimizationData(Factory* factory, Handle<JSObject> js_object, |
Handle<FixedArray> WasmModule::CompileFunctions(Isolate* isolate) const { |
Factory* factory = isolate->factory(); |
ErrorThrower thrower(isolate, "WasmModule::CompileFunctions()"); |
- CodeStats code_stats; |
WasmModuleInstance temp_instance_for_compilation(this); |
temp_instance_for_compilation.function_table = |
@@ -750,7 +750,6 @@ Handle<FixedArray> WasmModule::CompileFunctions(Isolate* isolate) const { |
i < temp_instance_for_compilation.function_code.size(); ++i) { |
Code* code = *temp_instance_for_compilation.function_code[i]; |
ret->set(static_cast<int>(i), code); |
- code_stats.Record(code); |
} |
PopulateFunctionTable(&temp_instance_for_compilation); |
@@ -771,11 +770,6 @@ MaybeHandle<JSObject> WasmModule::Instantiate( |
ErrorThrower thrower(isolate, "WasmModule::Instantiate()"); |
Factory* factory = isolate->factory(); |
- // If FLAG_print_wasm_code_size is set, this aggregates the sum of all code |
- // objects created for this module. |
- // TODO(titzer): switch this to TRACE_EVENT |
- CodeStats code_stats; |
- |
//------------------------------------------------------------------------- |
// Allocate the instance and its JS counterpart. |
//------------------------------------------------------------------------- |
@@ -847,10 +841,17 @@ MaybeHandle<JSObject> WasmModule::Instantiate( |
// Compile wrappers to imported functions. |
//------------------------------------------------------------------------- |
if (!CompileWrappersToImportedFunctions(isolate, this, ffi, &instance, |
- &thrower, factory, &module_env, |
- code_stats)) { |
+ &thrower, factory, &module_env)) { |
return MaybeHandle<JSObject>(); |
} |
+ |
+ // If FLAG_print_wasm_code_size is set, this aggregates the sum of all code |
+ // objects created for this module. |
+ // TODO(titzer): switch this to TRACE_EVENT |
+ CodeStats code_stats; |
Clemens Hammacher
2016/06/20 16:13:04
Now in this design it would make sense to pull the
Mircea Trofin
2016/06/20 22:47:03
Makes sense - done.
|
+ for (Handle<Code> c : instance.function_code) code_stats.Record(*c); |
+ for (Handle<Code> c : instance.import_code) code_stats.Record(*c); |
+ |
{ |
instance.js_object->SetInternalField(kWasmModuleFunctionTable, |
Smi::FromInt(0)); |