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 | 6 |
7 #include "src/base/functional.h" | 7 #include "src/base/functional.h" |
8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/macro-assembler.h" | 9 #include "src/macro-assembler.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 size_t size = module_end - module_start; | 773 size_t size = module_end - module_start; |
774 if (module_start > module_end) return ModuleError("start > end"); | 774 if (module_start > module_end) return ModuleError("start > end"); |
775 if (size >= kMaxModuleSize) return ModuleError("size > maximum module size"); | 775 if (size >= kMaxModuleSize) return ModuleError("size > maximum module size"); |
776 // TODO(bradnelson): Improve histogram handling of size_t. | 776 // TODO(bradnelson): Improve histogram handling of size_t. |
777 isolate->counters()->wasm_module_size_bytes()->AddSample( | 777 isolate->counters()->wasm_module_size_bytes()->AddSample( |
778 static_cast<int>(size)); | 778 static_cast<int>(size)); |
779 WasmModule* module = new WasmModule(); | 779 WasmModule* module = new WasmModule(); |
780 ModuleDecoder decoder(zone, module_start, module_end, origin); | 780 ModuleDecoder decoder(zone, module_start, module_end, origin); |
781 ModuleResult result = decoder.DecodeModule(module, verify_functions); | 781 ModuleResult result = decoder.DecodeModule(module, verify_functions); |
782 // TODO(bradnelson): Improve histogram handling of size_t. | 782 // TODO(bradnelson): Improve histogram handling of size_t. |
783 isolate->counters()->wasm_decode_peak_memory_bytes()->AddSample( | 783 isolate->counters()->wasm_decode_module_peak_memory_bytes()->AddSample( |
784 static_cast<int>(zone->allocation_size() - decode_memory_start)); | 784 static_cast<int>(zone->allocation_size() - decode_memory_start)); |
785 return result; | 785 return result; |
786 } | 786 } |
787 | 787 |
788 FunctionSig* DecodeWasmSignatureForTesting(Zone* zone, const byte* start, | 788 FunctionSig* DecodeWasmSignatureForTesting(Zone* zone, const byte* start, |
789 const byte* end) { | 789 const byte* end) { |
790 ModuleDecoder decoder(zone, start, end, kWasmOrigin); | 790 ModuleDecoder decoder(zone, start, end, kWasmOrigin); |
791 return decoder.DecodeFunctionSignature(start); | 791 return decoder.DecodeFunctionSignature(start); |
792 } | 792 } |
793 | 793 |
(...skipping 10 matching lines...) Expand all Loading... |
804 return FunctionError("size > maximum function size"); | 804 return FunctionError("size > maximum function size"); |
805 isolate->counters()->wasm_function_size_bytes()->AddSample( | 805 isolate->counters()->wasm_function_size_bytes()->AddSample( |
806 static_cast<int>(size)); | 806 static_cast<int>(size)); |
807 WasmFunction* function = new WasmFunction(); | 807 WasmFunction* function = new WasmFunction(); |
808 ModuleDecoder decoder(zone, function_start, function_end, kWasmOrigin); | 808 ModuleDecoder decoder(zone, function_start, function_end, kWasmOrigin); |
809 return decoder.DecodeSingleFunction(module_env, function); | 809 return decoder.DecodeSingleFunction(module_env, function); |
810 } | 810 } |
811 } // namespace wasm | 811 } // namespace wasm |
812 } // namespace internal | 812 } // namespace internal |
813 } // namespace v8 | 813 } // namespace v8 |
OLD | NEW |