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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 segment->source_size)) { | 559 segment->source_size)) { |
560 error(start, "segment out of bounds of memory"); | 560 error(start, "segment out of bounds of memory"); |
561 } | 561 } |
562 | 562 |
563 consume_bytes(segment->source_size); | 563 consume_bytes(segment->source_size); |
564 } | 564 } |
565 | 565 |
566 // Verifies the body (code) of a given function. | 566 // Verifies the body (code) of a given function. |
567 void VerifyFunctionBody(uint32_t func_num, ModuleEnv* menv, | 567 void VerifyFunctionBody(uint32_t func_num, ModuleEnv* menv, |
568 WasmFunction* function) { | 568 WasmFunction* function) { |
569 if (FLAG_trace_wasm_decode_time) { | 569 if (FLAG_trace_wasm_decoder || FLAG_trace_wasm_decode_time) { |
570 OFStream os(stdout); | 570 OFStream os(stdout); |
571 os << "Verifying WASM function " << WasmFunctionName(function, menv) | 571 os << "Verifying WASM function " << WasmFunctionName(function, menv) |
572 << std::endl; | 572 << std::endl; |
573 os << std::endl; | |
574 } | 573 } |
575 FunctionBody body = {menv, function->sig, start_, | 574 FunctionBody body = {menv, function->sig, start_, |
576 start_ + function->code_start_offset, | 575 start_ + function->code_start_offset, |
577 start_ + function->code_end_offset}; | 576 start_ + function->code_end_offset}; |
578 TreeResult result = VerifyWasmCode(body); | 577 TreeResult result = VerifyWasmCode(body); |
579 if (result.failed()) { | 578 if (result.failed()) { |
580 // Wrap the error message from the function decoder. | 579 // Wrap the error message from the function decoder. |
581 std::ostringstream str; | 580 std::ostringstream str; |
582 str << "in function " << WasmFunctionName(function, menv) << ": "; | 581 str << "in function " << WasmFunctionName(function, menv) << ": "; |
583 str << result; | 582 str << result; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 if (function_start > function_end) return FunctionError("start > end"); | 790 if (function_start > function_end) return FunctionError("start > end"); |
792 if (size > kMaxFunctionSize) | 791 if (size > kMaxFunctionSize) |
793 return FunctionError("size > maximum function size"); | 792 return FunctionError("size > maximum function size"); |
794 WasmFunction* function = new WasmFunction(); | 793 WasmFunction* function = new WasmFunction(); |
795 ModuleDecoder decoder(zone, function_start, function_end, kWasmOrigin); | 794 ModuleDecoder decoder(zone, function_start, function_end, kWasmOrigin); |
796 return decoder.DecodeSingleFunction(module_env, function); | 795 return decoder.DecodeSingleFunction(module_env, function); |
797 } | 796 } |
798 } // namespace wasm | 797 } // namespace wasm |
799 } // namespace internal | 798 } // namespace internal |
800 } // namespace v8 | 799 } // namespace v8 |
OLD | NEW |