| 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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 void VerifyFunctionBody(uint32_t func_num, ModuleEnv* menv, | 539 void VerifyFunctionBody(uint32_t func_num, ModuleEnv* menv, |
| 540 WasmFunction* function) { | 540 WasmFunction* function) { |
| 541 if (FLAG_trace_wasm_decoder || FLAG_trace_wasm_decode_time) { | 541 if (FLAG_trace_wasm_decoder || FLAG_trace_wasm_decode_time) { |
| 542 OFStream os(stdout); | 542 OFStream os(stdout); |
| 543 os << "Verifying WASM function " << WasmFunctionName(function, menv) | 543 os << "Verifying WASM function " << WasmFunctionName(function, menv) |
| 544 << std::endl; | 544 << std::endl; |
| 545 } | 545 } |
| 546 FunctionBody body = {menv, function->sig, start_, | 546 FunctionBody body = {menv, function->sig, start_, |
| 547 start_ + function->code_start_offset, | 547 start_ + function->code_start_offset, |
| 548 start_ + function->code_end_offset}; | 548 start_ + function->code_end_offset}; |
| 549 TreeResult result = VerifyWasmCode(module_zone->allocator(), body); | 549 DecodeResult result = VerifyWasmCode(module_zone->allocator(), body); |
| 550 if (result.failed()) { | 550 if (result.failed()) { |
| 551 // Wrap the error message from the function decoder. | 551 // Wrap the error message from the function decoder. |
| 552 std::ostringstream str; | 552 std::ostringstream str; |
| 553 str << "in function " << WasmFunctionName(function, menv) << ": "; | 553 str << "in function " << WasmFunctionName(function, menv) << ": "; |
| 554 str << result; | 554 str << result; |
| 555 std::string strval = str.str(); | 555 std::string strval = str.str(); |
| 556 const char* raw = strval.c_str(); | 556 const char* raw = strval.c_str(); |
| 557 size_t len = strlen(raw); | 557 size_t len = strlen(raw); |
| 558 char* buffer = new char[len]; | 558 char* buffer = new char[len]; |
| 559 strncpy(buffer, raw, len); | 559 strncpy(buffer, raw, len); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 decoder.consume_bytes(size); | 839 decoder.consume_bytes(size); |
| 840 } | 840 } |
| 841 if (decoder.more()) decoder.error("unexpected additional bytes"); | 841 if (decoder.more()) decoder.error("unexpected additional bytes"); |
| 842 | 842 |
| 843 return decoder.toResult(std::move(table)); | 843 return decoder.toResult(std::move(table)); |
| 844 } | 844 } |
| 845 | 845 |
| 846 } // namespace wasm | 846 } // namespace wasm |
| 847 } // namespace internal | 847 } // namespace internal |
| 848 } // namespace v8 | 848 } // namespace v8 |
| OLD | NEW |