Chromium Code Reviews| Index: src/wasm/module-decoder.cc |
| diff --git a/src/wasm/module-decoder.cc b/src/wasm/module-decoder.cc |
| index e029f34fd5d777642919e1ca796580f8662b08a9..7a077d809a3053c62df1d3d17094191a82a0e3ca 100644 |
| --- a/src/wasm/module-decoder.cc |
| +++ b/src/wasm/module-decoder.cc |
| @@ -1077,10 +1077,9 @@ Vector<const byte> FindSection(const byte* module_start, const byte* module_end, |
| } // namespace |
| -ModuleResult DecodeWasmModule(Isolate* isolate, Zone* zone, |
| - const byte* module_start, const byte* module_end, |
| - bool verify_functions, ModuleOrigin origin) { |
| - size_t decode_memory_start = zone->allocation_size(); |
| +ModuleResult DecodeWasmModule(Isolate* isolate, const byte* module_start, |
| + const byte* module_end, bool verify_functions, |
| + ModuleOrigin origin) { |
| HistogramTimerScope wasm_decode_module_time_scope( |
| isolate->counters()->wasm_decode_module_time()); |
| size_t size = module_end - module_start; |
| @@ -1089,12 +1088,17 @@ ModuleResult DecodeWasmModule(Isolate* isolate, Zone* zone, |
| // TODO(bradnelson): Improve histogram handling of size_t. |
| isolate->counters()->wasm_module_size_bytes()->AddSample( |
| static_cast<int>(size)); |
| - WasmModule* module = new WasmModule(); |
| + // Signatures are stored in zone memory, which have the same lifetime |
| + // as the {module}. |
| + Zone* zone = new Zone(isolate->allocator(), ZONE_NAME); |
| + WasmModule* module = new WasmModule(zone, module_start); |
| ModuleDecoder decoder(zone, module_start, module_end, origin); |
| ModuleResult result = decoder.DecodeModule(module, verify_functions); |
| // TODO(bradnelson): Improve histogram handling of size_t. |
| + // TODO(titzer): this isn't accurate, since it doesn't count the data |
| + // allocated on the C++ heap. |
|
Mircea Trofin
2016/10/19 05:28:55
mind opening and referencing an issue for this?
titzer
2016/10/19 09:54:41
Done.
|
| isolate->counters()->wasm_decode_module_peak_memory_bytes()->AddSample( |
| - static_cast<int>(zone->allocation_size() - decode_memory_start)); |
| + static_cast<int>(zone->allocation_size())); |
| return result; |
| } |