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

Side by Side Diff: test/cctest/wasm/test-run-wasm-64.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.cc ('k') | test/cctest/wasm/test-run-wasm-interpreter.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 <stdlib.h> 6 #include <stdlib.h>
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/wasm/wasm-macro-gen.h" 10 #include "src/wasm/wasm-macro-gen.h"
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 kExprI8Const, 8, // -- 1150 kExprI8Const, 8, // --
1151 kExprI8Const, 0, // -- 1151 kExprI8Const, 0, // --
1152 loads[m], // -- 1152 loads[m], // --
1153 ZERO_ALIGNMENT, // -- 1153 ZERO_ALIGNMENT, // --
1154 ZERO_OFFSET, // -- 1154 ZERO_OFFSET, // --
1155 kExprI64StoreMem, // -- 1155 kExprI64StoreMem, // --
1156 ZERO_ALIGNMENT, // -- 1156 ZERO_ALIGNMENT, // --
1157 ZERO_OFFSET // -- 1157 ZERO_OFFSET // --
1158 }; 1158 };
1159 1159
1160 r.Build(code, code + arraysize(code)); 1160 r.Build(code, code + arraysize(code), false);
1161 1161
1162 // Try a bunch of different negative values. 1162 // Try a bunch of different negative values.
1163 for (int i = -1; i >= -128; i -= 11) { 1163 for (int i = -1; i >= -128; i -= 11) {
1164 int size = 1 << m; 1164 int size = 1 << m;
1165 module.BlankMemory(); 1165 module.BlankMemory();
1166 memory[size - 1] = static_cast<byte>(i); // set the high order byte. 1166 memory[size - 1] = static_cast<byte>(i); // set the high order byte.
1167 1167
1168 int64_t expected = static_cast<int64_t>(i) << ((size - 1) * 8); 1168 int64_t expected = static_cast<int64_t>(i) << ((size - 1) * 8);
1169 1169
1170 CHECK_EQ(expected, r.Call()); 1170 CHECK_EQ(expected, r.Call());
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 // Make sure we don't run out of registers when compiling indirect calls 1463 // Make sure we don't run out of registers when compiling indirect calls
1464 // with many many parameters. 1464 // with many many parameters.
1465 TestSignatures sigs; 1465 TestSignatures sigs;
1466 for (byte num_params = 0; num_params < 40; num_params++) { 1466 for (byte num_params = 0; num_params < 40; num_params++) {
1467 v8::base::AccountingAllocator allocator; 1467 v8::base::AccountingAllocator allocator;
1468 Zone zone(&allocator); 1468 Zone zone(&allocator);
1469 HandleScope scope(CcTest::InitIsolateOnce()); 1469 HandleScope scope(CcTest::InitIsolateOnce());
1470 TestingModule module(kExecuteCompiled); 1470 TestingModule module(kExecuteCompiled);
1471 FunctionSig* sig = sigs.many(&zone, kAstStmt, param, num_params); 1471 FunctionSig* sig = sigs.many(&zone, kAstStmt, param, num_params);
1472 1472
1473 module.AddSignature(sig); 1473 byte index = module.AddSignature(sig);
1474 module.AddSignature(sig); 1474 module.AddIndirectFunctionTable(sig, index, nullptr, 0);
1475 module.AddIndirectFunctionTable(nullptr, 0);
1476 1475
1477 WasmFunctionCompiler t(sig, &module); 1476 WasmFunctionCompiler t(sig, &module);
1478 1477
1479 std::vector<byte> code; 1478 std::vector<byte> code;
1480 ADD_CODE(code, kExprI8Const, 0); 1479 ADD_CODE(code, kExprI8Const, 0);
1481 for (byte p = 0; p < num_params; p++) { 1480 for (byte p = 0; p < num_params; p++) {
1482 ADD_CODE(code, kExprGetLocal, p); 1481 ADD_CODE(code, kExprGetLocal, p);
1483 } 1482 }
1484 ADD_CODE(code, kExprCallIndirect, static_cast<byte>(num_params), 1); 1483 ADD_CODE(code, kExprCallIndirect, static_cast<byte>(num_params), index, 0);
1485 1484
1486 t.Build(&code[0], &code[0] + code.size()); 1485 t.Build(&code[0], &code[0] + code.size(), false);
1487 t.Compile(); 1486 t.Compile();
1488 } 1487 }
1489 } 1488 }
1490 1489
1491 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } 1490 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); }
1492 1491
1493 static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) { 1492 static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) {
1494 const int kExpected = 6333; 1493 const int kExpected = 6333;
1495 const int kElemSize = 8; 1494 const int kElemSize = 8;
1496 TestSignatures sigs; 1495 TestSignatures sigs;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 static_cast<byte>(index)); 1543 static_cast<byte>(index));
1545 1544
1546 // Store the result in memory. 1545 // Store the result in memory.
1547 ADD_CODE(code, 1546 ADD_CODE(code,
1548 static_cast<byte>(WasmOpcodes::LoadStoreOpcodeOf(result, true)), 1547 static_cast<byte>(WasmOpcodes::LoadStoreOpcodeOf(result, true)),
1549 ZERO_ALIGNMENT, ZERO_OFFSET); 1548 ZERO_ALIGNMENT, ZERO_OFFSET);
1550 1549
1551 // Return the expected value. 1550 // Return the expected value.
1552 ADD_CODE(code, WASM_I32V_2(kExpected)); 1551 ADD_CODE(code, WASM_I32V_2(kExpected));
1553 1552
1554 r.Build(&code[0], &code[0] + code.size()); 1553 r.Build(&code[0], &code[0] + code.size(), false);
1555 1554
1556 // Run the code. 1555 // Run the code.
1557 for (int t = 0; t < 10; t++) { 1556 for (int t = 0; t < 10; t++) {
1558 module.RandomizeMemory(); 1557 module.RandomizeMemory();
1559 CHECK_EQ(kExpected, r.Call()); 1558 CHECK_EQ(kExpected, r.Call());
1560 1559
1561 int size = WasmOpcodes::MemSize(result); 1560 int size = WasmOpcodes::MemSize(result);
1562 for (int i = 0; i < size; i++) { 1561 for (int i = 0; i < size; i++) {
1563 int base = (which + 1) * kElemSize; 1562 int base = (which + 1) * kElemSize;
1564 byte expected = module.raw_mem_at<byte>(base + i); 1563 byte expected = module.raw_mem_at<byte>(base + i);
1565 byte result = module.raw_mem_at<byte>(i); 1564 byte result = module.raw_mem_at<byte>(i);
1566 CHECK_EQ(expected, result); 1565 CHECK_EQ(expected, result);
1567 } 1566 }
1568 } 1567 }
1569 } 1568 }
1570 } 1569 }
1571 1570
1572 WASM_EXEC_TEST(MixedCall_i64_0) { Run_WasmMixedCall_N(execution_mode, 0); } 1571 WASM_EXEC_TEST(MixedCall_i64_0) { Run_WasmMixedCall_N(execution_mode, 0); }
1573 WASM_EXEC_TEST(MixedCall_i64_1) { Run_WasmMixedCall_N(execution_mode, 1); } 1572 WASM_EXEC_TEST(MixedCall_i64_1) { Run_WasmMixedCall_N(execution_mode, 1); }
1574 WASM_EXEC_TEST(MixedCall_i64_2) { Run_WasmMixedCall_N(execution_mode, 2); } 1573 WASM_EXEC_TEST(MixedCall_i64_2) { Run_WasmMixedCall_N(execution_mode, 2); }
1575 WASM_EXEC_TEST(MixedCall_i64_3) { Run_WasmMixedCall_N(execution_mode, 3); } 1574 WASM_EXEC_TEST(MixedCall_i64_3) { Run_WasmMixedCall_N(execution_mode, 3); }
OLDNEW
« no previous file with comments | « test/cctest/wasm/test-run-wasm.cc ('k') | test/cctest/wasm/test-run-wasm-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698