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

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

Issue 1760363003: Revert of [wasm] Update {i32,i64}.const to use signed leb128 (Closed) Base URL: http://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/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 {
11 namespace wasm { 11 namespace wasm {
12 12
13 class WasmMacroGenTest : public TestWithZone {}; 13 class WasmMacroGenTest : public TestWithZone {};
14 14
15 #define EXPECT_SIZE(size, ...) \ 15 #define EXPECT_SIZE(size, ...) \
16 do { \ 16 do { \
17 byte code[] = {__VA_ARGS__}; \ 17 byte code[] = {__VA_ARGS__}; \
18 EXPECT_EQ(size, sizeof(code)); \ 18 EXPECT_EQ(size, sizeof(code)); \
19 } while (false) 19 } while (false)
20 20
21 21
22 TEST_F(WasmMacroGenTest, Constants) { 22 TEST_F(WasmMacroGenTest, Constants) {
23 EXPECT_SIZE(2, WASM_ONE); 23 EXPECT_SIZE(2, WASM_ONE);
24 EXPECT_SIZE(2, WASM_ZERO); 24 EXPECT_SIZE(2, WASM_ZERO);
25 25
26 EXPECT_SIZE(2, WASM_I8(122)); 26 EXPECT_SIZE(2, WASM_I8(122));
27 EXPECT_SIZE(2, WASM_I8(254)); 27 EXPECT_SIZE(2, WASM_I8(254));
28 28
29 EXPECT_SIZE(2, WASM_I32V_1(1)); 29 EXPECT_SIZE(5, WASM_I32(1));
30 EXPECT_SIZE(4, WASM_I32V_3(10000)); 30 EXPECT_SIZE(5, WASM_I32(10000));
31 EXPECT_SIZE(5, WASM_I32V_4(-9828934)); 31 EXPECT_SIZE(5, WASM_I32(-9828934));
32 32
33 EXPECT_SIZE(2, WASM_I64V_1(1)); 33 EXPECT_SIZE(9, WASM_I64(1));
34 EXPECT_SIZE(4, WASM_I64V_3(10000)); 34 EXPECT_SIZE(9, WASM_I64(10000));
35 EXPECT_SIZE(5, WASM_I64V_4(-9828934)); 35 EXPECT_SIZE(9, WASM_I64(-9828934));
36 EXPECT_SIZE(10, WASM_I64V_9(0x123456789abcdef0ULL)); 36 EXPECT_SIZE(9, WASM_I64(0x123456789abcdef0ULL));
37 37
38 EXPECT_SIZE(5, WASM_F32(1.0f)); 38 EXPECT_SIZE(5, WASM_F32(1.0f));
39 EXPECT_SIZE(5, WASM_F32(10000.0f)); 39 EXPECT_SIZE(5, WASM_F32(10000.0f));
40 EXPECT_SIZE(5, WASM_F32(-9828934.0f)); 40 EXPECT_SIZE(5, WASM_F32(-9828934.0f));
41 41
42 EXPECT_SIZE(9, WASM_F64(1.5)); 42 EXPECT_SIZE(9, WASM_F64(1.5));
43 EXPECT_SIZE(9, WASM_F64(10200.0)); 43 EXPECT_SIZE(9, WASM_F64(10200.0));
44 EXPECT_SIZE(9, WASM_F64(-9818934.0)); 44 EXPECT_SIZE(9, WASM_F64(-9818934.0));
45 } 45 }
46 46
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 EXPECT_SIZE(5, WASM_LOAD_MEM_OFFSET(kMemTypes[i], 11, WASM_ZERO)); 324 EXPECT_SIZE(5, WASM_LOAD_MEM_OFFSET(kMemTypes[i], 11, WASM_ZERO));
325 } 325 }
326 for (size_t i = 0; i < arraysize(kMemTypes); i++) { 326 for (size_t i = 0; i < arraysize(kMemTypes); i++) {
327 EXPECT_SIZE(7, WASM_STORE_MEM_OFFSET(kMemTypes[i], 13, WASM_ZERO, 327 EXPECT_SIZE(7, WASM_STORE_MEM_OFFSET(kMemTypes[i], 13, WASM_ZERO,
328 WASM_GET_LOCAL(0))); 328 WASM_GET_LOCAL(0)));
329 } 329 }
330 } 330 }
331 } // namespace wasm 331 } // namespace wasm
332 } // namespace internal 332 } // namespace internal
333 } // namespace v8 333 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/wasm/decoder-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698