OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/wasm/module-decoder.h" | 5 #include "src/wasm/module-decoder.h" |
6 #include "src/wasm/function-body-decoder-impl.h" | 6 #include "src/wasm/function-body-decoder-impl.h" |
7 | 7 |
8 #include "src/base/functional.h" | 8 #include "src/base/functional.h" |
9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
10 #include "src/counters.h" | 10 #include "src/counters.h" |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 static_cast<int>(size)); | 1166 static_cast<int>(size)); |
1167 // Signatures are stored in zone memory, which have the same lifetime | 1167 // Signatures are stored in zone memory, which have the same lifetime |
1168 // as the {module}. | 1168 // as the {module}. |
1169 Zone* zone = new Zone(isolate->allocator(), ZONE_NAME); | 1169 Zone* zone = new Zone(isolate->allocator(), ZONE_NAME); |
1170 ModuleDecoder decoder(zone, module_start, module_end, origin); | 1170 ModuleDecoder decoder(zone, module_start, module_end, origin); |
1171 ModuleResult result = decoder.DecodeModule(verify_functions); | 1171 ModuleResult result = decoder.DecodeModule(verify_functions); |
1172 // TODO(bradnelson): Improve histogram handling of size_t. | 1172 // TODO(bradnelson): Improve histogram handling of size_t. |
1173 // TODO(titzer): this isn't accurate, since it doesn't count the data | 1173 // TODO(titzer): this isn't accurate, since it doesn't count the data |
1174 // allocated on the C++ heap. | 1174 // allocated on the C++ heap. |
1175 // https://bugs.chromium.org/p/chromium/issues/detail?id=657320 | 1175 // https://bugs.chromium.org/p/chromium/issues/detail?id=657320 |
1176 isolate->counters()->wasm_decode_module_peak_memory_bytes()->AddSample( | 1176 (IsWasm(origin) |
1177 static_cast<int>(zone->allocation_size())); | 1177 ? isolate->counters()->wasm_decode_wasm_module_peak_memory_bytes() |
| 1178 : isolate->counters()->wasm_decode_asm_module_peak_memory_bytes()) |
| 1179 ->AddSample(static_cast<int>(zone->allocation_size())); |
1178 return result; | 1180 return result; |
1179 } | 1181 } |
1180 | 1182 |
1181 FunctionSig* DecodeWasmSignatureForTesting(Zone* zone, const byte* start, | 1183 FunctionSig* DecodeWasmSignatureForTesting(Zone* zone, const byte* start, |
1182 const byte* end) { | 1184 const byte* end) { |
1183 ModuleDecoder decoder(zone, start, end, kWasmOrigin); | 1185 ModuleDecoder decoder(zone, start, end, kWasmOrigin); |
1184 return decoder.DecodeFunctionSignature(start); | 1186 return decoder.DecodeFunctionSignature(start); |
1185 } | 1187 } |
1186 | 1188 |
1187 WasmInitExpr DecodeWasmInitExprForTesting(const byte* start, const byte* end) { | 1189 WasmInitExpr DecodeWasmInitExprForTesting(const byte* start, const byte* end) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 result.push_back({section_start, name_offset, name_length, payload_offset, | 1289 result.push_back({section_start, name_offset, name_length, payload_offset, |
1288 payload_length, section_length}); | 1290 payload_length, section_length}); |
1289 } | 1291 } |
1290 | 1292 |
1291 return result; | 1293 return result; |
1292 } | 1294 } |
1293 | 1295 |
1294 } // namespace wasm | 1296 } // namespace wasm |
1295 } // namespace internal | 1297 } // namespace internal |
1296 } // namespace v8 | 1298 } // namespace v8 |
OLD | NEW |