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/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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 EXPECT_SIZE(5, WASM_IF(WASM_ZERO, WASM_NOP)); | 59 EXPECT_SIZE(5, WASM_IF(WASM_ZERO, WASM_NOP)); |
60 | 60 |
61 EXPECT_SIZE(7, WASM_IF_ELSE(WASM_ZERO, WASM_NOP, WASM_NOP)); | 61 EXPECT_SIZE(7, WASM_IF_ELSE(WASM_ZERO, WASM_NOP, WASM_NOP)); |
62 | 62 |
63 EXPECT_SIZE(5, WASM_SELECT(WASM_ZERO, WASM_NOP, WASM_NOP)); | 63 EXPECT_SIZE(5, WASM_SELECT(WASM_ZERO, WASM_NOP, WASM_NOP)); |
64 | 64 |
65 EXPECT_SIZE(3, WASM_BR(0)); | 65 EXPECT_SIZE(3, WASM_BR(0)); |
66 EXPECT_SIZE(5, WASM_BR_IF(0, WASM_ZERO)); | 66 EXPECT_SIZE(5, WASM_BR_IF(0, WASM_ZERO)); |
67 | 67 |
68 EXPECT_SIZE(3, WASM_BLOCK(1, WASM_NOP)); | 68 EXPECT_SIZE(3, WASM_BLOCK(WASM_NOP)); |
69 EXPECT_SIZE(4, WASM_BLOCK(2, WASM_NOP, WASM_NOP)); | 69 EXPECT_SIZE(4, WASM_BLOCK(WASM_NOP, WASM_NOP)); |
70 EXPECT_SIZE(5, WASM_BLOCK(3, WASM_NOP, WASM_NOP, WASM_NOP)); | 70 EXPECT_SIZE(5, WASM_BLOCK(WASM_NOP, WASM_NOP, WASM_NOP)); |
71 | 71 |
72 EXPECT_SIZE(5, WASM_INFINITE_LOOP); | 72 EXPECT_SIZE(5, WASM_INFINITE_LOOP); |
73 | 73 |
74 EXPECT_SIZE(3, WASM_LOOP(1, WASM_NOP)); | 74 EXPECT_SIZE(3, WASM_LOOP(WASM_NOP)); |
75 EXPECT_SIZE(4, WASM_LOOP(2, WASM_NOP, WASM_NOP)); | 75 EXPECT_SIZE(4, WASM_LOOP(WASM_NOP, WASM_NOP)); |
76 EXPECT_SIZE(5, WASM_LOOP(3, WASM_NOP, WASM_NOP, WASM_NOP)); | 76 EXPECT_SIZE(5, WASM_LOOP(WASM_NOP, WASM_NOP, WASM_NOP)); |
77 EXPECT_SIZE(5, WASM_LOOP(1, WASM_BR(0))); | 77 EXPECT_SIZE(5, WASM_LOOP(WASM_BR(0))); |
78 EXPECT_SIZE(7, WASM_LOOP(1, WASM_BR_IF(0, WASM_ZERO))); | 78 EXPECT_SIZE(7, WASM_LOOP(WASM_BR_IF(0, WASM_ZERO))); |
79 | 79 |
80 EXPECT_SIZE(2, WASM_RETURN0); | 80 EXPECT_SIZE(2, WASM_RETURN0); |
81 EXPECT_SIZE(4, WASM_RETURN1(WASM_ZERO)); | 81 EXPECT_SIZE(4, WASM_RETURN1(WASM_ZERO)); |
82 | 82 |
83 EXPECT_SIZE(1, WASM_UNREACHABLE); | 83 EXPECT_SIZE(1, WASM_UNREACHABLE); |
84 } | 84 } |
85 | 85 |
86 TEST_F(WasmMacroGenTest, MacroStatements) { | 86 TEST_F(WasmMacroGenTest, MacroStatements) { |
87 EXPECT_SIZE(10, WASM_WHILE(WASM_I8(0), WASM_NOP)); | 87 EXPECT_SIZE(10, WASM_WHILE(WASM_I8(0), WASM_NOP)); |
88 EXPECT_SIZE(7, WASM_INC_LOCAL(0)); | 88 EXPECT_SIZE(7, WASM_INC_LOCAL(0)); |
(...skipping 17 matching lines...) Expand all Loading... |
106 EXPECT_SIZE(2, WASM_LOAD_GLOBAL(12)); | 106 EXPECT_SIZE(2, WASM_LOAD_GLOBAL(12)); |
107 EXPECT_SIZE(5, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)); | 107 EXPECT_SIZE(5, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)); |
108 EXPECT_SIZE(5, WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO)); | 108 EXPECT_SIZE(5, WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO)); |
109 EXPECT_SIZE(5, WASM_LOAD_MEM(MachineType::Float32(), WASM_ZERO)); | 109 EXPECT_SIZE(5, WASM_LOAD_MEM(MachineType::Float32(), WASM_ZERO)); |
110 | 110 |
111 EXPECT_SIZE(3, WASM_NOT(WASM_ZERO)); | 111 EXPECT_SIZE(3, WASM_NOT(WASM_ZERO)); |
112 | 112 |
113 EXPECT_SIZE(5, WASM_BRV(1, WASM_ZERO)); | 113 EXPECT_SIZE(5, WASM_BRV(1, WASM_ZERO)); |
114 EXPECT_SIZE(7, WASM_BRV_IF(1, WASM_ZERO, WASM_ZERO)); | 114 EXPECT_SIZE(7, WASM_BRV_IF(1, WASM_ZERO, WASM_ZERO)); |
115 | 115 |
116 EXPECT_SIZE(4, WASM_BLOCK(1, WASM_ZERO)); | 116 EXPECT_SIZE(4, WASM_BLOCK(WASM_ZERO)); |
117 EXPECT_SIZE(5, WASM_BLOCK(2, WASM_NOP, WASM_ZERO)); | 117 EXPECT_SIZE(5, WASM_BLOCK(WASM_NOP, WASM_ZERO)); |
118 EXPECT_SIZE(6, WASM_BLOCK(3, WASM_NOP, WASM_NOP, WASM_ZERO)); | 118 EXPECT_SIZE(6, WASM_BLOCK(WASM_NOP, WASM_NOP, WASM_ZERO)); |
119 | 119 |
120 EXPECT_SIZE(4, WASM_LOOP(1, WASM_ZERO)); | 120 EXPECT_SIZE(4, WASM_LOOP(WASM_ZERO)); |
121 EXPECT_SIZE(5, WASM_LOOP(2, WASM_NOP, WASM_ZERO)); | 121 EXPECT_SIZE(5, WASM_LOOP(WASM_NOP, WASM_ZERO)); |
122 EXPECT_SIZE(6, WASM_LOOP(3, WASM_NOP, WASM_NOP, WASM_ZERO)); | 122 EXPECT_SIZE(6, WASM_LOOP(WASM_NOP, WASM_NOP, WASM_ZERO)); |
123 } | 123 } |
124 | 124 |
125 TEST_F(WasmMacroGenTest, CallFunction) { | 125 TEST_F(WasmMacroGenTest, CallFunction) { |
126 EXPECT_SIZE(3, WASM_CALL_FUNCTION0(0)); | 126 EXPECT_SIZE(3, WASM_CALL_FUNCTION0(0)); |
127 EXPECT_SIZE(3, WASM_CALL_FUNCTION0(1)); | 127 EXPECT_SIZE(3, WASM_CALL_FUNCTION0(1)); |
128 EXPECT_SIZE(3, WASM_CALL_FUNCTION0(11)); | 128 EXPECT_SIZE(3, WASM_CALL_FUNCTION0(11)); |
129 | 129 |
130 EXPECT_SIZE(5, WASM_CALL_FUNCTION1(0, WASM_ZERO)); | 130 EXPECT_SIZE(5, WASM_CALL_FUNCTION1(0, WASM_ZERO)); |
131 EXPECT_SIZE(7, WASM_CALL_FUNCTION2(1, WASM_ZERO, WASM_ZERO)); | 131 EXPECT_SIZE(7, WASM_CALL_FUNCTION2(1, WASM_ZERO, WASM_ZERO)); |
132 } | 132 } |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 EXPECT_SIZE(5, WASM_LOAD_MEM_OFFSET(kMemTypes[i], 11, WASM_ZERO)); | 313 EXPECT_SIZE(5, WASM_LOAD_MEM_OFFSET(kMemTypes[i], 11, WASM_ZERO)); |
314 } | 314 } |
315 for (size_t i = 0; i < arraysize(kMemTypes); i++) { | 315 for (size_t i = 0; i < arraysize(kMemTypes); i++) { |
316 EXPECT_SIZE(7, WASM_STORE_MEM_OFFSET(kMemTypes[i], 13, WASM_ZERO, | 316 EXPECT_SIZE(7, WASM_STORE_MEM_OFFSET(kMemTypes[i], 13, WASM_ZERO, |
317 WASM_GET_LOCAL(0))); | 317 WASM_GET_LOCAL(0))); |
318 } | 318 } |
319 } | 319 } |
320 } // namespace wasm | 320 } // namespace wasm |
321 } // namespace internal | 321 } // namespace internal |
322 } // namespace v8 | 322 } // namespace v8 |
OLD | NEW |