| 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 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1148 error_msg.reset(result); | 1148 error_msg.reset(result); |
| 1149 } | 1149 } |
| 1150 }; | 1150 }; |
| 1151 | 1151 |
| 1152 } // namespace | 1152 } // namespace |
| 1153 | 1153 |
| 1154 ModuleResult DecodeWasmModule(Isolate* isolate, const byte* module_start, | 1154 ModuleResult DecodeWasmModule(Isolate* isolate, const byte* module_start, |
| 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 isolate->counters()->wasm_decode_module_time()); | 1158 IsWasm(origin) ? isolate->counters()->wasm_decode_wasm_module_time() |
| 1159 : isolate->counters()->wasm_decode_asm_module_time()); |
| 1159 size_t size = module_end - module_start; | 1160 size_t size = module_end - module_start; |
| 1160 if (module_start > module_end) return ModuleError("start > end"); | 1161 if (module_start > module_end) return ModuleError("start > end"); |
| 1161 if (size >= kV8MaxWasmModuleSize) | 1162 if (size >= kV8MaxWasmModuleSize) |
| 1162 return ModuleError("size > maximum module size"); | 1163 return ModuleError("size > maximum module size"); |
| 1163 // TODO(bradnelson): Improve histogram handling of size_t. | 1164 // TODO(bradnelson): Improve histogram handling of size_t. |
| 1164 isolate->counters()->wasm_module_size_bytes()->AddSample( | 1165 isolate->counters()->wasm_module_size_bytes()->AddSample( |
| 1165 static_cast<int>(size)); | 1166 static_cast<int>(size)); |
| 1166 // Signatures are stored in zone memory, which have the same lifetime | 1167 // Signatures are stored in zone memory, which have the same lifetime |
| 1167 // as the {module}. | 1168 // as the {module}. |
| 1168 Zone* zone = new Zone(isolate->allocator(), ZONE_NAME); | 1169 Zone* zone = new Zone(isolate->allocator(), ZONE_NAME); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1283 result.push_back({section_start, name_offset, name_length, payload_offset, | 1284 result.push_back({section_start, name_offset, name_length, payload_offset, |
| 1284 payload_length, section_length}); | 1285 payload_length, section_length}); |
| 1285 } | 1286 } |
| 1286 | 1287 |
| 1287 return result; | 1288 return result; |
| 1288 } | 1289 } |
| 1289 | 1290 |
| 1290 } // namespace wasm | 1291 } // namespace wasm |
| 1291 } // namespace internal | 1292 } // namespace internal |
| 1292 } // namespace v8 | 1293 } // namespace v8 |
| OLD | NEW |