| 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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 segment->source_size)) { | 565 segment->source_size)) { |
| 566 error(start, "segment out of bounds of memory"); | 566 error(start, "segment out of bounds of memory"); |
| 567 } | 567 } |
| 568 | 568 |
| 569 consume_bytes(segment->source_size); | 569 consume_bytes(segment->source_size); |
| 570 } | 570 } |
| 571 | 571 |
| 572 // Verifies the body (code) of a given function. | 572 // Verifies the body (code) of a given function. |
| 573 void VerifyFunctionBody(uint32_t func_num, ModuleEnv* menv, | 573 void VerifyFunctionBody(uint32_t func_num, ModuleEnv* menv, |
| 574 WasmFunction* function) { | 574 WasmFunction* function) { |
| 575 if (FLAG_trace_wasm_decode_time) { | 575 if (FLAG_trace_wasm_decoder || FLAG_trace_wasm_decode_time) { |
| 576 OFStream os(stdout); | 576 OFStream os(stdout); |
| 577 os << "Verifying WASM function " << WasmFunctionName(function, menv) | 577 os << "Verifying WASM function " << WasmFunctionName(function, menv) |
| 578 << std::endl; | 578 << std::endl; |
| 579 os << std::endl; | |
| 580 } | 579 } |
| 581 FunctionBody body = {menv, function->sig, start_, | 580 FunctionBody body = {menv, function->sig, start_, |
| 582 start_ + function->code_start_offset, | 581 start_ + function->code_start_offset, |
| 583 start_ + function->code_end_offset}; | 582 start_ + function->code_end_offset}; |
| 584 TreeResult result = VerifyWasmCode(module_zone->allocator(), body); | 583 TreeResult result = VerifyWasmCode(module_zone->allocator(), body); |
| 585 if (result.failed()) { | 584 if (result.failed()) { |
| 586 // Wrap the error message from the function decoder. | 585 // Wrap the error message from the function decoder. |
| 587 std::ostringstream str; | 586 std::ostringstream str; |
| 588 str << "in function " << WasmFunctionName(function, menv) << ": "; | 587 str << "in function " << WasmFunctionName(function, menv) << ": "; |
| 589 str << result; | 588 str << result; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 return FunctionError("size > maximum function size"); | 785 return FunctionError("size > maximum function size"); |
| 787 isolate->counters()->wasm_function_size_bytes()->AddSample( | 786 isolate->counters()->wasm_function_size_bytes()->AddSample( |
| 788 static_cast<int>(size)); | 787 static_cast<int>(size)); |
| 789 WasmFunction* function = new WasmFunction(); | 788 WasmFunction* function = new WasmFunction(); |
| 790 ModuleDecoder decoder(zone, function_start, function_end, kWasmOrigin); | 789 ModuleDecoder decoder(zone, function_start, function_end, kWasmOrigin); |
| 791 return decoder.DecodeSingleFunction(module_env, function); | 790 return decoder.DecodeSingleFunction(module_env, function); |
| 792 } | 791 } |
| 793 } // namespace wasm | 792 } // namespace wasm |
| 794 } // namespace internal | 793 } // namespace internal |
| 795 } // namespace v8 | 794 } // namespace v8 |
| OLD | NEW |