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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 204 } |
205 }; | 205 }; |
206 | 206 |
207 namespace { | 207 namespace { |
208 // A helper for tests that require a module environment for functions, | 208 // A helper for tests that require a module environment for functions, |
209 // globals, or memories. | 209 // globals, or memories. |
210 class TestModuleEnv : public ModuleEnv { | 210 class TestModuleEnv : public ModuleEnv { |
211 public: | 211 public: |
212 explicit TestModuleEnv(ModuleOrigin origin = kWasmOrigin) | 212 explicit TestModuleEnv(ModuleOrigin origin = kWasmOrigin) |
213 : ModuleEnv(&mod, nullptr) { | 213 : ModuleEnv(&mod, nullptr) { |
214 mod.origin = origin; | 214 mod.set_origin(origin); |
215 } | 215 } |
216 byte AddGlobal(ValueType type, bool mutability = true) { | 216 byte AddGlobal(ValueType type, bool mutability = true) { |
217 mod.globals.push_back({type, mutability, WasmInitExpr(), 0, false, false}); | 217 mod.globals.push_back({type, mutability, WasmInitExpr(), 0, false, false}); |
218 CHECK(mod.globals.size() <= 127); | 218 CHECK(mod.globals.size() <= 127); |
219 return static_cast<byte>(mod.globals.size() - 1); | 219 return static_cast<byte>(mod.globals.size() - 1); |
220 } | 220 } |
221 byte AddSignature(FunctionSig* sig) { | 221 byte AddSignature(FunctionSig* sig) { |
222 mod.signatures.push_back(sig); | 222 mod.signatures.push_back(sig); |
223 CHECK(mod.signatures.size() <= 127); | 223 CHECK(mod.signatures.size() <= 127); |
224 return static_cast<byte>(mod.signatures.size() - 1); | 224 return static_cast<byte>(mod.signatures.size() - 1); |
(...skipping 2585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2810 iter.next(); | 2810 iter.next(); |
2811 EXPECT_TRUE(iter.has_next()); | 2811 EXPECT_TRUE(iter.has_next()); |
2812 EXPECT_EQ(kExprI32Const, iter.current()); | 2812 EXPECT_EQ(kExprI32Const, iter.current()); |
2813 iter.next(); | 2813 iter.next(); |
2814 EXPECT_FALSE(iter.has_next()); | 2814 EXPECT_FALSE(iter.has_next()); |
2815 } | 2815 } |
2816 | 2816 |
2817 } // namespace wasm | 2817 } // namespace wasm |
2818 } // namespace internal | 2818 } // namespace internal |
2819 } // namespace v8 | 2819 } // namespace v8 |
OLD | NEW |