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/wasm/module-decoder.h" | 7 #include "src/wasm/module-decoder.h" |
8 #include "src/wasm/wasm-opcodes.h" | 8 #include "src/wasm/wasm-opcodes.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 12 matching lines...) Expand all Loading... |
23 #define SIG_INDEX(v) U16(v) | 23 #define SIG_INDEX(v) U16(v) |
24 #define FUNC_INDEX(v) U16(v) | 24 #define FUNC_INDEX(v) U16(v) |
25 #define NAME_OFFSET(v) U32(v) | 25 #define NAME_OFFSET(v) U32(v) |
26 | 26 |
27 #define EMPTY_FUNCTION(sig_index) 0, SIG_INDEX(sig_index), U16(0) | 27 #define EMPTY_FUNCTION(sig_index) 0, SIG_INDEX(sig_index), U16(0) |
28 | 28 |
29 class WasmModuleVerifyTest : public TestWithZone { | 29 class WasmModuleVerifyTest : public TestWithZone { |
30 public: | 30 public: |
31 ModuleResult DecodeModule(const byte* module_start, const byte* module_end) { | 31 ModuleResult DecodeModule(const byte* module_start, const byte* module_end) { |
32 return DecodeWasmModule(nullptr, zone(), module_start, module_end, false, | 32 return DecodeWasmModule(nullptr, zone(), module_start, module_end, false, |
33 false); | 33 kWasmOrigin); |
34 } | 34 } |
35 }; | 35 }; |
36 | 36 |
37 | 37 |
38 #define EXPECT_VERIFIES(data) \ | 38 #define EXPECT_VERIFIES(data) \ |
39 do { \ | 39 do { \ |
40 ModuleResult result = DecodeModule(data, data + arraysize(data)); \ | 40 ModuleResult result = DecodeModule(data, data + arraysize(data)); \ |
41 EXPECT_TRUE(result.ok()); \ | 41 EXPECT_TRUE(result.ok()); \ |
42 if (result.val) delete result.val; \ | 42 if (result.val) delete result.val; \ |
43 } while (false) | 43 } while (false) |
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 for (int length = 13; length < sizeof(data); length++) { | 1149 for (int length = 13; length < sizeof(data); length++) { |
1150 ModuleResult result = DecodeModule(data, data + length); | 1150 ModuleResult result = DecodeModule(data, data + length); |
1151 EXPECT_FALSE(result.ok()); | 1151 EXPECT_FALSE(result.ok()); |
1152 if (result.val) delete result.val; | 1152 if (result.val) delete result.val; |
1153 } | 1153 } |
1154 } | 1154 } |
1155 | 1155 |
1156 } // namespace wasm | 1156 } // namespace wasm |
1157 } // namespace internal | 1157 } // namespace internal |
1158 } // namespace v8 | 1158 } // namespace v8 |
OLD | NEW |