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

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

Issue 2230063002: [wasm] Experimental: Add support for multiple non-homogeneous tables Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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-interpreter.cc ('k') | test/cctest/wasm/test-signatures.h » ('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"
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), false); \
26 } while (false)
27
28 #define BUILD_FAIL(r, ...) \
29 do { \
30 byte code[] = {__VA_ARGS__}; \
31 r.Build(code, code + arraysize(code), true); \
26 } while (false) 32 } while (false)
27 33
28 #define ADD_CODE(vec, ...) \ 34 #define ADD_CODE(vec, ...) \
29 do { \ 35 do { \
30 byte __buf[] = {__VA_ARGS__}; \ 36 byte __buf[] = {__VA_ARGS__}; \
31 for (size_t i = 0; i < sizeof(__buf); i++) vec.push_back(__buf[i]); \ 37 for (size_t i = 0; i < sizeof(__buf); i++) vec.push_back(__buf[i]); \
32 } while (false) 38 } while (false)
33 39
34 namespace { 40 namespace {
35 // A helper for generating predictable but unique argument values that 41 // A helper for generating predictable but unique argument values that
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 181
176 for (int i = 0; i < num_params; i++) { 182 for (int i = 0; i < num_params; i++) {
177 ADD_CODE(code, WASM_F64(inputs.arg_d(i))); 183 ADD_CODE(code, WASM_F64(inputs.arg_d(i)));
178 } 184 }
179 185
180 ADD_CODE(code, kExprCallFunction, static_cast<byte>(num_params), 186 ADD_CODE(code, kExprCallFunction, static_cast<byte>(num_params),
181 static_cast<byte>(js_index)); 187 static_cast<byte>(js_index));
182 188
183 size_t end = code.size(); 189 size_t end = code.size();
184 code.push_back(0); 190 code.push_back(0);
185 t.Build(&code[0], &code[end]); 191 t.Build(&code[0], &code[end], false);
186 } 192 }
187 193
188 Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); 194 Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd());
189 double expected = inputs.arg_d(which); 195 double expected = inputs.arg_d(which);
190 EXPECT_CALL(expected, jsfunc, 0.0, 0.0); 196 EXPECT_CALL(expected, jsfunc, 0.0, 0.0);
191 } 197 }
192 } 198 }
193 199
194 TEST(Run_JSSelect_0) { RunJSSelectTest(0); } 200 TEST(Run_JSSelect_0) { RunJSSelectTest(0); }
195 201
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 size_t end = code.size(); 369 size_t end = code.size();
364 code.push_back(0); 370 code.push_back(0);
365 371
366 // Call different select JS functions. 372 // Call different select JS functions.
367 for (int which = 0; which < num_params; which++) { 373 for (int which = 0; which < num_params; which++) {
368 HandleScope scope(isolate); 374 HandleScope scope(isolate);
369 TestingModule module; 375 TestingModule module;
370 uint32_t js_index = AddJSSelector(&module, &sig, which); 376 uint32_t js_index = AddJSSelector(&module, &sig, which);
371 CHECK_EQ(0, js_index); 377 CHECK_EQ(0, js_index);
372 WasmFunctionCompiler t(&sig, &module); 378 WasmFunctionCompiler t(&sig, &module);
373 t.Build(&code[0], &code[end]); 379 t.Build(&code[0], &code[end], false);
374 380
375 Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); 381 Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd());
376 382
377 Handle<Object> args[] = { 383 Handle<Object> args[] = {
378 factory->NewNumber(inputs.arg_d(0)), 384 factory->NewNumber(inputs.arg_d(0)),
379 factory->NewNumber(inputs.arg_d(1)), 385 factory->NewNumber(inputs.arg_d(1)),
380 factory->NewNumber(inputs.arg_d(2)), 386 factory->NewNumber(inputs.arg_d(2)),
381 factory->NewNumber(inputs.arg_d(3)), 387 factory->NewNumber(inputs.arg_d(3)),
382 factory->NewNumber(inputs.arg_d(4)), 388 factory->NewNumber(inputs.arg_d(4)),
383 factory->NewNumber(inputs.arg_d(5)), 389 factory->NewNumber(inputs.arg_d(5)),
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 RunJSSelectAlignTest(9, 8); 444 RunJSSelectAlignTest(9, 8);
439 RunJSSelectAlignTest(9, 9); 445 RunJSSelectAlignTest(9, 9);
440 } 446 }
441 447
442 TEST(Run_JSSelectAlign_10) { 448 TEST(Run_JSSelectAlign_10) {
443 RunJSSelectAlignTest(10, 7); 449 RunJSSelectAlignTest(10, 7);
444 RunJSSelectAlignTest(10, 8); 450 RunJSSelectAlignTest(10, 8);
445 RunJSSelectAlignTest(10, 9); 451 RunJSSelectAlignTest(10, 9);
446 RunJSSelectAlignTest(10, 10); 452 RunJSSelectAlignTest(10, 10);
447 } 453 }
OLDNEW
« no previous file with comments | « test/cctest/wasm/test-run-wasm-interpreter.cc ('k') | test/cctest/wasm/test-signatures.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698