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 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 WASM_F32_REINTERPRET_I32(WASM_GET_LOCAL(0))), | 1102 WASM_F32_REINTERPRET_I32(WASM_GET_LOCAL(0))), |
1103 WASM_I8(107)); | 1103 WASM_I8(107)); |
1104 | 1104 |
1105 FOR_INT32_INPUTS(i) { | 1105 FOR_INT32_INPUTS(i) { |
1106 int32_t expected = *i; | 1106 int32_t expected = *i; |
1107 CHECK_EQ(107, r.Call(expected)); | 1107 CHECK_EQ(107, r.Call(expected)); |
1108 CHECK_EQ(expected, module.ReadMemory(&memory[0])); | 1108 CHECK_EQ(expected, module.ReadMemory(&memory[0])); |
1109 } | 1109 } |
1110 } | 1110 } |
1111 | 1111 |
| 1112 WASM_EXEC_TEST(LoadMaxUint32Offset) { |
| 1113 TestingModule module(execution_mode); |
| 1114 module.AddMemoryElems<int32_t>(8); |
| 1115 WasmRunner<int32_t> r(&module); |
| 1116 |
| 1117 BUILD(r, kExprI8Const, 0, // index |
| 1118 static_cast<byte>(v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf( |
| 1119 MachineType::Int32(), false)), // -- |
| 1120 0, // alignment |
| 1121 U32V_5(0xffffffff)); // offset |
| 1122 |
| 1123 CHECK_TRAP32(r.Call()); |
| 1124 } |
| 1125 |
1112 WASM_EXEC_TEST(LoadStoreLoad) { | 1126 WASM_EXEC_TEST(LoadStoreLoad) { |
1113 TestingModule module(execution_mode); | 1127 TestingModule module(execution_mode); |
1114 int32_t* memory = module.AddMemoryElems<int32_t>(8); | 1128 int32_t* memory = module.AddMemoryElems<int32_t>(8); |
1115 WasmRunner<int32_t> r(&module); | 1129 WasmRunner<int32_t> r(&module); |
1116 | 1130 |
1117 BUILD(r, WASM_STORE_MEM(MachineType::Int32(), WASM_ZERO, | 1131 BUILD(r, WASM_STORE_MEM(MachineType::Int32(), WASM_ZERO, |
1118 WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)), | 1132 WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)), |
1119 WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)); | 1133 WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)); |
1120 | 1134 |
1121 FOR_INT32_INPUTS(i) { | 1135 FOR_INT32_INPUTS(i) { |
(...skipping 1871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2993 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, | 3007 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, |
2994 WASM_ZERO); | 3008 WASM_ZERO); |
2995 const int32_t kMin = std::numeric_limits<int32_t>::min(); | 3009 const int32_t kMin = std::numeric_limits<int32_t>::min(); |
2996 CHECK_EQ(0, r.Call(133, 100)); | 3010 CHECK_EQ(0, r.Call(133, 100)); |
2997 CHECK_EQ(0, r.Call(kMin, -1)); | 3011 CHECK_EQ(0, r.Call(kMin, -1)); |
2998 CHECK_EQ(0, r.Call(0, 1)); | 3012 CHECK_EQ(0, r.Call(0, 1)); |
2999 CHECK_TRAP(r.Call(100, 0)); | 3013 CHECK_TRAP(r.Call(100, 0)); |
3000 CHECK_TRAP(r.Call(-1001, 0)); | 3014 CHECK_TRAP(r.Call(-1001, 0)); |
3001 CHECK_TRAP(r.Call(kMin, 0)); | 3015 CHECK_TRAP(r.Call(kMin, 0)); |
3002 } | 3016 } |
OLD | NEW |