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 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 Zone zone(&allocator, ZONE_NAME); | 1189 Zone zone(&allocator, ZONE_NAME); |
1190 ModuleDecoder decoder(&zone, start, end, kWasmOrigin); | 1190 ModuleDecoder decoder(&zone, start, end, kWasmOrigin); |
1191 return decoder.DecodeInitExpr(start); | 1191 return decoder.DecodeInitExpr(start); |
1192 } | 1192 } |
1193 | 1193 |
1194 FunctionResult DecodeWasmFunction(Isolate* isolate, Zone* zone, | 1194 FunctionResult DecodeWasmFunction(Isolate* isolate, Zone* zone, |
1195 ModuleBytesEnv* module_env, | 1195 ModuleBytesEnv* module_env, |
1196 const byte* function_start, | 1196 const byte* function_start, |
1197 const byte* function_end) { | 1197 const byte* function_end) { |
1198 HistogramTimerScope wasm_decode_function_time_scope( | 1198 HistogramTimerScope wasm_decode_function_time_scope( |
1199 isolate->counters()->wasm_decode_function_time()); | 1199 module_env->module_env.is_wasm() |
| 1200 ? isolate->counters()->wasm_decode_wasm_function_time() |
| 1201 : isolate->counters()->wasm_decode_asm_function_time()); |
1200 size_t size = function_end - function_start; | 1202 size_t size = function_end - function_start; |
1201 if (function_start > function_end) return FunctionError("start > end"); | 1203 if (function_start > function_end) return FunctionError("start > end"); |
1202 if (size > kV8MaxWasmFunctionSize) | 1204 if (size > kV8MaxWasmFunctionSize) |
1203 return FunctionError("size > maximum function size"); | 1205 return FunctionError("size > maximum function size"); |
1204 isolate->counters()->wasm_function_size_bytes()->AddSample( | 1206 isolate->counters()->wasm_function_size_bytes()->AddSample( |
1205 static_cast<int>(size)); | 1207 static_cast<int>(size)); |
1206 WasmFunction* function = new WasmFunction(); | 1208 WasmFunction* function = new WasmFunction(); |
1207 ModuleDecoder decoder(zone, function_start, function_end, kWasmOrigin); | 1209 ModuleDecoder decoder(zone, function_start, function_end, kWasmOrigin); |
1208 return decoder.DecodeSingleFunction(module_env, function); | 1210 return decoder.DecodeSingleFunction(module_env, function); |
1209 } | 1211 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 result.push_back({section_start, name_offset, name_length, payload_offset, | 1286 result.push_back({section_start, name_offset, name_length, payload_offset, |
1285 payload_length, section_length}); | 1287 payload_length, section_length}); |
1286 } | 1288 } |
1287 | 1289 |
1288 return result; | 1290 return result; |
1289 } | 1291 } |
1290 | 1292 |
1291 } // namespace wasm | 1293 } // namespace wasm |
1292 } // namespace internal | 1294 } // namespace internal |
1293 } // namespace v8 | 1295 } // namespace v8 |
OLD | NEW |