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 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 namespace { | 1276 namespace { |
1277 // A helper for tests that require a module environment for functions and | 1277 // A helper for tests that require a module environment for functions and |
1278 // globals. | 1278 // globals. |
1279 class TestModuleEnv : public ModuleEnv { | 1279 class TestModuleEnv : public ModuleEnv { |
1280 public: | 1280 public: |
1281 TestModuleEnv() { | 1281 TestModuleEnv() { |
1282 instance = nullptr; | 1282 instance = nullptr; |
1283 module = &mod; | 1283 module = &mod; |
1284 } | 1284 } |
1285 byte AddGlobal(LocalType type, bool mutability = true) { | 1285 byte AddGlobal(LocalType type, bool mutability = true) { |
1286 mod.globals.push_back({type, mutability, NO_INIT, 0, false, false}); | 1286 mod.globals.push_back({type, mutability, WasmInitExpr(), 0, false, false}); |
1287 CHECK(mod.globals.size() <= 127); | 1287 CHECK(mod.globals.size() <= 127); |
1288 return static_cast<byte>(mod.globals.size() - 1); | 1288 return static_cast<byte>(mod.globals.size() - 1); |
1289 } | 1289 } |
1290 byte AddSignature(FunctionSig* sig) { | 1290 byte AddSignature(FunctionSig* sig) { |
1291 mod.signatures.push_back(sig); | 1291 mod.signatures.push_back(sig); |
1292 CHECK(mod.signatures.size() <= 127); | 1292 CHECK(mod.signatures.size() <= 127); |
1293 return static_cast<byte>(mod.signatures.size() - 1); | 1293 return static_cast<byte>(mod.signatures.size() - 1); |
1294 } | 1294 } |
1295 byte AddFunction(FunctionSig* sig) { | 1295 byte AddFunction(FunctionSig* sig) { |
1296 mod.functions.push_back({sig, // sig | 1296 mod.functions.push_back({sig, // sig |
(...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2669 iter.next(); | 2669 iter.next(); |
2670 EXPECT_TRUE(iter.has_next()); | 2670 EXPECT_TRUE(iter.has_next()); |
2671 EXPECT_EQ(kExprI8Const, iter.current()); | 2671 EXPECT_EQ(kExprI8Const, iter.current()); |
2672 iter.next(); | 2672 iter.next(); |
2673 EXPECT_FALSE(iter.has_next()); | 2673 EXPECT_FALSE(iter.has_next()); |
2674 } | 2674 } |
2675 | 2675 |
2676 } // namespace wasm | 2676 } // namespace wasm |
2677 } // namespace internal | 2677 } // namespace internal |
2678 } // namespace v8 | 2678 } // namespace v8 |
OLD | NEW |