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

Side by Side Diff: test/unittests/wasm/wasm-macro-gen-unittest.cc

Issue 1830663002: [wasm] Binary 11: AST changes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Renumber opcodes and remove tests added elsewhere Created 4 years, 8 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/wasm/wasm-macro-gen.h" 7 #include "src/wasm/wasm-macro-gen.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 TEST_F(WasmMacroGenTest, Statements) { 52 TEST_F(WasmMacroGenTest, Statements) {
53 EXPECT_SIZE(1, WASM_NOP); 53 EXPECT_SIZE(1, WASM_NOP);
54 54
55 EXPECT_SIZE(4, WASM_SET_LOCAL(0, WASM_ZERO)); 55 EXPECT_SIZE(4, WASM_SET_LOCAL(0, WASM_ZERO));
56 56
57 EXPECT_SIZE(4, WASM_STORE_GLOBAL(0, WASM_ZERO)); 57 EXPECT_SIZE(4, WASM_STORE_GLOBAL(0, WASM_ZERO));
58 58
59 EXPECT_SIZE(7, WASM_STORE_MEM(MachineType::Int32(), WASM_ZERO, WASM_ZERO)); 59 EXPECT_SIZE(7, WASM_STORE_MEM(MachineType::Int32(), WASM_ZERO, WASM_ZERO));
60 60
61 EXPECT_SIZE(4, WASM_IF(WASM_ZERO, WASM_NOP)); 61 EXPECT_SIZE(5, WASM_IF(WASM_ZERO, WASM_NOP));
62 62
63 EXPECT_SIZE(5, WASM_IF_ELSE(WASM_ZERO, WASM_NOP, WASM_NOP)); 63 EXPECT_SIZE(7, WASM_IF_ELSE(WASM_ZERO, WASM_NOP, WASM_NOP));
64 64
65 EXPECT_SIZE(5, WASM_SELECT(WASM_ZERO, WASM_NOP, WASM_NOP)); 65 EXPECT_SIZE(5, WASM_SELECT(WASM_ZERO, WASM_NOP, WASM_NOP));
66 66
67 EXPECT_SIZE(3, WASM_BR(0)); 67 EXPECT_SIZE(3, WASM_BR(0));
68 EXPECT_SIZE(5, WASM_BR_IF(0, WASM_ZERO)); 68 EXPECT_SIZE(5, WASM_BR_IF(0, WASM_ZERO));
69 69
70 EXPECT_SIZE(3, WASM_BLOCK(1, WASM_NOP)); 70 EXPECT_SIZE(3, WASM_BLOCK(1, WASM_NOP));
71 EXPECT_SIZE(4, WASM_BLOCK(2, WASM_NOP, WASM_NOP)); 71 EXPECT_SIZE(4, WASM_BLOCK(2, WASM_NOP, WASM_NOP));
72 EXPECT_SIZE(5, WASM_BLOCK(3, WASM_NOP, WASM_NOP, WASM_NOP)); 72 EXPECT_SIZE(5, WASM_BLOCK(3, WASM_NOP, WASM_NOP, WASM_NOP));
73 73
74 EXPECT_SIZE(5, WASM_INFINITE_LOOP); 74 EXPECT_SIZE(5, WASM_INFINITE_LOOP);
75 75
76 EXPECT_SIZE(3, WASM_LOOP(1, WASM_NOP)); 76 EXPECT_SIZE(3, WASM_LOOP(1, WASM_NOP));
77 EXPECT_SIZE(4, WASM_LOOP(2, WASM_NOP, WASM_NOP)); 77 EXPECT_SIZE(4, WASM_LOOP(2, WASM_NOP, WASM_NOP));
78 EXPECT_SIZE(5, WASM_LOOP(3, WASM_NOP, WASM_NOP, WASM_NOP)); 78 EXPECT_SIZE(5, WASM_LOOP(3, WASM_NOP, WASM_NOP, WASM_NOP));
79 EXPECT_SIZE(5, WASM_LOOP(1, WASM_BR(0))); 79 EXPECT_SIZE(5, WASM_LOOP(1, WASM_BR(0)));
80 EXPECT_SIZE(7, WASM_LOOP(1, WASM_BR_IF(0, WASM_ZERO))); 80 EXPECT_SIZE(7, WASM_LOOP(1, WASM_BR_IF(0, WASM_ZERO)));
81 81
82 EXPECT_SIZE(1, WASM_RETURN0); 82 EXPECT_SIZE(1, WASM_RETURN0);
83 EXPECT_SIZE(3, WASM_RETURN(WASM_ZERO)); 83 EXPECT_SIZE(3, WASM_RETURN(WASM_ZERO));
84 EXPECT_SIZE(5, WASM_RETURN(WASM_ZERO, WASM_ZERO)); 84 EXPECT_SIZE(5, WASM_RETURN(WASM_ZERO, WASM_ZERO));
85 85
86 EXPECT_SIZE(1, WASM_UNREACHABLE); 86 EXPECT_SIZE(1, WASM_UNREACHABLE);
87 } 87 }
88 88
89 89
90 TEST_F(WasmMacroGenTest, MacroStatements) { 90 TEST_F(WasmMacroGenTest, MacroStatements) {
91 EXPECT_SIZE(8, WASM_WHILE(WASM_I8(0), WASM_NOP)); 91 EXPECT_SIZE(9, WASM_WHILE(WASM_I8(0), WASM_NOP));
92 EXPECT_SIZE(7, WASM_INC_LOCAL(0)); 92 EXPECT_SIZE(7, WASM_INC_LOCAL(0));
93 EXPECT_SIZE(7, WASM_INC_LOCAL_BY(0, 3)); 93 EXPECT_SIZE(7, WASM_INC_LOCAL_BY(0, 3));
94 94
95 EXPECT_SIZE(3, WASM_BREAK(0)); 95 EXPECT_SIZE(3, WASM_BREAK(0));
96 EXPECT_SIZE(3, WASM_CONTINUE(0)); 96 EXPECT_SIZE(3, WASM_CONTINUE(0));
97 } 97 }
98 98
99 TEST_F(WasmMacroGenTest, BrTable) { 99 TEST_F(WasmMacroGenTest, BrTable) {
100 EXPECT_SIZE(8, WASM_BR_TABLE(WASM_ZERO, 1, BR_TARGET(1))); 100 EXPECT_SIZE(8, WASM_BR_TABLE(WASM_ZERO, 1, BR_TARGET(1)));
101 } 101 }
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 EXPECT_SIZE(5, WASM_LOAD_MEM_OFFSET(kMemTypes[i], 11, WASM_ZERO)); 323 EXPECT_SIZE(5, WASM_LOAD_MEM_OFFSET(kMemTypes[i], 11, WASM_ZERO));
324 } 324 }
325 for (size_t i = 0; i < arraysize(kMemTypes); i++) { 325 for (size_t i = 0; i < arraysize(kMemTypes); i++) {
326 EXPECT_SIZE(7, WASM_STORE_MEM_OFFSET(kMemTypes[i], 13, WASM_ZERO, 326 EXPECT_SIZE(7, WASM_STORE_MEM_OFFSET(kMemTypes[i], 13, WASM_ZERO,
327 WASM_GET_LOCAL(0))); 327 WASM_GET_LOCAL(0)));
328 } 328 }
329 } 329 }
330 } // namespace wasm 330 } // namespace wasm
331 } // namespace internal 331 } // namespace internal
332 } // namespace v8 332 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698