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/utils/random-number-generator.h" | 9 #include "src/base/utils/random-number-generator.h" |
10 | 10 |
(...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 BUILD(r, WASM_BLOCK( | 1677 BUILD(r, WASM_BLOCK( |
1678 2, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I8(61))), | 1678 2, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I8(61))), |
1679 WASM_GET_LOCAL(0))); | 1679 WASM_GET_LOCAL(0))); |
1680 FOR_INT32_INPUTS(i) { | 1680 FOR_INT32_INPUTS(i) { |
1681 int32_t expected = *i ? 61 : *i; | 1681 int32_t expected = *i ? 61 : *i; |
1682 CHECK_EQ(expected, r.Call(*i)); | 1682 CHECK_EQ(expected, r.Call(*i)); |
1683 } | 1683 } |
1684 } | 1684 } |
1685 | 1685 |
1686 | 1686 |
| 1687 TEST(Run_Wasm_DanglingAssign) { |
| 1688 WasmRunner<int32_t> r(MachineType::Int32()); |
| 1689 // { return 0; p0 = 0; } |
| 1690 BUILD(r, |
| 1691 WASM_BLOCK(2, WASM_RETURN(WASM_I8(99)), WASM_SET_LOCAL(0, WASM_ZERO))); |
| 1692 CHECK_EQ(99, r.Call(1)); |
| 1693 } |
| 1694 |
| 1695 |
1687 TEST(Run_Wasm_ExprIf_P) { | 1696 TEST(Run_Wasm_ExprIf_P) { |
1688 WasmRunner<int32_t> r(MachineType::Int32()); | 1697 WasmRunner<int32_t> r(MachineType::Int32()); |
1689 // p0 ? 11 : 22; | 1698 // p0 ? 11 : 22; |
1690 BUILD(r, WASM_IF_ELSE(WASM_GET_LOCAL(0), // -- | 1699 BUILD(r, WASM_IF_ELSE(WASM_GET_LOCAL(0), // -- |
1691 WASM_I8(11), // -- | 1700 WASM_I8(11), // -- |
1692 WASM_I8(22))); // -- | 1701 WASM_I8(22))); // -- |
1693 FOR_INT32_INPUTS(i) { | 1702 FOR_INT32_INPUTS(i) { |
1694 int32_t expected = *i ? 11 : 22; | 1703 int32_t expected = *i ? 11 : 22; |
1695 CHECK_EQ(expected, r.Call(*i)); | 1704 CHECK_EQ(expected, r.Call(*i)); |
1696 } | 1705 } |
(...skipping 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3609 TEST(Run_Wasm_F32CopySign) { | 3618 TEST(Run_Wasm_F32CopySign) { |
3610 WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); | 3619 WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); |
3611 BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 3620 BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
3612 | 3621 |
3613 FOR_FLOAT32_INPUTS(i) { | 3622 FOR_FLOAT32_INPUTS(i) { |
3614 FOR_FLOAT32_INPUTS(j) { CheckFloatEq(copysign(*i, *j), r.Call(*i, *j)); } | 3623 FOR_FLOAT32_INPUTS(j) { CheckFloatEq(copysign(*i, *j), r.Call(*i, *j)); } |
3615 } | 3624 } |
3616 } | 3625 } |
3617 | 3626 |
3618 #endif | 3627 #endif |
OLD | NEW |