Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: test/unittests/wasm/ast-decoder-unittest.cc

Issue 2447683004: [wasm] fix simd opcode read and error case for bad simd opcodes (Closed)
Patch Set: [wasm] fix simd opcode read and error case for bad simd opcodes Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/wasm/ast-decoder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/wasm/ast-decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698