| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 WASM_EXEC_TEST(Int32Const_many) { | 72 WASM_EXEC_TEST(Int32Const_many) { |
| 73 FOR_INT32_INPUTS(i) { | 73 FOR_INT32_INPUTS(i) { |
| 74 WasmRunner<int32_t> r(execution_mode); | 74 WasmRunner<int32_t> r(execution_mode); |
| 75 const int32_t kExpectedValue = *i; | 75 const int32_t kExpectedValue = *i; |
| 76 // return(kExpectedValue) | 76 // return(kExpectedValue) |
| 77 BUILD(r, WASM_I32V(kExpectedValue)); | 77 BUILD(r, WASM_I32V(kExpectedValue)); |
| 78 CHECK_EQ(kExpectedValue, r.Call()); | 78 CHECK_EQ(kExpectedValue, r.Call()); |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 WASM_EXEC_TEST(GraphTrimming) { |
| 83 // This WebAssembly code requires graph trimming in the TurboFan compiler. |
| 84 WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); |
| 85 BUILD(r, kExprGetLocal, 0, kExprGetLocal, 0, kExprGetLocal, 0, kExprI32RemS, |
| 86 kExprI32Eq, kExprGetLocal, 0, kExprI32DivS, kExprUnreachable); |
| 87 r.Call(1); |
| 88 } |
| 89 |
| 82 WASM_EXEC_TEST(Int32Param0) { | 90 WASM_EXEC_TEST(Int32Param0) { |
| 83 WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); | 91 WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); |
| 84 // return(local[0]) | 92 // return(local[0]) |
| 85 BUILD(r, WASM_GET_LOCAL(0)); | 93 BUILD(r, WASM_GET_LOCAL(0)); |
| 86 FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } | 94 FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } |
| 87 } | 95 } |
| 88 | 96 |
| 89 WASM_EXEC_TEST(Int32Param0_fallthru) { | 97 WASM_EXEC_TEST(Int32Param0_fallthru) { |
| 90 WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); | 98 WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); |
| 91 // local[0] | 99 // local[0] |
| (...skipping 2816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2908 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, | 2916 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, |
| 2909 WASM_ZERO); | 2917 WASM_ZERO); |
| 2910 const int32_t kMin = std::numeric_limits<int32_t>::min(); | 2918 const int32_t kMin = std::numeric_limits<int32_t>::min(); |
| 2911 CHECK_EQ(0, r.Call(133, 100)); | 2919 CHECK_EQ(0, r.Call(133, 100)); |
| 2912 CHECK_EQ(0, r.Call(kMin, -1)); | 2920 CHECK_EQ(0, r.Call(kMin, -1)); |
| 2913 CHECK_EQ(0, r.Call(0, 1)); | 2921 CHECK_EQ(0, r.Call(0, 1)); |
| 2914 CHECK_TRAP(r.Call(100, 0)); | 2922 CHECK_TRAP(r.Call(100, 0)); |
| 2915 CHECK_TRAP(r.Call(-1001, 0)); | 2923 CHECK_TRAP(r.Call(-1001, 0)); |
| 2916 CHECK_TRAP(r.Call(kMin, 0)); | 2924 CHECK_TRAP(r.Call(kMin, 0)); |
| 2917 } | 2925 } |
| OLD | NEW |