OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 <cmath> | 5 #include <cmath> |
6 #include <functional> | 6 #include <functional> |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/utils/random-number-generator.h" | 10 #include "src/base/utils/random-number-generator.h" |
(...skipping 5259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5270 Node* param = m.Parameter(0); | 5270 Node* param = m.Parameter(0); |
5271 m.Return(m.CallCFunction8(kMachInt32, kMachInt32, kMachInt32, kMachInt32, | 5271 m.Return(m.CallCFunction8(kMachInt32, kMachInt32, kMachInt32, kMachInt32, |
5272 kMachInt32, kMachInt32, kMachInt32, kMachInt32, | 5272 kMachInt32, kMachInt32, kMachInt32, kMachInt32, |
5273 kMachInt32, function, param, param, param, param, | 5273 kMachInt32, function, param, param, param, param, |
5274 param, param, param, param)); | 5274 param, param, param, param)); |
5275 FOR_INT32_INPUTS(i) { | 5275 FOR_INT32_INPUTS(i) { |
5276 int32_t const x = *i; | 5276 int32_t const x = *i; |
5277 CHECK_EQ(x * 8, m.Call(x)); | 5277 CHECK_EQ(x * 8, m.Call(x)); |
5278 } | 5278 } |
5279 } | 5279 } |
| 5280 #endif // USE_SIMULATOR |
5280 | 5281 |
5281 #endif // USE_SIMULATOR | 5282 #if V8_TARGET_ARCH_64_BIT |
| 5283 TEST(RunCheckedLoadInt64) { |
| 5284 int64_t buffer[] = {0x66bbccddeeff0011LL, 0x1122334455667788LL}; |
| 5285 RawMachineAssemblerTester<int64_t> m(kMachInt32); |
| 5286 Node* base = m.PointerConstant(buffer); |
| 5287 Node* index = m.Parameter(0); |
| 5288 Node* length = m.Int32Constant(16); |
| 5289 Node* load = |
| 5290 m.NewNode(m.machine()->CheckedLoad(kMachInt64), base, index, length); |
| 5291 m.Return(load); |
| 5292 |
| 5293 CHECK_EQ(buffer[0], m.Call(0)); |
| 5294 CHECK_EQ(buffer[1], m.Call(8)); |
| 5295 CHECK_EQ(0, m.Call(16)); |
| 5296 } |
| 5297 |
| 5298 |
| 5299 TEST(RunCheckedStoreInt64) { |
| 5300 const int64_t write = 0x5566778899aabbLL; |
| 5301 const int64_t before = 0x33bbccddeeff0011LL; |
| 5302 int64_t buffer[] = {before, before}; |
| 5303 RawMachineAssemblerTester<int32_t> m(kMachInt32); |
| 5304 Node* base = m.PointerConstant(buffer); |
| 5305 Node* index = m.Parameter(0); |
| 5306 Node* length = m.Int32Constant(16); |
| 5307 Node* value = m.Int64Constant(write); |
| 5308 Node* store = m.NewNode(m.machine()->CheckedStore(kMachInt64), base, index, |
| 5309 length, value); |
| 5310 USE(store); |
| 5311 m.Return(m.Int32Constant(11)); |
| 5312 |
| 5313 CHECK_EQ(11, m.Call(16)); |
| 5314 CHECK_EQ(before, buffer[0]); |
| 5315 CHECK_EQ(before, buffer[1]); |
| 5316 |
| 5317 CHECK_EQ(11, m.Call(0)); |
| 5318 CHECK_EQ(write, buffer[0]); |
| 5319 CHECK_EQ(before, buffer[1]); |
| 5320 |
| 5321 CHECK_EQ(11, m.Call(8)); |
| 5322 CHECK_EQ(write, buffer[0]); |
| 5323 CHECK_EQ(write, buffer[1]); |
| 5324 } |
| 5325 #endif |
OLD | NEW |