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 4377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4388 static const int kInputSize = 10; | 4388 static const int kInputSize = 10; |
4389 int32_t inputs[kInputSize]; | 4389 int32_t inputs[kInputSize]; |
4390 int32_t outputs[kInputSize]; | 4390 int32_t outputs[kInputSize]; |
4391 for (int i = 0; i < kInputSize; i++) { | 4391 for (int i = 0; i < kInputSize; i++) { |
4392 inputs[i] = i; | 4392 inputs[i] = i; |
4393 outputs[i] = -1; | 4393 outputs[i] = -1; |
4394 } | 4394 } |
4395 RawMachineAssemblerTester<int32_t*> m; | 4395 RawMachineAssemblerTester<int32_t*> m; |
4396 Node* input = m.PointerConstant(&inputs[0]); | 4396 Node* input = m.PointerConstant(&inputs[0]); |
4397 Node* output = m.PointerConstant(&outputs[kInputSize - 1]); | 4397 Node* output = m.PointerConstant(&outputs[kInputSize - 1]); |
4398 Node* elem_size = m.ConvertInt32ToIntPtr(m.Int32Constant(sizeof(inputs[0]))); | 4398 Node* elem_size = m.IntPtrConstant(sizeof(inputs[0])); |
4399 for (int i = 0; i < kInputSize; i++) { | 4399 for (int i = 0; i < kInputSize; i++) { |
4400 m.Store(kMachInt32, output, m.Load(kMachInt32, input)); | 4400 m.Store(kMachInt32, output, m.Load(kMachInt32, input)); |
4401 input = m.IntPtrAdd(input, elem_size); | 4401 input = m.IntPtrAdd(input, elem_size); |
4402 output = m.IntPtrSub(output, elem_size); | 4402 output = m.IntPtrSub(output, elem_size); |
4403 } | 4403 } |
4404 m.Return(input); | 4404 m.Return(input); |
4405 CHECK_EQ(&inputs[kInputSize], m.Call()); | 4405 CHECK_EQ(&inputs[kInputSize], m.Call()); |
4406 for (int i = 0; i < kInputSize; i++) { | 4406 for (int i = 0; i < kInputSize; i++) { |
4407 CHECK_EQ(i, inputs[i]); | 4407 CHECK_EQ(i, inputs[i]); |
4408 CHECK_EQ(kInputSize - i - 1, outputs[i]); | 4408 CHECK_EQ(kInputSize - i - 1, outputs[i]); |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5142 m.Return(m.Int32Constant(0)); | 5142 m.Return(m.Int32Constant(0)); |
5143 for (size_t i = 0; i < arraysize(kValues); ++i) { | 5143 for (size_t i = 0; i < arraysize(kValues); ++i) { |
5144 input = kValues[i]; | 5144 input = kValues[i]; |
5145 CHECK_EQ(0, m.Call()); | 5145 CHECK_EQ(0, m.Call()); |
5146 double expected = round(kValues[i]); | 5146 double expected = round(kValues[i]); |
5147 CHECK_EQ(expected, result); | 5147 CHECK_EQ(expected, result); |
5148 } | 5148 } |
5149 } | 5149 } |
5150 | 5150 |
5151 #endif // V8_TURBOFAN_TARGET | 5151 #endif // V8_TURBOFAN_TARGET |
OLD | NEW |