| 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/platform/elapsed-timer.h" | 9 #include "src/base/platform/elapsed-timer.h" |
| 10 #include "src/utils.h" | 10 #include "src/utils.h" |
| (...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1801 } | 1801 } |
| 1802 | 1802 |
| 1803 TEST(Build_Wasm_UnreachableIf2) { | 1803 TEST(Build_Wasm_UnreachableIf2) { |
| 1804 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); | 1804 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); |
| 1805 BUILD(r, WASM_UNREACHABLE, | 1805 BUILD(r, WASM_UNREACHABLE, |
| 1806 WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_UNREACHABLE)); | 1806 WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_UNREACHABLE)); |
| 1807 } | 1807 } |
| 1808 | 1808 |
| 1809 WASM_EXEC_TEST(Unreachable_Load) { | 1809 WASM_EXEC_TEST(Unreachable_Load) { |
| 1810 WasmRunner<int32_t, int32_t> r(execution_mode); | 1810 WasmRunner<int32_t, int32_t> r(execution_mode); |
| 1811 r.module().AddMemory(0L); |
| 1811 BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0)), | 1812 BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0)), |
| 1812 WASM_LOAD_MEM(MachineType::Int8(), WASM_GET_LOCAL(0)))); | 1813 WASM_LOAD_MEM(MachineType::Int8(), WASM_GET_LOCAL(0)))); |
| 1813 CHECK_EQ(11, r.Call(11)); | 1814 CHECK_EQ(11, r.Call(11)); |
| 1814 CHECK_EQ(21, r.Call(21)); | 1815 CHECK_EQ(21, r.Call(21)); |
| 1815 } | 1816 } |
| 1816 | 1817 |
| 1817 WASM_EXEC_TEST(Infinite_Loop_not_taken1) { | 1818 WASM_EXEC_TEST(Infinite_Loop_not_taken1) { |
| 1818 WasmRunner<int32_t, int32_t> r(execution_mode); | 1819 WasmRunner<int32_t, int32_t> r(execution_mode); |
| 1819 BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_INFINITE_LOOP), WASM_I32V_1(45)); | 1820 BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_INFINITE_LOOP), WASM_I32V_1(45)); |
| 1820 // Run the code, but don't go into the infinite loop. | 1821 // Run the code, but don't go into the infinite loop. |
| (...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2865 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, | 2866 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, |
| 2866 WASM_ZERO); | 2867 WASM_ZERO); |
| 2867 const int32_t kMin = std::numeric_limits<int32_t>::min(); | 2868 const int32_t kMin = std::numeric_limits<int32_t>::min(); |
| 2868 CHECK_EQ(0, r.Call(133, 100)); | 2869 CHECK_EQ(0, r.Call(133, 100)); |
| 2869 CHECK_EQ(0, r.Call(kMin, -1)); | 2870 CHECK_EQ(0, r.Call(kMin, -1)); |
| 2870 CHECK_EQ(0, r.Call(0, 1)); | 2871 CHECK_EQ(0, r.Call(0, 1)); |
| 2871 CHECK_TRAP(r.Call(100, 0)); | 2872 CHECK_TRAP(r.Call(100, 0)); |
| 2872 CHECK_TRAP(r.Call(-1001, 0)); | 2873 CHECK_TRAP(r.Call(-1001, 0)); |
| 2873 CHECK_TRAP(r.Call(kMin, 0)); | 2874 CHECK_TRAP(r.Call(kMin, 0)); |
| 2874 } | 2875 } |
| OLD | NEW |