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

Side by Side Diff: test/cctest/wasm/test-run-wasm-js.cc

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/test-run-wasm-64.cc ('k') | test/cctest/wasm/test-run-wasm-module.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 #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"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 Handle<JSFunction> jsfunc = r.module().WrapCode(r.function()->func_index); 143 Handle<JSFunction> jsfunc = r.module().WrapCode(r.function()->func_index);
144 144
145 EXPECT_CALL(101, jsfunc, 2, -8); 145 EXPECT_CALL(101, jsfunc, 2, -8);
146 EXPECT_CALL(199, jsfunc, 100, -1); 146 EXPECT_CALL(199, jsfunc, 100, -1);
147 EXPECT_CALL(-666666801, jsfunc, -666666900, -1); 147 EXPECT_CALL(-666666801, jsfunc, -666666900, -1);
148 } 148 }
149 149
150 void RunJSSelectTest(int which) { 150 void RunJSSelectTest(int which) {
151 const int kMaxParams = 8; 151 const int kMaxParams = 8;
152 PredictableInputValues inputs(0x100); 152 PredictableInputValues inputs(0x100);
153 LocalType type = kAstF64; 153 ValueType type = kWasmF64;
154 LocalType types[kMaxParams + 1] = {type, type, type, type, type, 154 ValueType types[kMaxParams + 1] = {type, type, type, type, type,
155 type, type, type, type}; 155 type, type, type, type};
156 for (int num_params = which + 1; num_params < kMaxParams; num_params++) { 156 for (int num_params = which + 1; num_params < kMaxParams; num_params++) {
157 HandleScope scope(CcTest::InitIsolateOnce()); 157 HandleScope scope(CcTest::InitIsolateOnce());
158 FunctionSig sig(1, num_params, types); 158 FunctionSig sig(1, num_params, types);
159 159
160 WasmRunner<void> r(kExecuteCompiled); 160 WasmRunner<void> r(kExecuteCompiled);
161 uint32_t js_index = AddJSSelector(&r.module(), &sig, which); 161 uint32_t js_index = AddJSSelector(&r.module(), &sig, which);
162 WasmFunctionCompiler& t = r.NewFunction(&sig); 162 WasmFunctionCompiler& t = r.NewFunction(&sig);
163 163
164 { 164 {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 TEST(Run_JSSelect_7) { 219 TEST(Run_JSSelect_7) {
220 CcTest::InitializeVM(); 220 CcTest::InitializeVM();
221 RunJSSelectTest(7); 221 RunJSSelectTest(7);
222 } 222 }
223 223
224 void RunWASMSelectTest(int which) { 224 void RunWASMSelectTest(int which) {
225 PredictableInputValues inputs(0x200); 225 PredictableInputValues inputs(0x200);
226 Isolate* isolate = CcTest::InitIsolateOnce(); 226 Isolate* isolate = CcTest::InitIsolateOnce();
227 const int kMaxParams = 8; 227 const int kMaxParams = 8;
228 for (int num_params = which + 1; num_params < kMaxParams; num_params++) { 228 for (int num_params = which + 1; num_params < kMaxParams; num_params++) {
229 LocalType type = kAstF64; 229 ValueType type = kWasmF64;
230 LocalType types[kMaxParams + 1] = {type, type, type, type, type, 230 ValueType types[kMaxParams + 1] = {type, type, type, type, type,
231 type, type, type, type}; 231 type, type, type, type};
232 FunctionSig sig(1, num_params, types); 232 FunctionSig sig(1, num_params, types);
233 233
234 WasmRunner<void> r(kExecuteCompiled); 234 WasmRunner<void> r(kExecuteCompiled);
235 WasmFunctionCompiler& t = r.NewFunction(&sig); 235 WasmFunctionCompiler& t = r.NewFunction(&sig);
236 BUILD(t, WASM_GET_LOCAL(which)); 236 BUILD(t, WASM_GET_LOCAL(which));
237 Handle<JSFunction> jsfunc = r.module().WrapCode(t.function_index()); 237 Handle<JSFunction> jsfunc = r.module().WrapCode(t.function_index());
238 238
239 Handle<Object> args[] = { 239 Handle<Object> args[] = {
240 isolate->factory()->NewNumber(inputs.arg_d(0)), 240 isolate->factory()->NewNumber(inputs.arg_d(0)),
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 TEST(Run_WASMSelect_7) { 290 TEST(Run_WASMSelect_7) {
291 CcTest::InitializeVM(); 291 CcTest::InitializeVM();
292 RunWASMSelectTest(7); 292 RunWASMSelectTest(7);
293 } 293 }
294 294
295 void RunWASMSelectAlignTest(int num_args, int num_params) { 295 void RunWASMSelectAlignTest(int num_args, int num_params) {
296 PredictableInputValues inputs(0x300); 296 PredictableInputValues inputs(0x300);
297 Isolate* isolate = CcTest::InitIsolateOnce(); 297 Isolate* isolate = CcTest::InitIsolateOnce();
298 const int kMaxParams = 10; 298 const int kMaxParams = 10;
299 DCHECK_LE(num_args, kMaxParams); 299 DCHECK_LE(num_args, kMaxParams);
300 LocalType type = kAstF64; 300 ValueType type = kWasmF64;
301 LocalType types[kMaxParams + 1] = {type, type, type, type, type, type, 301 ValueType types[kMaxParams + 1] = {type, type, type, type, type, type,
302 type, type, type, type, type}; 302 type, type, type, type, type};
303 FunctionSig sig(1, num_params, types); 303 FunctionSig sig(1, num_params, types);
304 304
305 for (int which = 0; which < num_params; which++) { 305 for (int which = 0; which < num_params; which++) {
306 WasmRunner<void> r(kExecuteCompiled); 306 WasmRunner<void> r(kExecuteCompiled);
307 WasmFunctionCompiler& t = r.NewFunction(&sig); 307 WasmFunctionCompiler& t = r.NewFunction(&sig);
308 BUILD(t, WASM_GET_LOCAL(which)); 308 BUILD(t, WASM_GET_LOCAL(which));
309 Handle<JSFunction> jsfunc = r.module().WrapCode(t.function_index()); 309 Handle<JSFunction> jsfunc = r.module().WrapCode(t.function_index());
310 310
311 Handle<Object> args[] = {isolate->factory()->NewNumber(inputs.arg_d(0)), 311 Handle<Object> args[] = {isolate->factory()->NewNumber(inputs.arg_d(0)),
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 RunWASMSelectAlignTest(10, 10); 386 RunWASMSelectAlignTest(10, 10);
387 } 387 }
388 388
389 void RunJSSelectAlignTest(int num_args, int num_params) { 389 void RunJSSelectAlignTest(int num_args, int num_params) {
390 PredictableInputValues inputs(0x400); 390 PredictableInputValues inputs(0x400);
391 Isolate* isolate = CcTest::InitIsolateOnce(); 391 Isolate* isolate = CcTest::InitIsolateOnce();
392 Factory* factory = isolate->factory(); 392 Factory* factory = isolate->factory();
393 const int kMaxParams = 10; 393 const int kMaxParams = 10;
394 CHECK_LE(num_args, kMaxParams); 394 CHECK_LE(num_args, kMaxParams);
395 CHECK_LE(num_params, kMaxParams); 395 CHECK_LE(num_params, kMaxParams);
396 LocalType type = kAstF64; 396 ValueType type = kWasmF64;
397 LocalType types[kMaxParams + 1] = {type, type, type, type, type, type, 397 ValueType types[kMaxParams + 1] = {type, type, type, type, type, type,
398 type, type, type, type, type}; 398 type, type, type, type, type};
399 FunctionSig sig(1, num_params, types); 399 FunctionSig sig(1, num_params, types);
400 i::AccountingAllocator allocator; 400 i::AccountingAllocator allocator;
401 Zone zone(&allocator, ZONE_NAME); 401 Zone zone(&allocator, ZONE_NAME);
402 402
403 // Build the calling code. 403 // Build the calling code.
404 std::vector<byte> code; 404 std::vector<byte> code;
405 405
406 for (int i = 0; i < num_params; i++) { 406 for (int i = 0; i < num_params; i++) {
407 ADD_CODE(code, WASM_GET_LOCAL(i)); 407 ADD_CODE(code, WASM_GET_LOCAL(i));
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 RunJSSelectAlignTest(9, 9); 496 RunJSSelectAlignTest(9, 9);
497 } 497 }
498 498
499 TEST(Run_JSSelectAlign_10) { 499 TEST(Run_JSSelectAlign_10) {
500 CcTest::InitializeVM(); 500 CcTest::InitializeVM();
501 RunJSSelectAlignTest(10, 7); 501 RunJSSelectAlignTest(10, 7);
502 RunJSSelectAlignTest(10, 8); 502 RunJSSelectAlignTest(10, 8);
503 RunJSSelectAlignTest(10, 9); 503 RunJSSelectAlignTest(10, 9);
504 RunJSSelectAlignTest(10, 10); 504 RunJSSelectAlignTest(10, 10);
505 } 505 }
OLDNEW
« no previous file with comments | « test/cctest/wasm/test-run-wasm-64.cc ('k') | test/cctest/wasm/test-run-wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698