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

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

Issue 1764723002: [wasm] Remove TableSwitch and replace with br_table. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « test/unittests/wasm/ast-decoder-unittest.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/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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 TEST_F(WasmMacroGenTest, MacroStatements) { 86 TEST_F(WasmMacroGenTest, MacroStatements) {
87 EXPECT_SIZE(8, WASM_WHILE(WASM_I8(0), WASM_NOP)); 87 EXPECT_SIZE(8, WASM_WHILE(WASM_I8(0), WASM_NOP));
88 EXPECT_SIZE(7, WASM_INC_LOCAL(0)); 88 EXPECT_SIZE(7, WASM_INC_LOCAL(0));
89 EXPECT_SIZE(7, WASM_INC_LOCAL_BY(0, 3)); 89 EXPECT_SIZE(7, WASM_INC_LOCAL_BY(0, 3));
90 90
91 EXPECT_SIZE(3, WASM_BREAK(0)); 91 EXPECT_SIZE(3, WASM_BREAK(0));
92 EXPECT_SIZE(3, WASM_CONTINUE(0)); 92 EXPECT_SIZE(3, WASM_CONTINUE(0));
93 } 93 }
94 94
95 95 TEST_F(WasmMacroGenTest, BrTable) {
96 TEST_F(WasmMacroGenTest, TableSwitch) { 96 EXPECT_SIZE(7, WASM_BR_TABLE(WASM_ZERO, 1, BR_TARGET(1)));
97 EXPECT_SIZE(2, WASM_CASE(9));
98 EXPECT_SIZE(2, WASM_CASE_BR(11));
99
100 EXPECT_SIZE(7, WASM_TABLESWITCH_OP(0, 1, WASM_CASE(7)));
101 EXPECT_SIZE(9, WASM_TABLESWITCH_OP(0, 2, WASM_CASE(7), WASM_CASE(8)));
102
103 EXPECT_SIZE(4, WASM_TABLESWITCH_BODY(WASM_I8(88), WASM_I8(77)));
104 EXPECT_SIZE(
105 6, WASM_TABLESWITCH_BODY(WASM_I8(33), WASM_I8(44), WASM_GET_LOCAL(0)));
106 } 97 }
107 98
108 99
109 TEST_F(WasmMacroGenTest, Expressions) { 100 TEST_F(WasmMacroGenTest, Expressions) {
110 EXPECT_SIZE(2, WASM_GET_LOCAL(0)); 101 EXPECT_SIZE(2, WASM_GET_LOCAL(0));
111 EXPECT_SIZE(2, WASM_GET_LOCAL(1)); 102 EXPECT_SIZE(2, WASM_GET_LOCAL(1));
112 EXPECT_SIZE(2, WASM_GET_LOCAL(12)); 103 EXPECT_SIZE(2, WASM_GET_LOCAL(12));
113 EXPECT_SIZE(2, WASM_LOAD_GLOBAL(0)); 104 EXPECT_SIZE(2, WASM_LOAD_GLOBAL(0));
114 EXPECT_SIZE(2, WASM_LOAD_GLOBAL(1)); 105 EXPECT_SIZE(2, WASM_LOAD_GLOBAL(1));
115 EXPECT_SIZE(2, WASM_LOAD_GLOBAL(12)); 106 EXPECT_SIZE(2, WASM_LOAD_GLOBAL(12));
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 EXPECT_SIZE(5, WASM_LOAD_MEM_OFFSET(kMemTypes[i], 11, WASM_ZERO)); 315 EXPECT_SIZE(5, WASM_LOAD_MEM_OFFSET(kMemTypes[i], 11, WASM_ZERO));
325 } 316 }
326 for (size_t i = 0; i < arraysize(kMemTypes); i++) { 317 for (size_t i = 0; i < arraysize(kMemTypes); i++) {
327 EXPECT_SIZE(7, WASM_STORE_MEM_OFFSET(kMemTypes[i], 13, WASM_ZERO, 318 EXPECT_SIZE(7, WASM_STORE_MEM_OFFSET(kMemTypes[i], 13, WASM_ZERO,
328 WASM_GET_LOCAL(0))); 319 WASM_GET_LOCAL(0)));
329 } 320 }
330 } 321 }
331 } // namespace wasm 322 } // namespace wasm
332 } // namespace internal 323 } // namespace internal
333 } // namespace v8 324 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/wasm/ast-decoder-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698