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

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

Issue 1960143002: [wasm] Add some tests for control flow corner cases. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 months 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
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/cctest/wasm/test-signatures.h" 9 #include "test/cctest/wasm/test-signatures.h"
10 10
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 507
508 TEST_F(AstDecoderTest, BlockBinop) { 508 TEST_F(AstDecoderTest, BlockBinop) {
509 EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_I32_AND(B1(WASM_I8(1)), WASM_I8(2))); 509 EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_I32_AND(B1(WASM_I8(1)), WASM_I8(2)));
510 } 510 }
511 511
512 TEST_F(AstDecoderTest, BlockBrBinop) { 512 TEST_F(AstDecoderTest, BlockBrBinop) {
513 EXPECT_VERIFIES_INLINE(sigs.i_i(), 513 EXPECT_VERIFIES_INLINE(sigs.i_i(),
514 WASM_I32_AND(B1(WASM_BRV(0, WASM_I8(1))), WASM_I8(2))); 514 WASM_I32_AND(B1(WASM_BRV(0, WASM_I8(1))), WASM_I8(2)));
515 } 515 }
516 516
517 TEST_F(AstDecoderTest, If_empty1) {
518 EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_ZERO, kExprIf, kExprEnd);
519 }
520
521 TEST_F(AstDecoderTest, If_empty2) {
522 EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_ZERO, kExprIf, kExprElse, kExprEnd);
523 }
524
525 TEST_F(AstDecoderTest, If_empty3) {
526 EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_ZERO, kExprIf, WASM_ZERO, kExprElse,
527 kExprEnd);
528 }
529
530 TEST_F(AstDecoderTest, If_empty4) {
531 EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_ZERO, kExprIf, kExprElse, WASM_ZERO,
532 kExprEnd);
533 }
534
517 TEST_F(AstDecoderTest, If_empty_stack) { 535 TEST_F(AstDecoderTest, If_empty_stack) {
518 byte code[] = {kExprIf}; 536 byte code[] = {kExprIf};
519 EXPECT_FAILURE(sigs.v_v(), code); 537 EXPECT_FAILURE(sigs.v_v(), code);
520 EXPECT_FAILURE(sigs.i_i(), code); 538 EXPECT_FAILURE(sigs.i_i(), code);
521 } 539 }
522 540
523 TEST_F(AstDecoderTest, If_incomplete1) { 541 TEST_F(AstDecoderTest, If_incomplete1) {
524 byte code[] = {kExprI8Const, 0, kExprIf}; 542 byte code[] = {kExprI8Const, 0, kExprIf};
525 EXPECT_FAILURE(sigs.v_v(), code); 543 EXPECT_FAILURE(sigs.v_v(), code);
526 EXPECT_FAILURE(sigs.i_i(), code); 544 EXPECT_FAILURE(sigs.i_i(), code);
(...skipping 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after
2436 size_t pos = 0; 2454 size_t pos = 0;
2437 pos = ExpectRun(map, pos, kAstF32, 5); 2455 pos = ExpectRun(map, pos, kAstF32, 5);
2438 pos = ExpectRun(map, pos, kAstI32, 1337); 2456 pos = ExpectRun(map, pos, kAstI32, 1337);
2439 pos = ExpectRun(map, pos, kAstI64, 212); 2457 pos = ExpectRun(map, pos, kAstI64, 212);
2440 delete[] data; 2458 delete[] data;
2441 } 2459 }
2442 2460
2443 } // namespace wasm 2461 } // namespace wasm
2444 } // namespace internal 2462 } // namespace internal
2445 } // namespace v8 2463 } // namespace v8
OLDNEW
« test/cctest/wasm/test-run-wasm.cc ('K') | « test/cctest/wasm/test-run-wasm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698