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 <stdint.h> | 5 #include <stdint.h> |
6 #include <stdio.h> | 6 #include <stdio.h> |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include "src/wasm/wasm-macro-gen.h" | 10 #include "src/wasm/wasm-macro-gen.h" |
11 | 11 |
12 #include "test/cctest/cctest.h" | 12 #include "test/cctest/cctest.h" |
13 #include "test/cctest/compiler/value-helper.h" | 13 #include "test/cctest/compiler/value-helper.h" |
14 #include "test/cctest/wasm/test-signatures.h" | 14 #include "test/cctest/wasm/test-signatures.h" |
15 #include "test/cctest/wasm/wasm-run-utils.h" | 15 #include "test/cctest/wasm/wasm-run-utils.h" |
16 | 16 |
17 using namespace v8::base; | 17 using namespace v8::base; |
18 using namespace v8::internal; | 18 using namespace v8::internal; |
19 using namespace v8::internal::compiler; | 19 using namespace v8::internal::compiler; |
20 using namespace v8::internal::wasm; | 20 using namespace v8::internal::wasm; |
21 | 21 |
22 #define BUILD(r, ...) \ | 22 #define BUILD(r, ...) \ |
23 do { \ | 23 do { \ |
24 byte code[] = {__VA_ARGS__}; \ | 24 byte code[] = {__VA_ARGS__}; \ |
25 r.Build(code, code + arraysize(code)); \ | 25 r.Build(code, code + arraysize(code)); \ |
26 } while (false) | 26 } while (false) |
27 | 27 |
28 | |
29 #define ADD_CODE(vec, ...) \ | 28 #define ADD_CODE(vec, ...) \ |
30 do { \ | 29 do { \ |
31 byte __buf[] = {__VA_ARGS__}; \ | 30 byte __buf[] = {__VA_ARGS__}; \ |
32 for (size_t i = 0; i < sizeof(__buf); i++) vec.push_back(__buf[i]); \ | 31 for (size_t i = 0; i < sizeof(__buf); i++) vec.push_back(__buf[i]); \ |
33 } while (false) | 32 } while (false) |
34 | 33 |
35 | |
36 namespace { | 34 namespace { |
37 // A helper for generating predictable but unique argument values that | 35 // A helper for generating predictable but unique argument values that |
38 // are easy to debug (e.g. with misaligned stacks). | 36 // are easy to debug (e.g. with misaligned stacks). |
39 class PredictableInputValues { | 37 class PredictableInputValues { |
40 public: | 38 public: |
41 int base_; | 39 int base_; |
42 explicit PredictableInputValues(int base) : base_(base) {} | 40 explicit PredictableInputValues(int base) : base_(base) {} |
43 double arg_d(int which) { return base_ * which + ((which & 1) * 0.5); } | 41 double arg_d(int which) { return base_ * which + ((which & 1) * 0.5); } |
44 float arg_f(int which) { return base_ * which + ((which & 1) * 0.25); } | 42 float arg_f(int which) { return base_ * which + ((which & 1) * 0.25); } |
45 int32_t arg_i(int which) { return base_ * which + ((which & 1) * kMinInt); } | 43 int32_t arg_i(int which) { return base_ * which + ((which & 1) * kMinInt); } |
46 int64_t arg_l(int which) { | 44 int64_t arg_l(int which) { |
47 return base_ * which + ((which & 1) * (0x04030201LL << 32)); | 45 return base_ * which + ((which & 1) * (0x04030201LL << 32)); |
48 } | 46 } |
49 }; | 47 }; |
50 | 48 |
51 | |
52 uint32_t AddJSSelector(TestingModule* module, FunctionSig* sig, int which) { | 49 uint32_t AddJSSelector(TestingModule* module, FunctionSig* sig, int which) { |
53 const int kMaxParams = 11; | 50 const int kMaxParams = 11; |
54 static const char* formals[kMaxParams] = {"", | 51 static const char* formals[kMaxParams] = {"", |
55 "a", | 52 "a", |
56 "a,b", | 53 "a,b", |
57 "a,b,c", | 54 "a,b,c", |
58 "a,b,c,d", | 55 "a,b,c,d", |
59 "a,b,c,d,e", | 56 "a,b,c,d,e", |
60 "a,b,c,d,e,f", | 57 "a,b,c,d,e,f", |
61 "a,b,c,d,e,f,g", | 58 "a,b,c,d,e,f,g", |
62 "a,b,c,d,e,f,g,h", | 59 "a,b,c,d,e,f,g,h", |
63 "a,b,c,d,e,f,g,h,i", | 60 "a,b,c,d,e,f,g,h,i", |
64 "a,b,c,d,e,f,g,h,i,j"}; | 61 "a,b,c,d,e,f,g,h,i,j"}; |
65 CHECK_LT(which, static_cast<int>(sig->parameter_count())); | 62 CHECK_LT(which, static_cast<int>(sig->parameter_count())); |
66 CHECK_LT(static_cast<int>(sig->parameter_count()), kMaxParams); | 63 CHECK_LT(static_cast<int>(sig->parameter_count()), kMaxParams); |
67 | 64 |
68 i::EmbeddedVector<char, 256> source; | 65 i::EmbeddedVector<char, 256> source; |
69 char param = 'a' + which; | 66 char param = 'a' + which; |
70 SNPrintF(source, "(function(%s) { return %c; })", | 67 SNPrintF(source, "(function(%s) { return %c; })", |
71 formals[sig->parameter_count()], param); | 68 formals[sig->parameter_count()], param); |
72 | 69 |
73 return module->AddJsFunction(sig, source.start()); | 70 return module->AddJsFunction(sig, source.start()); |
74 } | 71 } |
75 | 72 |
76 | |
77 void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc, | 73 void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc, |
78 Handle<Object>* buffer, int count) { | 74 Handle<Object>* buffer, int count) { |
79 Isolate* isolate = jsfunc->GetIsolate(); | 75 Isolate* isolate = jsfunc->GetIsolate(); |
80 Handle<Object> global(isolate->context()->global_object(), isolate); | 76 Handle<Object> global(isolate->context()->global_object(), isolate); |
81 MaybeHandle<Object> retval = | 77 MaybeHandle<Object> retval = |
82 Execution::Call(isolate, jsfunc, global, count, buffer); | 78 Execution::Call(isolate, jsfunc, global, count, buffer); |
83 | 79 |
84 CHECK(!retval.is_null()); | 80 CHECK(!retval.is_null()); |
85 Handle<Object> result = retval.ToHandleChecked(); | 81 Handle<Object> result = retval.ToHandleChecked(); |
86 if (result->IsSmi()) { | 82 if (result->IsSmi()) { |
87 CHECK_EQ(expected, Smi::cast(*result)->value()); | 83 CHECK_EQ(expected, Smi::cast(*result)->value()); |
88 } else { | 84 } else { |
89 CHECK(result->IsHeapNumber()); | 85 CHECK(result->IsHeapNumber()); |
90 CheckFloatEq(expected, HeapNumber::cast(*result)->value()); | 86 CheckFloatEq(expected, HeapNumber::cast(*result)->value()); |
91 } | 87 } |
92 } | 88 } |
93 | 89 |
94 | |
95 void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc, double a, | 90 void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc, double a, |
96 double b) { | 91 double b) { |
97 Isolate* isolate = jsfunc->GetIsolate(); | 92 Isolate* isolate = jsfunc->GetIsolate(); |
98 Handle<Object> buffer[] = {isolate->factory()->NewNumber(a), | 93 Handle<Object> buffer[] = {isolate->factory()->NewNumber(a), |
99 isolate->factory()->NewNumber(b)}; | 94 isolate->factory()->NewNumber(b)}; |
100 EXPECT_CALL(expected, jsfunc, buffer, 2); | 95 EXPECT_CALL(expected, jsfunc, buffer, 2); |
101 } | 96 } |
102 } // namespace | 97 } // namespace |
103 | 98 |
104 TEST(Run_Int32Sub_jswrapped) { | 99 TEST(Run_Int32Sub_jswrapped) { |
105 TestSignatures sigs; | 100 TestSignatures sigs; |
106 TestingModule module; | 101 TestingModule module; |
107 WasmFunctionCompiler t(sigs.i_ii(), &module); | 102 WasmFunctionCompiler t(sigs.i_ii(), &module); |
108 BUILD(t, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 103 BUILD(t, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
109 Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); | 104 Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); |
110 | 105 |
111 EXPECT_CALL(33, jsfunc, 44, 11); | 106 EXPECT_CALL(33, jsfunc, 44, 11); |
112 EXPECT_CALL(-8723487, jsfunc, -8000000, 723487); | 107 EXPECT_CALL(-8723487, jsfunc, -8000000, 723487); |
113 } | 108 } |
114 | 109 |
115 | |
116 TEST(Run_Float32Div_jswrapped) { | 110 TEST(Run_Float32Div_jswrapped) { |
117 TestSignatures sigs; | 111 TestSignatures sigs; |
118 TestingModule module; | 112 TestingModule module; |
119 WasmFunctionCompiler t(sigs.f_ff(), &module); | 113 WasmFunctionCompiler t(sigs.f_ff(), &module); |
120 BUILD(t, WASM_F32_DIV(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 114 BUILD(t, WASM_F32_DIV(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
121 Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); | 115 Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); |
122 | 116 |
123 EXPECT_CALL(92, jsfunc, 46, 0.5); | 117 EXPECT_CALL(92, jsfunc, 46, 0.5); |
124 EXPECT_CALL(64, jsfunc, -16, -0.25); | 118 EXPECT_CALL(64, jsfunc, -16, -0.25); |
125 } | 119 } |
126 | 120 |
127 | |
128 TEST(Run_Float64Add_jswrapped) { | 121 TEST(Run_Float64Add_jswrapped) { |
129 TestSignatures sigs; | 122 TestSignatures sigs; |
130 TestingModule module; | 123 TestingModule module; |
131 WasmFunctionCompiler t(sigs.d_dd(), &module); | 124 WasmFunctionCompiler t(sigs.d_dd(), &module); |
132 BUILD(t, WASM_F64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 125 BUILD(t, WASM_F64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
133 Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); | 126 Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); |
134 | 127 |
135 EXPECT_CALL(3, jsfunc, 2, 1); | 128 EXPECT_CALL(3, jsfunc, 2, 1); |
136 EXPECT_CALL(-5.5, jsfunc, -5.25, -0.25); | 129 EXPECT_CALL(-5.5, jsfunc, -5.25, -0.25); |
137 } | 130 } |
138 | 131 |
139 | |
140 TEST(Run_I32Popcount_jswrapped) { | 132 TEST(Run_I32Popcount_jswrapped) { |
141 TestSignatures sigs; | 133 TestSignatures sigs; |
142 TestingModule module; | 134 TestingModule module; |
143 WasmFunctionCompiler t(sigs.i_i(), &module); | 135 WasmFunctionCompiler t(sigs.i_i(), &module); |
144 BUILD(t, WASM_I32_POPCNT(WASM_GET_LOCAL(0))); | 136 BUILD(t, WASM_I32_POPCNT(WASM_GET_LOCAL(0))); |
145 Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); | 137 Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); |
146 | 138 |
147 EXPECT_CALL(2, jsfunc, 9, 0); | 139 EXPECT_CALL(2, jsfunc, 9, 0); |
148 EXPECT_CALL(3, jsfunc, 11, 0); | 140 EXPECT_CALL(3, jsfunc, 11, 0); |
149 EXPECT_CALL(6, jsfunc, 0x3F, 0); | 141 EXPECT_CALL(6, jsfunc, 0x3F, 0); |
150 } | 142 } |
151 | 143 |
152 | |
153 TEST(Run_CallJS_Add_jswrapped) { | 144 TEST(Run_CallJS_Add_jswrapped) { |
154 TestSignatures sigs; | 145 TestSignatures sigs; |
155 TestingModule module; | 146 TestingModule module; |
156 WasmFunctionCompiler t(sigs.i_i(), &module); | 147 WasmFunctionCompiler t(sigs.i_i(), &module); |
157 uint32_t js_index = | 148 uint32_t js_index = |
158 module.AddJsFunction(sigs.i_i(), "(function(a) { return a + 99; })"); | 149 module.AddJsFunction(sigs.i_i(), "(function(a) { return a + 99; })"); |
159 BUILD(t, WASM_CALL_FUNCTION1(js_index, WASM_GET_LOCAL(0))); | 150 BUILD(t, WASM_CALL_FUNCTION1(js_index, WASM_GET_LOCAL(0))); |
160 | 151 |
161 Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); | 152 Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); |
162 | 153 |
163 EXPECT_CALL(101, jsfunc, 2, -8); | 154 EXPECT_CALL(101, jsfunc, 2, -8); |
164 EXPECT_CALL(199, jsfunc, 100, -1); | 155 EXPECT_CALL(199, jsfunc, 100, -1); |
165 EXPECT_CALL(-666666801, jsfunc, -666666900, -1); | 156 EXPECT_CALL(-666666801, jsfunc, -666666900, -1); |
166 } | 157 } |
167 | 158 |
168 | |
169 void RunJSSelectTest(int which) { | 159 void RunJSSelectTest(int which) { |
170 const int kMaxParams = 8; | 160 const int kMaxParams = 8; |
171 PredictableInputValues inputs(0x100); | 161 PredictableInputValues inputs(0x100); |
172 LocalType type = kAstF64; | 162 LocalType type = kAstF64; |
173 LocalType types[kMaxParams + 1] = {type, type, type, type, type, | 163 LocalType types[kMaxParams + 1] = {type, type, type, type, type, |
174 type, type, type, type}; | 164 type, type, type, type}; |
175 for (int num_params = which + 1; num_params < kMaxParams; num_params++) { | 165 for (int num_params = which + 1; num_params < kMaxParams; num_params++) { |
176 HandleScope scope(CcTest::InitIsolateOnce()); | 166 HandleScope scope(CcTest::InitIsolateOnce()); |
177 FunctionSig sig(1, num_params, types); | 167 FunctionSig sig(1, num_params, types); |
178 | 168 |
(...skipping 15 matching lines...) Expand all Loading... |
194 code.push_back(0); | 184 code.push_back(0); |
195 t.Build(&code[0], &code[end]); | 185 t.Build(&code[0], &code[end]); |
196 } | 186 } |
197 | 187 |
198 Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); | 188 Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); |
199 double expected = inputs.arg_d(which); | 189 double expected = inputs.arg_d(which); |
200 EXPECT_CALL(expected, jsfunc, 0.0, 0.0); | 190 EXPECT_CALL(expected, jsfunc, 0.0, 0.0); |
201 } | 191 } |
202 } | 192 } |
203 | 193 |
204 | |
205 TEST(Run_JSSelect_0) { RunJSSelectTest(0); } | 194 TEST(Run_JSSelect_0) { RunJSSelectTest(0); } |
206 | 195 |
207 TEST(Run_JSSelect_1) { RunJSSelectTest(1); } | 196 TEST(Run_JSSelect_1) { RunJSSelectTest(1); } |
208 | 197 |
209 TEST(Run_JSSelect_2) { RunJSSelectTest(2); } | 198 TEST(Run_JSSelect_2) { RunJSSelectTest(2); } |
210 | 199 |
211 TEST(Run_JSSelect_3) { RunJSSelectTest(3); } | 200 TEST(Run_JSSelect_3) { RunJSSelectTest(3); } |
212 | 201 |
213 TEST(Run_JSSelect_4) { RunJSSelectTest(4); } | 202 TEST(Run_JSSelect_4) { RunJSSelectTest(4); } |
214 | 203 |
215 TEST(Run_JSSelect_5) { RunJSSelectTest(5); } | 204 TEST(Run_JSSelect_5) { RunJSSelectTest(5); } |
216 | 205 |
217 TEST(Run_JSSelect_6) { RunJSSelectTest(6); } | 206 TEST(Run_JSSelect_6) { RunJSSelectTest(6); } |
218 | 207 |
219 TEST(Run_JSSelect_7) { RunJSSelectTest(7); } | 208 TEST(Run_JSSelect_7) { RunJSSelectTest(7); } |
220 | 209 |
221 | |
222 void RunWASMSelectTest(int which) { | 210 void RunWASMSelectTest(int which) { |
223 PredictableInputValues inputs(0x200); | 211 PredictableInputValues inputs(0x200); |
224 Isolate* isolate = CcTest::InitIsolateOnce(); | 212 Isolate* isolate = CcTest::InitIsolateOnce(); |
225 const int kMaxParams = 8; | 213 const int kMaxParams = 8; |
226 for (int num_params = which + 1; num_params < kMaxParams; num_params++) { | 214 for (int num_params = which + 1; num_params < kMaxParams; num_params++) { |
227 LocalType type = kAstF64; | 215 LocalType type = kAstF64; |
228 LocalType types[kMaxParams + 1] = {type, type, type, type, type, | 216 LocalType types[kMaxParams + 1] = {type, type, type, type, type, |
229 type, type, type, type}; | 217 type, type, type, type}; |
230 FunctionSig sig(1, num_params, types); | 218 FunctionSig sig(1, num_params, types); |
231 | 219 |
(...skipping 11 matching lines...) Expand all Loading... |
243 isolate->factory()->NewNumber(inputs.arg_d(5)), | 231 isolate->factory()->NewNumber(inputs.arg_d(5)), |
244 isolate->factory()->NewNumber(inputs.arg_d(6)), | 232 isolate->factory()->NewNumber(inputs.arg_d(6)), |
245 isolate->factory()->NewNumber(inputs.arg_d(7)), | 233 isolate->factory()->NewNumber(inputs.arg_d(7)), |
246 }; | 234 }; |
247 | 235 |
248 double expected = inputs.arg_d(which); | 236 double expected = inputs.arg_d(which); |
249 EXPECT_CALL(expected, jsfunc, args, kMaxParams); | 237 EXPECT_CALL(expected, jsfunc, args, kMaxParams); |
250 } | 238 } |
251 } | 239 } |
252 | 240 |
253 | |
254 TEST(Run_WASMSelect_0) { RunWASMSelectTest(0); } | 241 TEST(Run_WASMSelect_0) { RunWASMSelectTest(0); } |
255 | 242 |
256 TEST(Run_WASMSelect_1) { RunWASMSelectTest(1); } | 243 TEST(Run_WASMSelect_1) { RunWASMSelectTest(1); } |
257 | 244 |
258 TEST(Run_WASMSelect_2) { RunWASMSelectTest(2); } | 245 TEST(Run_WASMSelect_2) { RunWASMSelectTest(2); } |
259 | 246 |
260 TEST(Run_WASMSelect_3) { RunWASMSelectTest(3); } | 247 TEST(Run_WASMSelect_3) { RunWASMSelectTest(3); } |
261 | 248 |
262 TEST(Run_WASMSelect_4) { RunWASMSelectTest(4); } | 249 TEST(Run_WASMSelect_4) { RunWASMSelectTest(4); } |
263 | 250 |
264 TEST(Run_WASMSelect_5) { RunWASMSelectTest(5); } | 251 TEST(Run_WASMSelect_5) { RunWASMSelectTest(5); } |
265 | 252 |
266 TEST(Run_WASMSelect_6) { RunWASMSelectTest(6); } | 253 TEST(Run_WASMSelect_6) { RunWASMSelectTest(6); } |
267 | 254 |
268 TEST(Run_WASMSelect_7) { RunWASMSelectTest(7); } | 255 TEST(Run_WASMSelect_7) { RunWASMSelectTest(7); } |
269 | 256 |
270 | |
271 void RunWASMSelectAlignTest(int num_args, int num_params) { | 257 void RunWASMSelectAlignTest(int num_args, int num_params) { |
272 PredictableInputValues inputs(0x300); | 258 PredictableInputValues inputs(0x300); |
273 Isolate* isolate = CcTest::InitIsolateOnce(); | 259 Isolate* isolate = CcTest::InitIsolateOnce(); |
274 const int kMaxParams = 10; | 260 const int kMaxParams = 10; |
275 DCHECK_LE(num_args, kMaxParams); | 261 DCHECK_LE(num_args, kMaxParams); |
276 LocalType type = kAstF64; | 262 LocalType type = kAstF64; |
277 LocalType types[kMaxParams + 1] = {type, type, type, type, type, type, | 263 LocalType types[kMaxParams + 1] = {type, type, type, type, type, type, |
278 type, type, type, type, type}; | 264 type, type, type, type, type}; |
279 FunctionSig sig(1, num_params, types); | 265 FunctionSig sig(1, num_params, types); |
280 | 266 |
(...skipping 13 matching lines...) Expand all Loading... |
294 isolate->factory()->NewNumber(inputs.arg_d(7)), | 280 isolate->factory()->NewNumber(inputs.arg_d(7)), |
295 isolate->factory()->NewNumber(inputs.arg_d(8)), | 281 isolate->factory()->NewNumber(inputs.arg_d(8)), |
296 isolate->factory()->NewNumber(inputs.arg_d(9))}; | 282 isolate->factory()->NewNumber(inputs.arg_d(9))}; |
297 | 283 |
298 double nan = std::numeric_limits<double>::quiet_NaN(); | 284 double nan = std::numeric_limits<double>::quiet_NaN(); |
299 double expected = which < num_args ? inputs.arg_d(which) : nan; | 285 double expected = which < num_args ? inputs.arg_d(which) : nan; |
300 EXPECT_CALL(expected, jsfunc, args, num_args); | 286 EXPECT_CALL(expected, jsfunc, args, num_args); |
301 } | 287 } |
302 } | 288 } |
303 | 289 |
304 | |
305 TEST(Run_WASMSelectAlign_0) { | 290 TEST(Run_WASMSelectAlign_0) { |
306 RunWASMSelectAlignTest(0, 1); | 291 RunWASMSelectAlignTest(0, 1); |
307 RunWASMSelectAlignTest(0, 2); | 292 RunWASMSelectAlignTest(0, 2); |
308 } | 293 } |
309 | 294 |
310 | |
311 TEST(Run_WASMSelectAlign_1) { | 295 TEST(Run_WASMSelectAlign_1) { |
312 RunWASMSelectAlignTest(1, 2); | 296 RunWASMSelectAlignTest(1, 2); |
313 RunWASMSelectAlignTest(1, 3); | 297 RunWASMSelectAlignTest(1, 3); |
314 } | 298 } |
315 | 299 |
316 | |
317 TEST(Run_WASMSelectAlign_2) { | 300 TEST(Run_WASMSelectAlign_2) { |
318 RunWASMSelectAlignTest(2, 3); | 301 RunWASMSelectAlignTest(2, 3); |
319 RunWASMSelectAlignTest(2, 4); | 302 RunWASMSelectAlignTest(2, 4); |
320 } | 303 } |
321 | 304 |
322 | |
323 TEST(Run_WASMSelectAlign_3) { | 305 TEST(Run_WASMSelectAlign_3) { |
324 RunWASMSelectAlignTest(3, 3); | 306 RunWASMSelectAlignTest(3, 3); |
325 RunWASMSelectAlignTest(3, 4); | 307 RunWASMSelectAlignTest(3, 4); |
326 } | 308 } |
327 | 309 |
328 | |
329 TEST(Run_WASMSelectAlign_4) { | 310 TEST(Run_WASMSelectAlign_4) { |
330 RunWASMSelectAlignTest(4, 3); | 311 RunWASMSelectAlignTest(4, 3); |
331 RunWASMSelectAlignTest(4, 4); | 312 RunWASMSelectAlignTest(4, 4); |
332 } | 313 } |
333 | 314 |
334 TEST(Run_WASMSelectAlign_7) { | 315 TEST(Run_WASMSelectAlign_7) { |
335 RunWASMSelectAlignTest(7, 5); | 316 RunWASMSelectAlignTest(7, 5); |
336 RunWASMSelectAlignTest(7, 6); | 317 RunWASMSelectAlignTest(7, 6); |
337 RunWASMSelectAlignTest(7, 7); | 318 RunWASMSelectAlignTest(7, 7); |
338 } | 319 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 factory->NewNumber(inputs.arg_d(8)), | 386 factory->NewNumber(inputs.arg_d(8)), |
406 factory->NewNumber(inputs.arg_d(9)), | 387 factory->NewNumber(inputs.arg_d(9)), |
407 }; | 388 }; |
408 | 389 |
409 double nan = std::numeric_limits<double>::quiet_NaN(); | 390 double nan = std::numeric_limits<double>::quiet_NaN(); |
410 double expected = which < num_args ? inputs.arg_d(which) : nan; | 391 double expected = which < num_args ? inputs.arg_d(which) : nan; |
411 EXPECT_CALL(expected, jsfunc, args, num_args); | 392 EXPECT_CALL(expected, jsfunc, args, num_args); |
412 } | 393 } |
413 } | 394 } |
414 | 395 |
415 | |
416 TEST(Run_JSSelectAlign_0) { | 396 TEST(Run_JSSelectAlign_0) { |
417 RunJSSelectAlignTest(0, 1); | 397 RunJSSelectAlignTest(0, 1); |
418 RunJSSelectAlignTest(0, 2); | 398 RunJSSelectAlignTest(0, 2); |
419 } | 399 } |
420 | 400 |
421 TEST(Run_JSSelectAlign_1) { | 401 TEST(Run_JSSelectAlign_1) { |
422 RunJSSelectAlignTest(1, 2); | 402 RunJSSelectAlignTest(1, 2); |
423 RunJSSelectAlignTest(1, 3); | 403 RunJSSelectAlignTest(1, 3); |
424 } | 404 } |
425 | 405 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 RunJSSelectAlignTest(9, 8); | 438 RunJSSelectAlignTest(9, 8); |
459 RunJSSelectAlignTest(9, 9); | 439 RunJSSelectAlignTest(9, 9); |
460 } | 440 } |
461 | 441 |
462 TEST(Run_JSSelectAlign_10) { | 442 TEST(Run_JSSelectAlign_10) { |
463 RunJSSelectAlignTest(10, 7); | 443 RunJSSelectAlignTest(10, 7); |
464 RunJSSelectAlignTest(10, 8); | 444 RunJSSelectAlignTest(10, 8); |
465 RunJSSelectAlignTest(10, 9); | 445 RunJSSelectAlignTest(10, 9); |
466 RunJSSelectAlignTest(10, 10); | 446 RunJSSelectAlignTest(10, 10); |
467 } | 447 } |
OLD | NEW |