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 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 WASM_F32_REINTERPRET_I32(WASM_GET_LOCAL(0))), | 1040 WASM_F32_REINTERPRET_I32(WASM_GET_LOCAL(0))), |
1041 WASM_I32V_2(107)); | 1041 WASM_I32V_2(107)); |
1042 | 1042 |
1043 FOR_INT32_INPUTS(i) { | 1043 FOR_INT32_INPUTS(i) { |
1044 int32_t expected = *i; | 1044 int32_t expected = *i; |
1045 CHECK_EQ(107, r.Call(expected)); | 1045 CHECK_EQ(107, r.Call(expected)); |
1046 CHECK_EQ(expected, r.module().ReadMemory(&memory[0])); | 1046 CHECK_EQ(expected, r.module().ReadMemory(&memory[0])); |
1047 } | 1047 } |
1048 } | 1048 } |
1049 | 1049 |
| 1050 // Do not run this test in a simulator because of signalling NaN issues on ia32. |
| 1051 #ifndef USE_SIMULATOR |
| 1052 |
1050 WASM_EXEC_TEST(SignallingNanSurvivesI32ReinterpretF32) { | 1053 WASM_EXEC_TEST(SignallingNanSurvivesI32ReinterpretF32) { |
1051 WasmRunner<int32_t> r(execution_mode); | 1054 WasmRunner<int32_t> r(execution_mode); |
1052 | 1055 |
1053 BUILD(r, WASM_I32_REINTERPRET_F32( | 1056 BUILD(r, WASM_I32_REINTERPRET_F32( |
1054 WASM_SEQ(kExprF32Const, 0x00, 0x00, 0xa0, 0x7f))); | 1057 WASM_SEQ(kExprF32Const, 0x00, 0x00, 0xa0, 0x7f))); |
1055 | 1058 |
1056 // This is a signalling nan. | 1059 // This is a signalling nan. |
1057 CHECK_EQ(0x7fa00000, r.Call()); | 1060 CHECK_EQ(0x7fa00000, r.Call()); |
1058 } | 1061 } |
1059 | 1062 |
| 1063 #endif |
| 1064 |
1060 WASM_EXEC_TEST_WITH_TRAP(LoadMaxUint32Offset) { | 1065 WASM_EXEC_TEST_WITH_TRAP(LoadMaxUint32Offset) { |
1061 WasmRunner<int32_t> r(execution_mode); | 1066 WasmRunner<int32_t> r(execution_mode); |
1062 r.module().AddMemoryElems<int32_t>(8); | 1067 r.module().AddMemoryElems<int32_t>(8); |
1063 | 1068 |
1064 BUILD(r, kExprI32Const, 0, // index | 1069 BUILD(r, kExprI32Const, 0, // index |
1065 static_cast<byte>(v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf( | 1070 static_cast<byte>(v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf( |
1066 MachineType::Int32(), false)), // -- | 1071 MachineType::Int32(), false)), // -- |
1067 0, // alignment | 1072 0, // alignment |
1068 U32V_5(0xffffffff)); // offset | 1073 U32V_5(0xffffffff)); // offset |
1069 | 1074 |
(...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2886 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, | 2891 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, |
2887 WASM_ZERO); | 2892 WASM_ZERO); |
2888 const int32_t kMin = std::numeric_limits<int32_t>::min(); | 2893 const int32_t kMin = std::numeric_limits<int32_t>::min(); |
2889 CHECK_EQ(0, r.Call(133, 100)); | 2894 CHECK_EQ(0, r.Call(133, 100)); |
2890 CHECK_EQ(0, r.Call(kMin, -1)); | 2895 CHECK_EQ(0, r.Call(kMin, -1)); |
2891 CHECK_EQ(0, r.Call(0, 1)); | 2896 CHECK_EQ(0, r.Call(0, 1)); |
2892 CHECK_TRAP(r.Call(100, 0)); | 2897 CHECK_TRAP(r.Call(100, 0)); |
2893 CHECK_TRAP(r.Call(-1001, 0)); | 2898 CHECK_TRAP(r.Call(-1001, 0)); |
2894 CHECK_TRAP(r.Call(kMin, 0)); | 2899 CHECK_TRAP(r.Call(kMin, 0)); |
2895 } | 2900 } |
OLD | NEW |