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 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 const byte* module_end, bool verify_functions, | 1155 const byte* module_end, bool verify_functions, |
1156 ModuleOrigin origin) { | 1156 ModuleOrigin origin) { |
1157 HistogramTimerScope wasm_decode_module_time_scope( | 1157 HistogramTimerScope wasm_decode_module_time_scope( |
1158 IsWasm(origin) ? isolate->counters()->wasm_decode_wasm_module_time() | 1158 IsWasm(origin) ? isolate->counters()->wasm_decode_wasm_module_time() |
1159 : isolate->counters()->wasm_decode_asm_module_time()); | 1159 : isolate->counters()->wasm_decode_asm_module_time()); |
1160 size_t size = module_end - module_start; | 1160 size_t size = module_end - module_start; |
1161 if (module_start > module_end) return ModuleError("start > end"); | 1161 if (module_start > module_end) return ModuleError("start > end"); |
1162 if (size >= kV8MaxWasmModuleSize) | 1162 if (size >= kV8MaxWasmModuleSize) |
1163 return ModuleError("size > maximum module size"); | 1163 return ModuleError("size > maximum module size"); |
1164 // TODO(bradnelson): Improve histogram handling of size_t. | 1164 // TODO(bradnelson): Improve histogram handling of size_t. |
1165 isolate->counters()->wasm_module_size_bytes()->AddSample( | 1165 (IsWasm(origin) ? isolate->counters()->wasm_wasm_module_size_bytes() |
1166 static_cast<int>(size)); | 1166 : isolate->counters()->wasm_asm_module_size_bytes()) |
| 1167 ->AddSample(static_cast<int>(size)); |
1167 // Signatures are stored in zone memory, which have the same lifetime | 1168 // Signatures are stored in zone memory, which have the same lifetime |
1168 // as the {module}. | 1169 // as the {module}. |
1169 Zone* zone = new Zone(isolate->allocator(), ZONE_NAME); | 1170 Zone* zone = new Zone(isolate->allocator(), ZONE_NAME); |
1170 ModuleDecoder decoder(zone, module_start, module_end, origin); | 1171 ModuleDecoder decoder(zone, module_start, module_end, origin); |
1171 ModuleResult result = decoder.DecodeModule(verify_functions); | 1172 ModuleResult result = decoder.DecodeModule(verify_functions); |
1172 // TODO(bradnelson): Improve histogram handling of size_t. | 1173 // TODO(bradnelson): Improve histogram handling of size_t. |
1173 // TODO(titzer): this isn't accurate, since it doesn't count the data | 1174 // TODO(titzer): this isn't accurate, since it doesn't count the data |
1174 // allocated on the C++ heap. | 1175 // allocated on the C++ heap. |
1175 // https://bugs.chromium.org/p/chromium/issues/detail?id=657320 | 1176 // https://bugs.chromium.org/p/chromium/issues/detail?id=657320 |
1176 (IsWasm(origin) | 1177 (IsWasm(origin) |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 result.push_back({section_start, name_offset, name_length, payload_offset, | 1290 result.push_back({section_start, name_offset, name_length, payload_offset, |
1290 payload_length, section_length}); | 1291 payload_length, section_length}); |
1291 } | 1292 } |
1292 | 1293 |
1293 return result; | 1294 return result; |
1294 } | 1295 } |
1295 | 1296 |
1296 } // namespace wasm | 1297 } // namespace wasm |
1297 } // namespace internal | 1298 } // namespace internal |
1298 } // namespace v8 | 1299 } // namespace v8 |
OLD | NEW |