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

Side by Side Diff: test/common/wasm/test-signatures.h

Issue 2594993002: [wasm] Rename wasm::LocalType to wasm::ValueType and kAst* to kWasm* (Closed)
Patch Set: Fix inspector tests Created 3 years, 12 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/cctest/wasm/wasm-run-utils.h ('k') | test/fuzzer/wasm-call.cc » ('j') | 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 #ifndef TEST_SIGNATURES_H 5 #ifndef TEST_SIGNATURES_H
6 #define TEST_SIGNATURES_H 6 #define TEST_SIGNATURES_H
7 7
8 #include "src/signature.h" 8 #include "src/signature.h"
9 #include "src/wasm/wasm-opcodes.h" 9 #include "src/wasm/wasm-opcodes.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 namespace wasm { 13 namespace wasm {
14 14
15 typedef Signature<LocalType> FunctionSig; 15 typedef Signature<ValueType> FunctionSig;
16 16
17 // A helper class with many useful signatures in order to simplify tests. 17 // A helper class with many useful signatures in order to simplify tests.
18 class TestSignatures { 18 class TestSignatures {
19 public: 19 public:
20 TestSignatures() 20 TestSignatures()
21 : sig_i_v(1, 0, kIntTypes4), 21 : sig_i_v(1, 0, kIntTypes4),
22 sig_i_i(1, 1, kIntTypes4), 22 sig_i_i(1, 1, kIntTypes4),
23 sig_i_ii(1, 2, kIntTypes4), 23 sig_i_ii(1, 2, kIntTypes4),
24 sig_i_iii(1, 3, kIntTypes4), 24 sig_i_iii(1, 3, kIntTypes4),
25 sig_i_f(1, 1, kIntFloatTypes4), 25 sig_i_f(1, 1, kIntFloatTypes4),
26 sig_i_ff(1, 2, kIntFloatTypes4), 26 sig_i_ff(1, 2, kIntFloatTypes4),
27 sig_i_d(1, 1, kIntDoubleTypes4), 27 sig_i_d(1, 1, kIntDoubleTypes4),
28 sig_i_dd(1, 2, kIntDoubleTypes4), 28 sig_i_dd(1, 2, kIntDoubleTypes4),
29 sig_l_v(1, 0, kLongTypes4), 29 sig_l_v(1, 0, kLongTypes4),
30 sig_l_l(1, 1, kLongTypes4), 30 sig_l_l(1, 1, kLongTypes4),
31 sig_l_ll(1, 2, kLongTypes4), 31 sig_l_ll(1, 2, kLongTypes4),
32 sig_i_ll(1, 2, kIntLongTypes4), 32 sig_i_ll(1, 2, kIntLongTypes4),
33 sig_f_f(1, 1, kFloatTypes4), 33 sig_f_f(1, 1, kFloatTypes4),
34 sig_f_ff(1, 2, kFloatTypes4), 34 sig_f_ff(1, 2, kFloatTypes4),
35 sig_d_d(1, 1, kDoubleTypes4), 35 sig_d_d(1, 1, kDoubleTypes4),
36 sig_d_dd(1, 2, kDoubleTypes4), 36 sig_d_dd(1, 2, kDoubleTypes4),
37 sig_v_v(0, 0, kIntTypes4), 37 sig_v_v(0, 0, kIntTypes4),
38 sig_v_i(0, 1, kIntTypes4), 38 sig_v_i(0, 1, kIntTypes4),
39 sig_v_ii(0, 2, kIntTypes4), 39 sig_v_ii(0, 2, kIntTypes4),
40 sig_v_iii(0, 3, kIntTypes4), 40 sig_v_iii(0, 3, kIntTypes4),
41 sig_s_i(1, 1, kSimd128IntTypes4) { 41 sig_s_i(1, 1, kSimd128IntTypes4) {
42 // I used C++ and you won't believe what happened next.... 42 // I used C++ and you won't believe what happened next....
43 for (int i = 0; i < 4; i++) kIntTypes4[i] = kAstI32; 43 for (int i = 0; i < 4; i++) kIntTypes4[i] = kWasmI32;
44 for (int i = 0; i < 4; i++) kLongTypes4[i] = kAstI64; 44 for (int i = 0; i < 4; i++) kLongTypes4[i] = kWasmI64;
45 for (int i = 0; i < 4; i++) kFloatTypes4[i] = kAstF32; 45 for (int i = 0; i < 4; i++) kFloatTypes4[i] = kWasmF32;
46 for (int i = 0; i < 4; i++) kDoubleTypes4[i] = kAstF64; 46 for (int i = 0; i < 4; i++) kDoubleTypes4[i] = kWasmF64;
47 for (int i = 0; i < 4; i++) kIntLongTypes4[i] = kAstI64; 47 for (int i = 0; i < 4; i++) kIntLongTypes4[i] = kWasmI64;
48 for (int i = 0; i < 4; i++) kIntFloatTypes4[i] = kAstF32; 48 for (int i = 0; i < 4; i++) kIntFloatTypes4[i] = kWasmF32;
49 for (int i = 0; i < 4; i++) kIntDoubleTypes4[i] = kAstF64; 49 for (int i = 0; i < 4; i++) kIntDoubleTypes4[i] = kWasmF64;
50 for (int i = 0; i < 4; i++) kSimd128IntTypes4[i] = kAstS128; 50 for (int i = 0; i < 4; i++) kSimd128IntTypes4[i] = kWasmS128;
51 kIntLongTypes4[0] = kAstI32; 51 kIntLongTypes4[0] = kWasmI32;
52 kIntFloatTypes4[0] = kAstI32; 52 kIntFloatTypes4[0] = kWasmI32;
53 kIntDoubleTypes4[0] = kAstI32; 53 kIntDoubleTypes4[0] = kWasmI32;
54 kSimd128IntTypes4[1] = kAstI32; 54 kSimd128IntTypes4[1] = kWasmI32;
55 } 55 }
56 56
57 FunctionSig* i_v() { return &sig_i_v; } 57 FunctionSig* i_v() { return &sig_i_v; }
58 FunctionSig* i_i() { return &sig_i_i; } 58 FunctionSig* i_i() { return &sig_i_i; }
59 FunctionSig* i_ii() { return &sig_i_ii; } 59 FunctionSig* i_ii() { return &sig_i_ii; }
60 FunctionSig* i_iii() { return &sig_i_iii; } 60 FunctionSig* i_iii() { return &sig_i_iii; }
61 61
62 FunctionSig* i_f() { return &sig_i_f; } 62 FunctionSig* i_f() { return &sig_i_f; }
63 FunctionSig* i_ff() { return &sig_i_ff; } 63 FunctionSig* i_ff() { return &sig_i_ff; }
64 FunctionSig* i_d() { return &sig_i_d; } 64 FunctionSig* i_d() { return &sig_i_d; }
65 FunctionSig* i_dd() { return &sig_i_dd; } 65 FunctionSig* i_dd() { return &sig_i_dd; }
66 66
67 FunctionSig* l_v() { return &sig_l_v; } 67 FunctionSig* l_v() { return &sig_l_v; }
68 FunctionSig* l_l() { return &sig_l_l; } 68 FunctionSig* l_l() { return &sig_l_l; }
69 FunctionSig* l_ll() { return &sig_l_ll; } 69 FunctionSig* l_ll() { return &sig_l_ll; }
70 FunctionSig* i_ll() { return &sig_i_ll; } 70 FunctionSig* i_ll() { return &sig_i_ll; }
71 71
72 FunctionSig* f_f() { return &sig_f_f; } 72 FunctionSig* f_f() { return &sig_f_f; }
73 FunctionSig* f_ff() { return &sig_f_ff; } 73 FunctionSig* f_ff() { return &sig_f_ff; }
74 FunctionSig* d_d() { return &sig_d_d; } 74 FunctionSig* d_d() { return &sig_d_d; }
75 FunctionSig* d_dd() { return &sig_d_dd; } 75 FunctionSig* d_dd() { return &sig_d_dd; }
76 76
77 FunctionSig* v_v() { return &sig_v_v; } 77 FunctionSig* v_v() { return &sig_v_v; }
78 FunctionSig* v_i() { return &sig_v_i; } 78 FunctionSig* v_i() { return &sig_v_i; }
79 FunctionSig* v_ii() { return &sig_v_ii; } 79 FunctionSig* v_ii() { return &sig_v_ii; }
80 FunctionSig* v_iii() { return &sig_v_iii; } 80 FunctionSig* v_iii() { return &sig_v_iii; }
81 FunctionSig* s_i() { return &sig_s_i; } 81 FunctionSig* s_i() { return &sig_s_i; }
82 82
83 FunctionSig* many(Zone* zone, LocalType ret, LocalType param, int count) { 83 FunctionSig* many(Zone* zone, ValueType ret, ValueType param, int count) {
84 FunctionSig::Builder builder(zone, ret == kAstStmt ? 0 : 1, count); 84 FunctionSig::Builder builder(zone, ret == kWasmStmt ? 0 : 1, count);
85 if (ret != kAstStmt) builder.AddReturn(ret); 85 if (ret != kWasmStmt) builder.AddReturn(ret);
86 for (int i = 0; i < count; i++) { 86 for (int i = 0; i < count; i++) {
87 builder.AddParam(param); 87 builder.AddParam(param);
88 } 88 }
89 return builder.Build(); 89 return builder.Build();
90 } 90 }
91 91
92 private: 92 private:
93 LocalType kIntTypes4[4]; 93 ValueType kIntTypes4[4];
94 LocalType kLongTypes4[4]; 94 ValueType kLongTypes4[4];
95 LocalType kFloatTypes4[4]; 95 ValueType kFloatTypes4[4];
96 LocalType kDoubleTypes4[4]; 96 ValueType kDoubleTypes4[4];
97 LocalType kIntLongTypes4[4]; 97 ValueType kIntLongTypes4[4];
98 LocalType kIntFloatTypes4[4]; 98 ValueType kIntFloatTypes4[4];
99 LocalType kIntDoubleTypes4[4]; 99 ValueType kIntDoubleTypes4[4];
100 LocalType kSimd128IntTypes4[4]; 100 ValueType kSimd128IntTypes4[4];
101 101
102 FunctionSig sig_i_v; 102 FunctionSig sig_i_v;
103 FunctionSig sig_i_i; 103 FunctionSig sig_i_i;
104 FunctionSig sig_i_ii; 104 FunctionSig sig_i_ii;
105 FunctionSig sig_i_iii; 105 FunctionSig sig_i_iii;
106 106
107 FunctionSig sig_i_f; 107 FunctionSig sig_i_f;
108 FunctionSig sig_i_ff; 108 FunctionSig sig_i_ff;
109 FunctionSig sig_i_d; 109 FunctionSig sig_i_d;
110 FunctionSig sig_i_dd; 110 FunctionSig sig_i_dd;
(...skipping 12 matching lines...) Expand all
123 FunctionSig sig_v_i; 123 FunctionSig sig_v_i;
124 FunctionSig sig_v_ii; 124 FunctionSig sig_v_ii;
125 FunctionSig sig_v_iii; 125 FunctionSig sig_v_iii;
126 FunctionSig sig_s_i; 126 FunctionSig sig_s_i;
127 }; 127 };
128 } // namespace wasm 128 } // namespace wasm
129 } // namespace internal 129 } // namespace internal
130 } // namespace v8 130 } // namespace v8
131 131
132 #endif // TEST_SIGNATURES_H 132 #endif // TEST_SIGNATURES_H
OLDNEW
« no previous file with comments | « test/cctest/wasm/wasm-run-utils.h ('k') | test/fuzzer/wasm-call.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698