| 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 <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 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 CHECK_EQ(expected, r.Call()); | 1249 CHECK_EQ(expected, r.Call()); |
| 1250 } | 1250 } |
| 1251 } | 1251 } |
| 1252 | 1252 |
| 1253 WASM_EXEC_TEST(F64ReinterpretI64) { | 1253 WASM_EXEC_TEST(F64ReinterpretI64) { |
| 1254 REQUIRE(F64ReinterpretI64); | 1254 REQUIRE(F64ReinterpretI64); |
| 1255 TestingModule module(execution_mode); | 1255 TestingModule module(execution_mode); |
| 1256 int64_t* memory = module.AddMemoryElems<int64_t>(8); | 1256 int64_t* memory = module.AddMemoryElems<int64_t>(8); |
| 1257 WasmRunner<int64_t> r(&module, MachineType::Int64()); | 1257 WasmRunner<int64_t> r(&module, MachineType::Int64()); |
| 1258 | 1258 |
| 1259 BUILD(r, WASM_BLOCK( | 1259 BUILD(r, |
| 1260 2, WASM_STORE_MEM(MachineType::Float64(), WASM_ZERO, | 1260 WASM_BLOCK(WASM_STORE_MEM(MachineType::Float64(), WASM_ZERO, |
| 1261 WASM_F64_REINTERPRET_I64(WASM_GET_LOCAL(0))), | 1261 WASM_F64_REINTERPRET_I64(WASM_GET_LOCAL(0))), |
| 1262 WASM_GET_LOCAL(0))); | 1262 WASM_GET_LOCAL(0))); |
| 1263 | 1263 |
| 1264 FOR_INT32_INPUTS(i) { | 1264 FOR_INT32_INPUTS(i) { |
| 1265 int64_t expected = static_cast<int64_t>(*i) * 0x300010001; | 1265 int64_t expected = static_cast<int64_t>(*i) * 0x300010001; |
| 1266 CHECK_EQ(expected, r.Call(expected)); | 1266 CHECK_EQ(expected, r.Call(expected)); |
| 1267 CHECK_EQ(expected, module.ReadMemory<int64_t>(&memory[0])); | 1267 CHECK_EQ(expected, module.ReadMemory<int64_t>(&memory[0])); |
| 1268 } | 1268 } |
| 1269 } | 1269 } |
| 1270 | 1270 |
| 1271 WASM_EXEC_TEST(LoadMemI64) { | 1271 WASM_EXEC_TEST(LoadMemI64) { |
| 1272 REQUIRE(I64LoadStore); | 1272 REQUIRE(I64LoadStore); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 REQUIRE(I64LoadStore); | 1313 REQUIRE(I64LoadStore); |
| 1314 REQUIRE(I64Add); | 1314 REQUIRE(I64Add); |
| 1315 REQUIRE(I64Sub); | 1315 REQUIRE(I64Sub); |
| 1316 REQUIRE(I64Phi); | 1316 REQUIRE(I64Phi); |
| 1317 const int kNumElems = 20; | 1317 const int kNumElems = 20; |
| 1318 TestingModule module(execution_mode); | 1318 TestingModule module(execution_mode); |
| 1319 uint64_t* memory = module.AddMemoryElems<uint64_t>(kNumElems); | 1319 uint64_t* memory = module.AddMemoryElems<uint64_t>(kNumElems); |
| 1320 WasmRunner<uint64_t> r(&module, MachineType::Int32()); | 1320 WasmRunner<uint64_t> r(&module, MachineType::Int32()); |
| 1321 const byte kSum = r.AllocateLocal(kAstI64); | 1321 const byte kSum = r.AllocateLocal(kAstI64); |
| 1322 | 1322 |
| 1323 BUILD(r, WASM_BLOCK( | 1323 BUILD(r, |
| 1324 2, WASM_WHILE( | 1324 WASM_BLOCK( |
| 1325 WASM_GET_LOCAL(0), | 1325 WASM_WHILE( |
| 1326 WASM_BLOCK( | 1326 WASM_GET_LOCAL(0), |
| 1327 2, WASM_SET_LOCAL( | 1327 WASM_BLOCK( |
| 1328 kSum, WASM_I64_ADD( | 1328 WASM_SET_LOCAL( |
| 1329 WASM_GET_LOCAL(kSum), | 1329 kSum, WASM_I64_ADD(WASM_GET_LOCAL(kSum), |
| 1330 WASM_LOAD_MEM(MachineType::Int64(), | 1330 WASM_LOAD_MEM(MachineType::Int64(), |
| 1331 WASM_GET_LOCAL(0)))), | 1331 WASM_GET_LOCAL(0)))), |
| 1332 WASM_SET_LOCAL( | 1332 WASM_SET_LOCAL( |
| 1333 0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(8))))), | 1333 0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(8))))), |
| 1334 WASM_GET_LOCAL(1))); | 1334 WASM_GET_LOCAL(1))); |
| 1335 | 1335 |
| 1336 // Run 4 trials. | 1336 // Run 4 trials. |
| 1337 for (int i = 0; i < 3; i++) { | 1337 for (int i = 0; i < 3; i++) { |
| 1338 module.RandomizeMemory(i * 33); | 1338 module.RandomizeMemory(i * 33); |
| 1339 uint64_t expected = 0; | 1339 uint64_t expected = 0; |
| 1340 for (size_t j = kNumElems - 1; j > 0; j--) { | 1340 for (size_t j = kNumElems - 1; j > 0; j--) { |
| 1341 expected += module.ReadMemory(&memory[j]); | 1341 expected += module.ReadMemory(&memory[j]); |
| 1342 } | 1342 } |
| 1343 uint64_t result = r.Call(8 * (kNumElems - 1)); | 1343 uint64_t result = r.Call(8 * (kNumElems - 1)); |
| 1344 CHECK_EQ(expected, result); | 1344 CHECK_EQ(expected, result); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 CHECK_EQ(expected, result); | 1566 CHECK_EQ(expected, result); |
| 1567 } | 1567 } |
| 1568 } | 1568 } |
| 1569 } | 1569 } |
| 1570 } | 1570 } |
| 1571 | 1571 |
| 1572 WASM_EXEC_TEST(MixedCall_i64_0) { Run_WasmMixedCall_N(execution_mode, 0); } | 1572 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); } | 1573 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); } | 1574 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); } | 1575 WASM_EXEC_TEST(MixedCall_i64_3) { Run_WasmMixedCall_N(execution_mode, 3); } |
| OLD | NEW |