| 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 "test/unittests/test-utils.h" | 5 #include "test/unittests/test-utils.h" |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #include "test/cctest/wasm/test-signatures.h" | 9 #include "test/cctest/wasm/test-signatures.h" |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 void AddLocals(LocalType type, uint32_t count) { | 77 void AddLocals(LocalType type, uint32_t count) { |
| 78 local_decls.AddLocals(count, type); | 78 local_decls.AddLocals(count, type); |
| 79 } | 79 } |
| 80 | 80 |
| 81 // Prepends local variable declarations and renders nice error messages for | 81 // Prepends local variable declarations and renders nice error messages for |
| 82 // verification failures. | 82 // verification failures. |
| 83 void Verify(ErrorCode expected, FunctionSig* sig, const byte* start, | 83 void Verify(ErrorCode expected, FunctionSig* sig, const byte* start, |
| 84 const byte* end) { | 84 const byte* end) { |
| 85 local_decls.Prepend(zone(), &start, &end); | 85 local_decls.Prepend(zone(), &start, &end); |
| 86 // Verify the code. | 86 // Verify the code. |
| 87 TreeResult result = | 87 DecodeResult result = |
| 88 VerifyWasmCode(zone()->allocator(), module, sig, start, end); | 88 VerifyWasmCode(zone()->allocator(), module, sig, start, end); |
| 89 | 89 |
| 90 if (result.error_code != expected) { | 90 if (result.error_code != expected) { |
| 91 ptrdiff_t pc = result.error_pc - result.start; | 91 ptrdiff_t pc = result.error_pc - result.start; |
| 92 ptrdiff_t pt = result.error_pt - result.start; | 92 ptrdiff_t pt = result.error_pt - result.start; |
| 93 std::ostringstream str; | 93 std::ostringstream str; |
| 94 if (expected == kSuccess) { | 94 if (expected == kSuccess) { |
| 95 str << "Verification failed: " << result.error_code << " pc = +" << pc; | 95 str << "Verification failed: " << result.error_code << " pc = +" << pc; |
| 96 if (result.error_pt) str << ", pt = +" << pt; | 96 if (result.error_pt) str << ", pt = +" << pt; |
| 97 str << ", msg = " << result.error_msg.get(); | 97 str << ", msg = " << result.error_msg.get(); |
| (...skipping 2335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2433 LocalTypeMap map = Expand(decls); | 2433 LocalTypeMap map = Expand(decls); |
| 2434 size_t pos = 0; | 2434 size_t pos = 0; |
| 2435 pos = ExpectRun(map, pos, kAstF32, 5); | 2435 pos = ExpectRun(map, pos, kAstF32, 5); |
| 2436 pos = ExpectRun(map, pos, kAstI32, 1337); | 2436 pos = ExpectRun(map, pos, kAstI32, 1337); |
| 2437 pos = ExpectRun(map, pos, kAstI64, 212); | 2437 pos = ExpectRun(map, pos, kAstI64, 212); |
| 2438 } | 2438 } |
| 2439 | 2439 |
| 2440 } // namespace wasm | 2440 } // namespace wasm |
| 2441 } // namespace internal | 2441 } // namespace internal |
| 2442 } // namespace v8 | 2442 } // namespace v8 |
| OLD | NEW |