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

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

Issue 2670673002: [wasm] Implement polymorphic checking, matching the reference interpreter. (Closed)
Patch Set: Created 3 years, 10 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 | « src/wasm/wasm-opcodes.h ('k') | test/cctest/wasm/test-run-wasm-simd.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/platform/elapsed-timer.h" 9 #include "src/base/platform/elapsed-timer.h"
10 #include "src/utils.h" 10 #include "src/utils.h"
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 WASM_EXEC_TEST(Return12) { 720 WASM_EXEC_TEST(Return12) {
721 WasmRunner<int32_t> r(execution_mode); 721 WasmRunner<int32_t> r(execution_mode);
722 722
723 BUILD(r, RET_I8(12)); 723 BUILD(r, RET_I8(12));
724 CHECK_EQ(12, r.Call()); 724 CHECK_EQ(12, r.Call());
725 } 725 }
726 726
727 WASM_EXEC_TEST(Return17) { 727 WASM_EXEC_TEST(Return17) {
728 WasmRunner<int32_t> r(execution_mode); 728 WasmRunner<int32_t> r(execution_mode);
729 729
730 BUILD(r, WASM_BLOCK(RET_I8(17))); 730 BUILD(r, WASM_BLOCK(RET_I8(17)), WASM_ZERO);
731 CHECK_EQ(17, r.Call()); 731 CHECK_EQ(17, r.Call());
732 } 732 }
733 733
734 WASM_EXEC_TEST(Return_I32) { 734 WASM_EXEC_TEST(Return_I32) {
735 WasmRunner<int32_t, int32_t> r(execution_mode); 735 WasmRunner<int32_t, int32_t> r(execution_mode);
736 736
737 BUILD(r, RET(WASM_GET_LOCAL(0))); 737 BUILD(r, RET(WASM_GET_LOCAL(0)));
738 738
739 FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } 739 FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
740 } 740 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 WASM_EXEC_TEST(BrIf_strict) { 829 WASM_EXEC_TEST(BrIf_strict) {
830 WasmRunner<int32_t, int32_t> r(execution_mode); 830 WasmRunner<int32_t, int32_t> r(execution_mode);
831 BUILD(r, WASM_BLOCK_I(WASM_BRV_IF(0, WASM_GET_LOCAL(0), 831 BUILD(r, WASM_BLOCK_I(WASM_BRV_IF(0, WASM_GET_LOCAL(0),
832 WASM_TEE_LOCAL(0, WASM_I32V_2(99))))); 832 WASM_TEE_LOCAL(0, WASM_I32V_2(99)))));
833 833
834 FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } 834 FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
835 } 835 }
836 836
837 WASM_EXEC_TEST(Br_height) { 837 WASM_EXEC_TEST(Br_height) {
838 WasmRunner<int32_t, int32_t> r(execution_mode); 838 WasmRunner<int32_t, int32_t> r(execution_mode);
839 BUILD(r, WASM_BLOCK_I(WASM_BLOCK_I(WASM_BRV_IFD(0, WASM_GET_LOCAL(0), 839 BUILD(r, WASM_BLOCK_I(
840 WASM_GET_LOCAL(0)), 840 WASM_BLOCK(WASM_BRV_IFD(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)),
841 WASM_RETURN1(WASM_I32V_1(9)), 841 WASM_RETURN1(WASM_I32V_1(9))),
842 WASM_I32V_1(7), WASM_I32V_1(7)), 842 WASM_BRV(0, WASM_I32V_1(8))));
843 WASM_BRV(0, WASM_I32V_1(8))));
844 843
845 for (int32_t i = 0; i < 5; i++) { 844 for (int32_t i = 0; i < 5; i++) {
846 int32_t expected = i != 0 ? 8 : 9; 845 int32_t expected = i != 0 ? 8 : 9;
847 CHECK_EQ(expected, r.Call(i)); 846 CHECK_EQ(expected, r.Call(i));
848 } 847 }
849 } 848 }
850 849
851 WASM_EXEC_TEST(Regression_660262) { 850 WASM_EXEC_TEST(Regression_660262) {
852 WasmRunner<int32_t> r(execution_mode); 851 WasmRunner<int32_t> r(execution_mode);
853 r.module().AddMemoryElems<int32_t>(8); 852 r.module().AddMemoryElems<int32_t>(8);
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 CHECK_EQ(expected, r.Call(*i)); 1269 CHECK_EQ(expected, r.Call(*i));
1271 } 1270 }
1272 } 1271 }
1273 1272
1274 WASM_EXEC_TEST(Block_IfElse_P_return) { 1273 WASM_EXEC_TEST(Block_IfElse_P_return) {
1275 WasmRunner<int32_t, int32_t> r(execution_mode); 1274 WasmRunner<int32_t, int32_t> r(execution_mode);
1276 // if (p0) return 81; else return 82; 1275 // if (p0) return 81; else return 82;
1277 BUILD(r, // -- 1276 BUILD(r, // --
1278 WASM_IF_ELSE(WASM_GET_LOCAL(0), // -- 1277 WASM_IF_ELSE(WASM_GET_LOCAL(0), // --
1279 RET_I8(81), // -- 1278 RET_I8(81), // --
1280 RET_I8(82))); // -- 1279 RET_I8(82)), // --
1280 WASM_ZERO); // --
1281 FOR_INT32_INPUTS(i) { 1281 FOR_INT32_INPUTS(i) {
1282 int32_t expected = *i ? 81 : 82; 1282 int32_t expected = *i ? 81 : 82;
1283 CHECK_EQ(expected, r.Call(*i)); 1283 CHECK_EQ(expected, r.Call(*i));
1284 } 1284 }
1285 } 1285 }
1286 1286
1287 WASM_EXEC_TEST(Block_If_P_assign) { 1287 WASM_EXEC_TEST(Block_If_P_assign) {
1288 WasmRunner<int32_t, int32_t> r(execution_mode); 1288 WasmRunner<int32_t, int32_t> r(execution_mode);
1289 // { if (p0) p0 = 61; p0; } 1289 // { if (p0) p0 = 61; p0; }
1290 BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I32V_1(61))), 1290 BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I32V_1(61))),
1291 WASM_GET_LOCAL(0)); 1291 WASM_GET_LOCAL(0));
1292 FOR_INT32_INPUTS(i) { 1292 FOR_INT32_INPUTS(i) {
1293 int32_t expected = *i ? 61 : *i; 1293 int32_t expected = *i ? 61 : *i;
1294 CHECK_EQ(expected, r.Call(*i)); 1294 CHECK_EQ(expected, r.Call(*i));
1295 } 1295 }
1296 } 1296 }
1297 1297
1298 WASM_EXEC_TEST(DanglingAssign) { 1298 // WASM_EXEC_TEST(DanglingAssign) {
1299 WasmRunner<int32_t, int32_t> r(execution_mode); 1299 // WasmRunner<int32_t, int32_t> r(execution_mode);
1300 // { return 0; p0 = 0; } 1300 // // { return 0; p0 = 0; }
1301 BUILD(r, B2(RET_I8(99), WASM_SET_LOCAL(0, WASM_ZERO))); 1301 // BUILD(r, B2(RET_I8(99), WASM_SET_LOCAL(0, WASM_ZERO)));
bradnelson 2017/02/02 01:55:09 Why?
titzer 2017/02/02 06:50:25 Disabled these tests because this CL was based on
1302 CHECK_EQ(99, r.Call(1)); 1302 // CHECK_EQ(99, r.Call(1));
1303 } 1303 //}
1304 1304
1305 WASM_EXEC_TEST(ExprIf_P) { 1305 WASM_EXEC_TEST(ExprIf_P) {
1306 WasmRunner<int32_t, int32_t> r(execution_mode); 1306 WasmRunner<int32_t, int32_t> r(execution_mode);
1307 // p0 ? 11 : 22; 1307 // p0 ? 11 : 22;
1308 BUILD(r, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), // -- 1308 BUILD(r, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), // --
1309 WASM_I32V_1(11), // -- 1309 WASM_I32V_1(11), // --
1310 WASM_I32V_1(22))); // -- 1310 WASM_I32V_1(22))); // --
1311 FOR_INT32_INPUTS(i) { 1311 FOR_INT32_INPUTS(i) {
1312 int32_t expected = *i ? 11 : 22; 1312 int32_t expected = *i ? 11 : 22;
1313 CHECK_EQ(expected, r.Call(*i)); 1313 CHECK_EQ(expected, r.Call(*i));
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 WasmRunner<int32_t, int32_t> r(execution_mode); 1388 WasmRunner<int32_t, int32_t> r(execution_mode);
1389 BUILD(r, B1(B1(WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BR(2)), 1389 BUILD(r, B1(B1(WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BR(2)),
1390 WASM_SET_LOCAL(0, WASM_I32V_2(93))))), 1390 WASM_SET_LOCAL(0, WASM_I32V_2(93))))),
1391 WASM_GET_LOCAL(0)); 1391 WASM_GET_LOCAL(0));
1392 CHECK_EQ(93, r.Call(0)); 1392 CHECK_EQ(93, r.Call(0));
1393 CHECK_EQ(3, r.Call(3)); 1393 CHECK_EQ(3, r.Call(3));
1394 CHECK_EQ(10001, r.Call(10001)); 1394 CHECK_EQ(10001, r.Call(10001));
1395 CHECK_EQ(-22, r.Call(-22)); 1395 CHECK_EQ(-22, r.Call(-22));
1396 } 1396 }
1397 1397
1398 WASM_EXEC_TEST(IfBreak1) { 1398 // WASM_EXEC_TEST(IfBreak1) {
1399 WasmRunner<int32_t, int32_t> r(execution_mode); 1399 // WasmRunner<int32_t, int32_t> r(execution_mode);
1400 BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_BR(0), WASM_UNREACHABLE)), 1400 // BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_BR(0), WASM_UNREACHABLE)),
1401 WASM_I32V_2(91)); 1401 // WASM_I32V_2(91));
1402 CHECK_EQ(91, r.Call(0)); 1402 // CHECK_EQ(91, r.Call(0));
1403 CHECK_EQ(91, r.Call(1)); 1403 // CHECK_EQ(91, r.Call(1));
1404 CHECK_EQ(91, r.Call(-8734)); 1404 // CHECK_EQ(91, r.Call(-8734));
1405 } 1405 //}
1406 1406
1407 WASM_EXEC_TEST(IfBreak2) { 1407 // WASM_EXEC_TEST(IfBreak2) {
1408 WasmRunner<int32_t, int32_t> r(execution_mode); 1408 // WasmRunner<int32_t, int32_t> r(execution_mode);
1409 BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_BR(0), RET_I8(77))), 1409 // BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_BR(0), RET_I8(77))),
1410 WASM_I32V_2(81)); 1410 // WASM_I32V_2(81));
1411 CHECK_EQ(81, r.Call(0)); 1411 // CHECK_EQ(81, r.Call(0));
1412 CHECK_EQ(81, r.Call(1)); 1412 // CHECK_EQ(81, r.Call(1));
1413 CHECK_EQ(81, r.Call(-8734)); 1413 // CHECK_EQ(81, r.Call(-8734));
1414 } 1414 //}
1415 1415
1416 WASM_EXEC_TEST(LoadMemI32) { 1416 WASM_EXEC_TEST(LoadMemI32) {
1417 WasmRunner<int32_t, int32_t> r(execution_mode); 1417 WasmRunner<int32_t, int32_t> r(execution_mode);
1418 int32_t* memory = r.module().AddMemoryElems<int32_t>(8); 1418 int32_t* memory = r.module().AddMemoryElems<int32_t>(8);
1419 r.module().RandomizeMemory(1111); 1419 r.module().RandomizeMemory(1111);
1420 1420
1421 BUILD(r, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)); 1421 BUILD(r, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO));
1422 1422
1423 r.module().WriteMemory(&memory[0], 99999999); 1423 r.module().WriteMemory(&memory[0], 99999999);
1424 CHECK_EQ(99999999, r.Call(0)); 1424 CHECK_EQ(99999999, r.Call(0));
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 double buffer[kSize] = {1, 2, 2, 2, 2, 2}; 1757 double buffer[kSize] = {1, 2, 2, 2, 2, 2};
1758 double result = 1758 double result =
1759 GenerateAndRunFold<double>(execution_mode, kExprF64Mul, buffer, kSize, 1759 GenerateAndRunFold<double>(execution_mode, kExprF64Mul, buffer, kSize,
1760 kWasmF64, MachineType::Float64()); 1760 kWasmF64, MachineType::Float64());
1761 CHECK_EQ(32, result); 1761 CHECK_EQ(32, result);
1762 } 1762 }
1763 1763
1764 WASM_EXEC_TEST(Build_Wasm_Infinite_Loop) { 1764 WASM_EXEC_TEST(Build_Wasm_Infinite_Loop) {
1765 WasmRunner<int32_t, int32_t> r(execution_mode); 1765 WasmRunner<int32_t, int32_t> r(execution_mode);
1766 // Only build the graph and compile, don't run. 1766 // Only build the graph and compile, don't run.
1767 BUILD(r, WASM_INFINITE_LOOP); 1767 BUILD(r, WASM_INFINITE_LOOP, WASM_ZERO);
1768 } 1768 }
1769 1769
1770 WASM_EXEC_TEST(Build_Wasm_Infinite_Loop_effect) { 1770 WASM_EXEC_TEST(Build_Wasm_Infinite_Loop_effect) {
1771 WasmRunner<int32_t, int32_t> r(execution_mode); 1771 WasmRunner<int32_t, int32_t> r(execution_mode);
1772 r.module().AddMemoryElems<int8_t>(16); 1772 r.module().AddMemoryElems<int8_t>(16);
1773 1773
1774 // Only build the graph and compile, don't run. 1774 // Only build the graph and compile, don't run.
1775 BUILD(r, WASM_LOOP(WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO), WASM_DROP), 1775 BUILD(r, WASM_LOOP(WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO), WASM_DROP),
1776 WASM_ZERO); 1776 WASM_ZERO);
1777 } 1777 }
1778 1778
1779 WASM_EXEC_TEST(Unreachable0a) { 1779 // WASM_EXEC_TEST(Unreachable0a) {
1780 WasmRunner<int32_t, int32_t> r(execution_mode); 1780 // WasmRunner<int32_t, int32_t> r(execution_mode);
1781 BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_I32V_1(9)), RET(WASM_GET_LOCAL(0)))); 1781 // BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_I32V_1(9)), RET(WASM_GET_LOCAL(0))));
1782 CHECK_EQ(9, r.Call(0)); 1782 // CHECK_EQ(9, r.Call(0));
bradnelson 2017/02/02 01:55:09 Why?
titzer 2017/02/02 06:50:25 Ditto.
1783 CHECK_EQ(9, r.Call(1)); 1783 // CHECK_EQ(9, r.Call(1));
1784 } 1784 //}
1785 1785
1786 WASM_EXEC_TEST(Unreachable0b) { 1786 // WASM_EXEC_TEST(Unreachable0b) {
1787 WasmRunner<int32_t, int32_t> r(execution_mode); 1787 // WasmRunner<int32_t, int32_t> r(execution_mode);
1788 BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_I32V_1(7)), WASM_UNREACHABLE)); 1788 // BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_I32V_1(7)), WASM_UNREACHABLE));
1789 CHECK_EQ(7, r.Call(0)); 1789 // CHECK_EQ(7, r.Call(0));
1790 CHECK_EQ(7, r.Call(1)); 1790 // CHECK_EQ(7, r.Call(1));
1791 } 1791 //}
1792 1792
1793 TEST(Build_Wasm_Unreachable1) { 1793 TEST(Build_Wasm_Unreachable1) {
1794 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); 1794 WasmRunner<int32_t, int32_t> r(kExecuteCompiled);
1795 BUILD(r, WASM_UNREACHABLE); 1795 BUILD(r, WASM_UNREACHABLE);
1796 } 1796 }
1797 1797
1798 TEST(Build_Wasm_Unreachable2) { 1798 // TEST(Build_Wasm_Unreachable2) {
1799 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); 1799 // WasmRunner<int32_t, int32_t> r(kExecuteCompiled);
1800 BUILD(r, WASM_UNREACHABLE, WASM_UNREACHABLE); 1800 // BUILD(r, WASM_UNREACHABLE, WASM_UNREACHABLE);
1801 } 1801 //}
1802 1802
1803 TEST(Build_Wasm_Unreachable3) { 1803 // TEST(Build_Wasm_Unreachable3) {
1804 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); 1804 // WasmRunner<int32_t, int32_t> r(kExecuteCompiled);
1805 BUILD(r, WASM_UNREACHABLE, WASM_UNREACHABLE, WASM_UNREACHABLE); 1805 // BUILD(r, WASM_UNREACHABLE, WASM_UNREACHABLE, WASM_UNREACHABLE);
1806 } 1806 //}
1807 1807
1808 TEST(Build_Wasm_UnreachableIf1) { 1808 // TEST(Build_Wasm_UnreachableIf1) {
1809 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); 1809 // WasmRunner<int32_t, int32_t> r(kExecuteCompiled);
1810 BUILD(r, WASM_UNREACHABLE, WASM_IF(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0))); 1810 // BUILD(r, WASM_UNREACHABLE, WASM_IF(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
1811 } 1811 //}
1812 1812
1813 TEST(Build_Wasm_UnreachableIf2) { 1813 // TEST(Build_Wasm_UnreachableIf2) {
1814 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); 1814 // WasmRunner<int32_t, int32_t> r(kExecuteCompiled);
1815 BUILD(r, WASM_UNREACHABLE, 1815 // BUILD(r, WASM_UNREACHABLE,
1816 WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_UNREACHABLE)); 1816 // WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_UNREACHABLE));
1817 } 1817 //}
1818 1818
1819 WASM_EXEC_TEST(Unreachable_Load) { 1819 // WASM_EXEC_TEST(Unreachable_Load) {
1820 WasmRunner<int32_t, int32_t> r(execution_mode); 1820 // WasmRunner<int32_t, int32_t> r(execution_mode);
1821 r.module().AddMemory(0L); 1821 // BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0)),
1822 BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0)), 1822 // WASM_LOAD_MEM(MachineType::Int8(),
1823 WASM_LOAD_MEM(MachineType::Int8(), WASM_GET_LOCAL(0)))); 1823 // WASM_GET_LOCAL(0))));
1824 CHECK_EQ(11, r.Call(11)); 1824 // CHECK_EQ(11, r.Call(11));
1825 CHECK_EQ(21, r.Call(21)); 1825 // CHECK_EQ(21, r.Call(21));
1826 //}
1827
1828 WASM_EXEC_TEST(BrV_Fallthrough) {
1829 WasmRunner<int32_t> r(execution_mode);
1830 BUILD(r, WASM_BLOCK_I(WASM_BLOCK(WASM_BRV(1, WASM_I32V_1(42))),
1831 WASM_I32V_1(22)));
1832 CHECK_EQ(42, r.Call());
1826 } 1833 }
1827 1834
1828 WASM_EXEC_TEST(Infinite_Loop_not_taken1) { 1835 WASM_EXEC_TEST(Infinite_Loop_not_taken1) {
1829 WasmRunner<int32_t, int32_t> r(execution_mode); 1836 WasmRunner<int32_t, int32_t> r(execution_mode);
1830 BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_INFINITE_LOOP), WASM_I32V_1(45)); 1837 BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_INFINITE_LOOP), WASM_I32V_1(45));
1831 // Run the code, but don't go into the infinite loop. 1838 // Run the code, but don't go into the infinite loop.
1832 CHECK_EQ(45, r.Call(0)); 1839 CHECK_EQ(45, r.Call(0));
1833 } 1840 }
1834 1841
1835 WASM_EXEC_TEST(Infinite_Loop_not_taken2) { 1842 WASM_EXEC_TEST(Infinite_Loop_not_taken2) {
1836 WasmRunner<int32_t, int32_t> r(execution_mode); 1843 WasmRunner<int32_t, int32_t> r(execution_mode);
1837 BUILD(r, WASM_BLOCK_I(WASM_IF_ELSE(WASM_GET_LOCAL(0), 1844 BUILD(r, WASM_BLOCK_I(
1838 WASM_BRV(1, WASM_I32V_1(45)), 1845 WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I32V_1(45)),
1839 WASM_INFINITE_LOOP))); 1846 WASM_INFINITE_LOOP),
1847 WASM_ZERO));
1840 // Run the code, but don't go into the infinite loop. 1848 // Run the code, but don't go into the infinite loop.
1841 CHECK_EQ(45, r.Call(1)); 1849 CHECK_EQ(45, r.Call(1));
1842 } 1850 }
1843 1851
1844 WASM_EXEC_TEST(Infinite_Loop_not_taken2_brif) { 1852 WASM_EXEC_TEST(Infinite_Loop_not_taken2_brif) {
1845 WasmRunner<int32_t, int32_t> r(execution_mode); 1853 WasmRunner<int32_t, int32_t> r(execution_mode);
1846 BUILD(r, WASM_BLOCK_I(WASM_BRV_IF(0, WASM_I32V_1(45), WASM_GET_LOCAL(0)), 1854 BUILD(r, WASM_BLOCK_I(WASM_BRV_IF(0, WASM_I32V_1(45), WASM_GET_LOCAL(0)),
1847 WASM_INFINITE_LOOP)); 1855 WASM_INFINITE_LOOP));
1848 // Run the code, but don't go into the infinite loop. 1856 // Run the code, but don't go into the infinite loop.
1849 CHECK_EQ(45, r.Call(1)); 1857 CHECK_EQ(45, r.Call(1));
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
2876 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, 2884 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP,
2877 WASM_ZERO); 2885 WASM_ZERO);
2878 const int32_t kMin = std::numeric_limits<int32_t>::min(); 2886 const int32_t kMin = std::numeric_limits<int32_t>::min();
2879 CHECK_EQ(0, r.Call(133, 100)); 2887 CHECK_EQ(0, r.Call(133, 100));
2880 CHECK_EQ(0, r.Call(kMin, -1)); 2888 CHECK_EQ(0, r.Call(kMin, -1));
2881 CHECK_EQ(0, r.Call(0, 1)); 2889 CHECK_EQ(0, r.Call(0, 1));
2882 CHECK_TRAP(r.Call(100, 0)); 2890 CHECK_TRAP(r.Call(100, 0));
2883 CHECK_TRAP(r.Call(-1001, 0)); 2891 CHECK_TRAP(r.Call(-1001, 0));
2884 CHECK_TRAP(r.Call(kMin, 0)); 2892 CHECK_TRAP(r.Call(kMin, 0));
2885 } 2893 }
OLDNEW
« no previous file with comments | « src/wasm/wasm-opcodes.h ('k') | test/cctest/wasm/test-run-wasm-simd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698