| 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 14 matching lines...) Expand all  Loading... | 
| 25   CHECK_EQ(0xdeadbeef, (bit_cast<uint32_t>(x)) & 0xFFFFFFFF) | 25   CHECK_EQ(0xdeadbeef, (bit_cast<uint32_t>(x)) & 0xFFFFFFFF) | 
| 26 #define CHECK_TRAP64(x) \ | 26 #define CHECK_TRAP64(x) \ | 
| 27   CHECK_EQ(0xdeadbeefdeadbeef, (bit_cast<uint64_t>(x)) & 0xFFFFFFFFFFFFFFFF) | 27   CHECK_EQ(0xdeadbeefdeadbeef, (bit_cast<uint64_t>(x)) & 0xFFFFFFFFFFFFFFFF) | 
| 28 #define CHECK_TRAP(x) CHECK_TRAP32(x) | 28 #define CHECK_TRAP(x) CHECK_TRAP32(x) | 
| 29 | 29 | 
| 30 #define asi64(x) static_cast<int64_t>(x) | 30 #define asi64(x) static_cast<int64_t>(x) | 
| 31 | 31 | 
| 32 #define asu64(x) static_cast<uint64_t>(x) | 32 #define asu64(x) static_cast<uint64_t>(x) | 
| 33 | 33 | 
| 34 #define B2(a, b) kExprBlock, a, b, kExprEnd | 34 #define B2(a, b) kExprBlock, a, b, kExprEnd | 
| 35 #define B1(a) kExprBlock, a, kExprEnd |  | 
| 36 | 35 | 
| 37 // Can't bridge macro land with nested macros. | 36 // Can't bridge macro land with nested macros. | 
| 38 #if V8_TARGET_ARCH_MIPS | 37 #if V8_TARGET_ARCH_MIPS | 
| 39 #define MIPS true | 38 #define MIPS true | 
| 40 #else | 39 #else | 
| 41 #define MIPS false | 40 #define MIPS false | 
| 42 #endif | 41 #endif | 
| 43 | 42 | 
| 44 #define FOREACH_I64_OPERATOR(V) \ | 43 #define FOREACH_I64_OPERATOR(V) \ | 
| 45   V(DepthFirst, true)           \ | 44   V(DepthFirst, true)           \ | 
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 828       continue; | 827       continue; | 
| 829     } else { | 828     } else { | 
| 830       BUILD(t, WASM_GET_LOCAL(i)); | 829       BUILD(t, WASM_GET_LOCAL(i)); | 
| 831     } | 830     } | 
| 832     uint32_t index = t.CompileAndAdd(); | 831     uint32_t index = t.CompileAndAdd(); | 
| 833 | 832 | 
| 834     // Build the calling function. | 833     // Build the calling function. | 
| 835     WasmRunner<int32_t> r(&module); | 834     WasmRunner<int32_t> r(&module); | 
| 836     BUILD( | 835     BUILD( | 
| 837         r, | 836         r, | 
| 838         WASM_I32_CONVERT_I64(WASM_CALL_FUNCTIONN( | 837         WASM_I32_CONVERT_I64(WASM_CALL_FUNCTION( | 
| 839             19, index, WASM_I64V_9(0xbcd12340000000b), | 838             index, WASM_I64V_9(0xbcd12340000000b), | 
| 840             WASM_I64V_9(0xbcd12340000000c), WASM_I32V_1(0xd), | 839             WASM_I64V_9(0xbcd12340000000c), WASM_I32V_1(0xd), | 
| 841             WASM_I32_CONVERT_I64(WASM_I64V_9(0xbcd12340000000e)), | 840             WASM_I32_CONVERT_I64(WASM_I64V_9(0xbcd12340000000e)), | 
| 842             WASM_I64V_9(0xbcd12340000000f), WASM_I64V_10(0xbcd1234000000010), | 841             WASM_I64V_9(0xbcd12340000000f), WASM_I64V_10(0xbcd1234000000010), | 
| 843             WASM_I64V_10(0xbcd1234000000011), WASM_I64V_10(0xbcd1234000000012), | 842             WASM_I64V_10(0xbcd1234000000011), WASM_I64V_10(0xbcd1234000000012), | 
| 844             WASM_I64V_10(0xbcd1234000000013), WASM_I64V_10(0xbcd1234000000014), | 843             WASM_I64V_10(0xbcd1234000000013), WASM_I64V_10(0xbcd1234000000014), | 
| 845             WASM_I64V_10(0xbcd1234000000015), WASM_I64V_10(0xbcd1234000000016), | 844             WASM_I64V_10(0xbcd1234000000015), WASM_I64V_10(0xbcd1234000000016), | 
| 846             WASM_I64V_10(0xbcd1234000000017), WASM_I64V_10(0xbcd1234000000018), | 845             WASM_I64V_10(0xbcd1234000000017), WASM_I64V_10(0xbcd1234000000018), | 
| 847             WASM_I64V_10(0xbcd1234000000019), WASM_I64V_10(0xbcd123400000001a), | 846             WASM_I64V_10(0xbcd1234000000019), WASM_I64V_10(0xbcd123400000001a), | 
| 848             WASM_I64V_10(0xbcd123400000001b), WASM_I64V_10(0xbcd123400000001c), | 847             WASM_I64V_10(0xbcd123400000001b), WASM_I64V_10(0xbcd123400000001c), | 
| 849             WASM_I64V_10(0xbcd123400000001d)))); | 848             WASM_I64V_10(0xbcd123400000001d)))); | 
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1112   REQUIRE(I64Sub); | 1111   REQUIRE(I64Sub); | 
| 1113   // Build the target function. | 1112   // Build the target function. | 
| 1114   TestSignatures sigs; | 1113   TestSignatures sigs; | 
| 1115   TestingModule module(execution_mode); | 1114   TestingModule module(execution_mode); | 
| 1116   WasmFunctionCompiler t(sigs.l_ll(), &module); | 1115   WasmFunctionCompiler t(sigs.l_ll(), &module); | 
| 1117   BUILD(t, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 1116   BUILD(t, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 
| 1118   uint32_t index = t.CompileAndAdd(); | 1117   uint32_t index = t.CompileAndAdd(); | 
| 1119 | 1118 | 
| 1120   // Build the caller function. | 1119   // Build the caller function. | 
| 1121   WasmRunner<int64_t> r(&module, MachineType::Int64(), MachineType::Int64()); | 1120   WasmRunner<int64_t> r(&module, MachineType::Int64(), MachineType::Int64()); | 
| 1122   BUILD(r, WASM_CALL_FUNCTION2(index, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 1121   BUILD(r, WASM_CALL_FUNCTION(index, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 
| 1123 | 1122 | 
| 1124   FOR_INT32_INPUTS(i) { | 1123   FOR_INT32_INPUTS(i) { | 
| 1125     FOR_INT32_INPUTS(j) { | 1124     FOR_INT32_INPUTS(j) { | 
| 1126       int64_t a = static_cast<int64_t>(*i) << 32 | | 1125       int64_t a = static_cast<int64_t>(*i) << 32 | | 
| 1127                   (static_cast<int64_t>(*j) | 0xFFFFFFFF); | 1126                   (static_cast<int64_t>(*j) | 0xFFFFFFFF); | 
| 1128       int64_t b = static_cast<int64_t>(*j) << 32 | | 1127       int64_t b = static_cast<int64_t>(*j) << 32 | | 
| 1129                   (static_cast<int64_t>(*i) | 0xFFFFFFFF); | 1128                   (static_cast<int64_t>(*i) | 0xFFFFFFFF); | 
| 1130 | 1129 | 
| 1131       int64_t expected = static_cast<int64_t>(static_cast<uint64_t>(a) - | 1130       int64_t expected = static_cast<int64_t>(static_cast<uint64_t>(a) - | 
| 1132                                               static_cast<uint64_t>(b)); | 1131                                               static_cast<uint64_t>(b)); | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 1147     WasmRunner<int64_t> r(&module); | 1146     WasmRunner<int64_t> r(&module); | 
| 1148 | 1147 | 
| 1149     byte code[] = { | 1148     byte code[] = { | 
| 1150         kExprI8Const,     8,  // -- | 1149         kExprI8Const,     8,  // -- | 
| 1151         kExprI8Const,     0,  // -- | 1150         kExprI8Const,     0,  // -- | 
| 1152         loads[m],             // -- | 1151         loads[m],             // -- | 
| 1153         ZERO_ALIGNMENT,       // -- | 1152         ZERO_ALIGNMENT,       // -- | 
| 1154         ZERO_OFFSET,          // -- | 1153         ZERO_OFFSET,          // -- | 
| 1155         kExprI64StoreMem,     // -- | 1154         kExprI64StoreMem,     // -- | 
| 1156         ZERO_ALIGNMENT,       // -- | 1155         ZERO_ALIGNMENT,       // -- | 
| 1157         ZERO_OFFSET           // -- | 1156         ZERO_OFFSET,          // -- | 
|  | 1157         kExprI8Const,     0,  // -- | 
|  | 1158         loads[m],             // -- | 
|  | 1159         ZERO_ALIGNMENT,       // -- | 
|  | 1160         ZERO_OFFSET,          // -- | 
| 1158     }; | 1161     }; | 
| 1159 | 1162 | 
| 1160     r.Build(code, code + arraysize(code)); | 1163     r.Build(code, code + arraysize(code)); | 
| 1161 | 1164 | 
| 1162     // Try a bunch of different negative values. | 1165     // Try a bunch of different negative values. | 
| 1163     for (int i = -1; i >= -128; i -= 11) { | 1166     for (int i = -1; i >= -128; i -= 11) { | 
| 1164       int size = 1 << m; | 1167       int size = 1 << m; | 
| 1165       module.BlankMemory(); | 1168       module.BlankMemory(); | 
| 1166       memory[size - 1] = static_cast<byte>(i);  // set the high order byte. | 1169       memory[size - 1] = static_cast<byte>(i);  // set the high order byte. | 
| 1167 | 1170 | 
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1249     CHECK_EQ(expected, r.Call()); | 1252     CHECK_EQ(expected, r.Call()); | 
| 1250   } | 1253   } | 
| 1251 } | 1254 } | 
| 1252 | 1255 | 
| 1253 WASM_EXEC_TEST(F64ReinterpretI64) { | 1256 WASM_EXEC_TEST(F64ReinterpretI64) { | 
| 1254   REQUIRE(F64ReinterpretI64); | 1257   REQUIRE(F64ReinterpretI64); | 
| 1255   TestingModule module(execution_mode); | 1258   TestingModule module(execution_mode); | 
| 1256   int64_t* memory = module.AddMemoryElems<int64_t>(8); | 1259   int64_t* memory = module.AddMemoryElems<int64_t>(8); | 
| 1257   WasmRunner<int64_t> r(&module, MachineType::Int64()); | 1260   WasmRunner<int64_t> r(&module, MachineType::Int64()); | 
| 1258 | 1261 | 
| 1259   BUILD(r, | 1262   BUILD(r, WASM_STORE_MEM(MachineType::Float64(), WASM_ZERO, | 
| 1260         WASM_BLOCK(WASM_STORE_MEM(MachineType::Float64(), WASM_ZERO, | 1263                           WASM_F64_REINTERPRET_I64(WASM_GET_LOCAL(0))), | 
| 1261                                   WASM_F64_REINTERPRET_I64(WASM_GET_LOCAL(0))), | 1264         WASM_GET_LOCAL(0)); | 
| 1262                    WASM_GET_LOCAL(0))); |  | 
| 1263 | 1265 | 
| 1264   FOR_INT32_INPUTS(i) { | 1266   FOR_INT32_INPUTS(i) { | 
| 1265     int64_t expected = static_cast<int64_t>(*i) * 0x300010001; | 1267     int64_t expected = static_cast<int64_t>(*i) * 0x300010001; | 
| 1266     CHECK_EQ(expected, r.Call(expected)); | 1268     CHECK_EQ(expected, r.Call(expected)); | 
| 1267     CHECK_EQ(expected, module.ReadMemory<int64_t>(&memory[0])); | 1269     CHECK_EQ(expected, module.ReadMemory<int64_t>(&memory[0])); | 
| 1268   } | 1270   } | 
| 1269 } | 1271 } | 
| 1270 | 1272 | 
| 1271 WASM_EXEC_TEST(LoadMemI64) { | 1273 WASM_EXEC_TEST(LoadMemI64) { | 
| 1272   REQUIRE(I64LoadStore); | 1274   REQUIRE(I64LoadStore); | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1313   REQUIRE(I64LoadStore); | 1315   REQUIRE(I64LoadStore); | 
| 1314   REQUIRE(I64Add); | 1316   REQUIRE(I64Add); | 
| 1315   REQUIRE(I64Sub); | 1317   REQUIRE(I64Sub); | 
| 1316   REQUIRE(I64Phi); | 1318   REQUIRE(I64Phi); | 
| 1317   const int kNumElems = 20; | 1319   const int kNumElems = 20; | 
| 1318   TestingModule module(execution_mode); | 1320   TestingModule module(execution_mode); | 
| 1319   uint64_t* memory = module.AddMemoryElems<uint64_t>(kNumElems); | 1321   uint64_t* memory = module.AddMemoryElems<uint64_t>(kNumElems); | 
| 1320   WasmRunner<uint64_t> r(&module, MachineType::Int32()); | 1322   WasmRunner<uint64_t> r(&module, MachineType::Int32()); | 
| 1321   const byte kSum = r.AllocateLocal(kAstI64); | 1323   const byte kSum = r.AllocateLocal(kAstI64); | 
| 1322 | 1324 | 
| 1323   BUILD(r, | 1325   BUILD( | 
| 1324         WASM_BLOCK( | 1326       r, | 
| 1325             WASM_WHILE( | 1327       WASM_WHILE( | 
| 1326                 WASM_GET_LOCAL(0), | 1328           WASM_GET_LOCAL(0), | 
| 1327                 WASM_BLOCK( | 1329           WASM_BLOCK( | 
| 1328                     WASM_SET_LOCAL( | 1330               WASM_SET_LOCAL(kSum, | 
| 1329                         kSum, WASM_I64_ADD(WASM_GET_LOCAL(kSum), | 1331                              WASM_I64_ADD(WASM_GET_LOCAL(kSum), | 
| 1330                                            WASM_LOAD_MEM(MachineType::Int64(), | 1332                                           WASM_LOAD_MEM(MachineType::Int64(), | 
| 1331                                                          WASM_GET_LOCAL(0)))), | 1333                                                         WASM_GET_LOCAL(0)))), | 
| 1332                     WASM_SET_LOCAL( | 1334               WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(8))))), | 
| 1333                         0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(8))))), | 1335       WASM_GET_LOCAL(1)); | 
| 1334             WASM_GET_LOCAL(1))); |  | 
| 1335 | 1336 | 
| 1336   // Run 4 trials. | 1337   // Run 4 trials. | 
| 1337   for (int i = 0; i < 3; i++) { | 1338   for (int i = 0; i < 3; i++) { | 
| 1338     module.RandomizeMemory(i * 33); | 1339     module.RandomizeMemory(i * 33); | 
| 1339     uint64_t expected = 0; | 1340     uint64_t expected = 0; | 
| 1340     for (size_t j = kNumElems - 1; j > 0; j--) { | 1341     for (size_t j = kNumElems - 1; j > 0; j--) { | 
| 1341       expected += module.ReadMemory(&memory[j]); | 1342       expected += module.ReadMemory(&memory[j]); | 
| 1342     } | 1343     } | 
| 1343     uint64_t result = r.Call(8 * (kNumElems - 1)); | 1344     uint64_t result = r.Call(8 * (kNumElems - 1)); | 
| 1344     CHECK_EQ(expected, result); | 1345     CHECK_EQ(expected, result); | 
| 1345   } | 1346   } | 
| 1346 } | 1347 } | 
| 1347 | 1348 | 
| 1348 WASM_EXEC_TEST(StoreMemI64_alignment) { | 1349 WASM_EXEC_TEST(StoreMemI64_alignment) { | 
| 1349   TestingModule module(execution_mode); | 1350   TestingModule module(execution_mode); | 
| 1350   int64_t* memory = module.AddMemoryElems<int64_t>(4); | 1351   int64_t* memory = module.AddMemoryElems<int64_t>(4); | 
| 1351   const int64_t kWritten = 0x12345678abcd0011ll; | 1352   const int64_t kWritten = 0x12345678abcd0011ll; | 
| 1352 | 1353 | 
| 1353   for (byte i = 0; i <= 3; i++) { | 1354   for (byte i = 0; i <= 3; i++) { | 
| 1354     WasmRunner<int64_t> r(&module, MachineType::Int64()); | 1355     WasmRunner<int64_t> r(&module, MachineType::Int64()); | 
| 1355     BUILD(r, WASM_STORE_MEM_ALIGNMENT(MachineType::Int64(), WASM_ZERO, i, | 1356     BUILD(r, WASM_STORE_MEM_ALIGNMENT(MachineType::Int64(), WASM_ZERO, i, | 
| 1356                                       WASM_GET_LOCAL(0))); | 1357                                       WASM_GET_LOCAL(0)), | 
|  | 1358           WASM_GET_LOCAL(0)); | 
| 1357     module.RandomizeMemory(1111); | 1359     module.RandomizeMemory(1111); | 
| 1358     module.WriteMemory<int64_t>(&memory[0], 0); | 1360     module.WriteMemory<int64_t>(&memory[0], 0); | 
| 1359 | 1361 | 
| 1360     CHECK_EQ(kWritten, r.Call(kWritten)); | 1362     CHECK_EQ(kWritten, r.Call(kWritten)); | 
| 1361     CHECK_EQ(kWritten, module.ReadMemory(&memory[0])); | 1363     CHECK_EQ(kWritten, module.ReadMemory(&memory[0])); | 
| 1362   } | 1364   } | 
| 1363 } | 1365 } | 
| 1364 | 1366 | 
| 1365 WASM_EXEC_TEST(I64Global) { | 1367 WASM_EXEC_TEST(I64Global) { | 
| 1366   REQUIRE(I64LoadStore); | 1368   REQUIRE(I64LoadStore); | 
| 1367   REQUIRE(I64SConvertI32); | 1369   REQUIRE(I64SConvertI32); | 
| 1368   REQUIRE(I64And); | 1370   REQUIRE(I64And); | 
| 1369   REQUIRE(DepthFirst); | 1371   REQUIRE(DepthFirst); | 
| 1370   TestingModule module(execution_mode); | 1372   TestingModule module(execution_mode); | 
| 1371   int64_t* global = module.AddGlobal<int64_t>(kAstI64); | 1373   int64_t* global = module.AddGlobal<int64_t>(kAstI64); | 
| 1372   WasmRunner<int32_t> r(&module, MachineType::Int32()); | 1374   WasmRunner<int32_t> r(&module, MachineType::Int32()); | 
| 1373   // global = global + p0 | 1375   // global = global + p0 | 
| 1374   BUILD(r, B2(WASM_SET_GLOBAL( | 1376   BUILD(r, WASM_SET_GLOBAL( | 
| 1375                   0, WASM_I64_AND(WASM_GET_GLOBAL(0), | 1377                0, WASM_I64_AND(WASM_GET_GLOBAL(0), | 
| 1376                                   WASM_I64_SCONVERT_I32(WASM_GET_LOCAL(0)))), | 1378                                WASM_I64_SCONVERT_I32(WASM_GET_LOCAL(0)))), | 
| 1377               WASM_ZERO)); | 1379         WASM_ZERO); | 
| 1378 | 1380 | 
| 1379   module.WriteMemory<int64_t>(global, 0xFFFFFFFFFFFFFFFFLL); | 1381   module.WriteMemory<int64_t>(global, 0xFFFFFFFFFFFFFFFFLL); | 
| 1380   for (int i = 9; i < 444444; i += 111111) { | 1382   for (int i = 9; i < 444444; i += 111111) { | 
| 1381     int64_t expected = *global & i; | 1383     int64_t expected = *global & i; | 
| 1382     r.Call(i); | 1384     r.Call(i); | 
| 1383     CHECK_EQ(expected, *global); | 1385     CHECK_EQ(expected, *global); | 
| 1384   } | 1386   } | 
| 1385 } | 1387 } | 
| 1386 | 1388 | 
| 1387 WASM_EXEC_TEST(I64Eqz) { | 1389 WASM_EXEC_TEST(I64Eqz) { | 
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1470     TestingModule module(kExecuteCompiled); | 1472     TestingModule module(kExecuteCompiled); | 
| 1471     FunctionSig* sig = sigs.many(&zone, kAstStmt, param, num_params); | 1473     FunctionSig* sig = sigs.many(&zone, kAstStmt, param, num_params); | 
| 1472 | 1474 | 
| 1473     module.AddSignature(sig); | 1475     module.AddSignature(sig); | 
| 1474     module.AddSignature(sig); | 1476     module.AddSignature(sig); | 
| 1475     module.AddIndirectFunctionTable(nullptr, 0); | 1477     module.AddIndirectFunctionTable(nullptr, 0); | 
| 1476 | 1478 | 
| 1477     WasmFunctionCompiler t(sig, &module); | 1479     WasmFunctionCompiler t(sig, &module); | 
| 1478 | 1480 | 
| 1479     std::vector<byte> code; | 1481     std::vector<byte> code; | 
| 1480     ADD_CODE(code, kExprI8Const, 0); |  | 
| 1481     for (byte p = 0; p < num_params; p++) { | 1482     for (byte p = 0; p < num_params; p++) { | 
| 1482       ADD_CODE(code, kExprGetLocal, p); | 1483       ADD_CODE(code, kExprGetLocal, p); | 
| 1483     } | 1484     } | 
| 1484     ADD_CODE(code, kExprCallIndirect, static_cast<byte>(num_params), 1); | 1485     ADD_CODE(code, kExprI8Const, 0); | 
|  | 1486     ADD_CODE(code, kExprCallIndirect, 1); | 
| 1485 | 1487 | 
| 1486     t.Build(&code[0], &code[0] + code.size()); | 1488     t.Build(&code[0], &code[0] + code.size()); | 
| 1487     t.Compile(); | 1489     t.Compile(); | 
| 1488   } | 1490   } | 
| 1489 } | 1491 } | 
| 1490 | 1492 | 
| 1491 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } | 1493 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } | 
| 1492 | 1494 | 
| 1493 static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) { | 1495 static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) { | 
| 1494   const int kExpected = 6333; | 1496   const int kExpected = 6333; | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1533     // Load the offset for the store. | 1535     // Load the offset for the store. | 
| 1534     ADD_CODE(code, WASM_ZERO); | 1536     ADD_CODE(code, WASM_ZERO); | 
| 1535 | 1537 | 
| 1536     // Load the arguments. | 1538     // Load the arguments. | 
| 1537     for (int i = 0; i < num_params; i++) { | 1539     for (int i = 0; i < num_params; i++) { | 
| 1538       int offset = (i + 1) * kElemSize; | 1540       int offset = (i + 1) * kElemSize; | 
| 1539       ADD_CODE(code, WASM_LOAD_MEM(memtypes[i], WASM_I8(offset))); | 1541       ADD_CODE(code, WASM_LOAD_MEM(memtypes[i], WASM_I8(offset))); | 
| 1540     } | 1542     } | 
| 1541 | 1543 | 
| 1542     // Call the selector function. | 1544     // Call the selector function. | 
| 1543     ADD_CODE(code, kExprCallFunction, static_cast<byte>(num_params), | 1545     ADD_CODE(code, kExprCallFunction, static_cast<byte>(index)); | 
| 1544              static_cast<byte>(index)); |  | 
| 1545 | 1546 | 
| 1546     // Store the result in memory. | 1547     // Store the result in memory. | 
| 1547     ADD_CODE(code, | 1548     ADD_CODE(code, | 
| 1548              static_cast<byte>(WasmOpcodes::LoadStoreOpcodeOf(result, true)), | 1549              static_cast<byte>(WasmOpcodes::LoadStoreOpcodeOf(result, true)), | 
| 1549              ZERO_ALIGNMENT, ZERO_OFFSET); | 1550              ZERO_ALIGNMENT, ZERO_OFFSET); | 
| 1550 | 1551 | 
| 1551     // Return the expected value. | 1552     // Return the expected value. | 
| 1552     ADD_CODE(code, WASM_I32V_2(kExpected)); | 1553     ADD_CODE(code, WASM_I32V_2(kExpected)); | 
| 1553 | 1554 | 
| 1554     r.Build(&code[0], &code[0] + code.size()); | 1555     r.Build(&code[0], &code[0] + code.size()); | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 1566         CHECK_EQ(expected, result); | 1567         CHECK_EQ(expected, result); | 
| 1567       } | 1568       } | 
| 1568     } | 1569     } | 
| 1569   } | 1570   } | 
| 1570 } | 1571 } | 
| 1571 | 1572 | 
| 1572 WASM_EXEC_TEST(MixedCall_i64_0) { Run_WasmMixedCall_N(execution_mode, 0); } | 1573 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); } | 1574 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); } | 1575 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); } | 1576 WASM_EXEC_TEST(MixedCall_i64_3) { Run_WasmMixedCall_N(execution_mode, 3); } | 
| OLD | NEW | 
|---|