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 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
953 os << "Verifying WASM function " << func_name << std::endl; | 953 os << "Verifying WASM function " << func_name << std::endl; |
954 } | 954 } |
955 FunctionBody body = { | 955 FunctionBody body = { |
956 function->sig, start_, | 956 function->sig, start_, |
957 start_ + GetBufferRelativeOffset(function->code_start_offset), | 957 start_ + GetBufferRelativeOffset(function->code_start_offset), |
958 start_ + GetBufferRelativeOffset(function->code_end_offset)}; | 958 start_ + GetBufferRelativeOffset(function->code_end_offset)}; |
959 DecodeResult result = VerifyWasmCode( | 959 DecodeResult result = VerifyWasmCode( |
960 allocator, menv == nullptr ? nullptr : menv->module_env.module, body); | 960 allocator, menv == nullptr ? nullptr : menv->module_env.module, body); |
961 if (result.failed()) { | 961 if (result.failed()) { |
962 // Wrap the error message from the function decoder. | 962 // Wrap the error message from the function decoder. |
963 std::ostringstream str; | 963 std::ostringstream wrapped; |
964 str << "in function " << func_name << ": " << result.error_msg(); | 964 wrapped << "in function " << func_name << ": " << result.error_msg(); |
965 result.error(result.error_offset(), wrapped.str()); | |
Mircea Trofin
2017/05/31 14:51:42
Does str() flush?
bbudge
2017/06/01 00:53:26
I think flush is a nop on string streams, since da
| |
965 | 966 |
966 // Set error code and location, if this is the first error. | 967 // Set error code and location, if this is the first error. |
967 if (intermediate_result_.ok()) { | 968 if (intermediate_result_.ok()) { |
968 intermediate_result_.MoveErrorFrom(result); | 969 intermediate_result_.MoveErrorFrom(result); |
969 } | 970 } |
970 } | 971 } |
971 } | 972 } |
972 | 973 |
973 uint32_t consume_string(uint32_t* length, bool validate_utf8, | 974 uint32_t consume_string(uint32_t* length, bool validate_utf8, |
974 const char* name) { | 975 const char* name) { |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1411 result.push_back({section_start, name_offset, name_length, payload_offset, | 1412 result.push_back({section_start, name_offset, name_length, payload_offset, |
1412 payload_length, section_length}); | 1413 payload_length, section_length}); |
1413 } | 1414 } |
1414 | 1415 |
1415 return result; | 1416 return result; |
1416 } | 1417 } |
1417 | 1418 |
1418 } // namespace wasm | 1419 } // namespace wasm |
1419 } // namespace internal | 1420 } // namespace internal |
1420 } // namespace v8 | 1421 } // namespace v8 |
OLD | NEW |