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 2482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2493 EXPECT_LENGTH(1, kExprF64SConvertI32); | 2493 EXPECT_LENGTH(1, kExprF64SConvertI32); |
2494 EXPECT_LENGTH(1, kExprF64UConvertI32); | 2494 EXPECT_LENGTH(1, kExprF64UConvertI32); |
2495 EXPECT_LENGTH(1, kExprF64SConvertI64); | 2495 EXPECT_LENGTH(1, kExprF64SConvertI64); |
2496 EXPECT_LENGTH(1, kExprF64UConvertI64); | 2496 EXPECT_LENGTH(1, kExprF64UConvertI64); |
2497 EXPECT_LENGTH(1, kExprF64ConvertF32); | 2497 EXPECT_LENGTH(1, kExprF64ConvertF32); |
2498 EXPECT_LENGTH(1, kExprF64ReinterpretI64); | 2498 EXPECT_LENGTH(1, kExprF64ReinterpretI64); |
2499 EXPECT_LENGTH(1, kExprI32ReinterpretF32); | 2499 EXPECT_LENGTH(1, kExprI32ReinterpretF32); |
2500 EXPECT_LENGTH(1, kExprI64ReinterpretF64); | 2500 EXPECT_LENGTH(1, kExprI64ReinterpretF64); |
2501 } | 2501 } |
2502 | 2502 |
| 2503 TEST_F(WasmOpcodeLengthTest, SimdExpressions) { |
| 2504 #define TEST_SIMD(name, opcode, sig) \ |
| 2505 EXPECT_LENGTH_N(2, kSimdPrefix, static_cast<byte>(kExpr##name & 0xff)); |
| 2506 FOREACH_SIMD_0_OPERAND_OPCODE(TEST_SIMD) |
| 2507 #undef TEST_SIMD |
| 2508 #define TEST_SIMD(name, opcode, sig) \ |
| 2509 EXPECT_LENGTH_N(3, kSimdPrefix, static_cast<byte>(kExpr##name & 0xff)); |
| 2510 FOREACH_SIMD_1_OPERAND_OPCODE(TEST_SIMD) |
| 2511 #undef TEST_SIMD |
| 2512 // test for bad simd opcode |
| 2513 EXPECT_LENGTH_N(2, kSimdPrefix, 0xff); |
| 2514 } |
| 2515 |
2503 typedef ZoneVector<LocalType> LocalTypeMap; | 2516 typedef ZoneVector<LocalType> LocalTypeMap; |
2504 | 2517 |
2505 class LocalDeclDecoderTest : public TestWithZone { | 2518 class LocalDeclDecoderTest : public TestWithZone { |
2506 public: | 2519 public: |
2507 v8::internal::AccountingAllocator allocator; | 2520 v8::internal::AccountingAllocator allocator; |
2508 | 2521 |
2509 size_t ExpectRun(LocalTypeMap map, size_t pos, LocalType expected, | 2522 size_t ExpectRun(LocalTypeMap map, size_t pos, LocalType expected, |
2510 size_t count) { | 2523 size_t count) { |
2511 for (size_t i = 0; i < count; i++) { | 2524 for (size_t i = 0; i < count; i++) { |
2512 EXPECT_EQ(expected, map[pos++]); | 2525 EXPECT_EQ(expected, map[pos++]); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2669 iter.next(); | 2682 iter.next(); |
2670 EXPECT_TRUE(iter.has_next()); | 2683 EXPECT_TRUE(iter.has_next()); |
2671 EXPECT_EQ(kExprI8Const, iter.current()); | 2684 EXPECT_EQ(kExprI8Const, iter.current()); |
2672 iter.next(); | 2685 iter.next(); |
2673 EXPECT_FALSE(iter.has_next()); | 2686 EXPECT_FALSE(iter.has_next()); |
2674 } | 2687 } |
2675 | 2688 |
2676 } // namespace wasm | 2689 } // namespace wasm |
2677 } // namespace internal | 2690 } // namespace internal |
2678 } // namespace v8 | 2691 } // namespace v8 |
OLD | NEW |