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/common/wasm/test-signatures.h" | 9 #include "test/common/wasm/test-signatures.h" |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 void AddLocals(ValueType type, uint32_t count) { | 103 void AddLocals(ValueType type, uint32_t count) { |
104 local_decls.AddLocals(count, type); | 104 local_decls.AddLocals(count, type); |
105 } | 105 } |
106 | 106 |
107 // Prepends local variable declarations and renders nice error messages for | 107 // Prepends local variable declarations and renders nice error messages for |
108 // verification failures. | 108 // verification failures. |
109 void Verify(ErrorCode expected, FunctionSig* sig, const byte* start, | 109 void Verify(ErrorCode expected, FunctionSig* sig, const byte* start, |
110 const byte* end) { | 110 const byte* end) { |
111 local_decls.Prepend(zone(), &start, &end); | 111 local_decls.Prepend(zone(), &start, &end); |
112 // Verify the code. | 112 // Verify the code. |
113 DecodeResult result = | 113 DecodeResult result = VerifyWasmCode( |
114 VerifyWasmCode(zone()->allocator(), module, sig, start, end); | 114 zone()->allocator(), module == nullptr ? nullptr : module->module, sig, |
| 115 start, end); |
115 | 116 |
116 if (result.error_code != expected) { | 117 if (result.error_code != expected) { |
117 ptrdiff_t pc = result.error_pc - result.start; | 118 ptrdiff_t pc = result.error_pc - result.start; |
118 ptrdiff_t pt = result.error_pt - result.start; | 119 ptrdiff_t pt = result.error_pt - result.start; |
119 std::ostringstream str; | 120 std::ostringstream str; |
120 if (expected == kSuccess) { | 121 if (expected == kSuccess) { |
121 str << "Verification failed: " << result.error_code << " pc = +" << pc; | 122 str << "Verification failed: " << result.error_code << " pc = +" << pc; |
122 if (result.error_pt) str << ", pt = +" << pt; | 123 if (result.error_pt) str << ", pt = +" << pt; |
123 str << ", msg = " << result.error_msg.get(); | 124 str << ", msg = " << result.error_msg.get(); |
124 } else { | 125 } else { |
(...skipping 2610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2735 iter.next(); | 2736 iter.next(); |
2736 EXPECT_TRUE(iter.has_next()); | 2737 EXPECT_TRUE(iter.has_next()); |
2737 EXPECT_EQ(kExprI8Const, iter.current()); | 2738 EXPECT_EQ(kExprI8Const, iter.current()); |
2738 iter.next(); | 2739 iter.next(); |
2739 EXPECT_FALSE(iter.has_next()); | 2740 EXPECT_FALSE(iter.has_next()); |
2740 } | 2741 } |
2741 | 2742 |
2742 } // namespace wasm | 2743 } // namespace wasm |
2743 } // namespace internal | 2744 } // namespace internal |
2744 } // namespace v8 | 2745 } // namespace v8 |
OLD | NEW |