OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this | 1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // 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 5570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5581 MachineType::Int32(), MachineType::Int32(), MachineType::Int32(), | 5581 MachineType::Int32(), MachineType::Int32(), MachineType::Int32(), |
5582 MachineType::Int32(), MachineType::Int32(), MachineType::Int32(), | 5582 MachineType::Int32(), MachineType::Int32(), MachineType::Int32(), |
5583 function, param, param, param, param, param, param, param, param)); | 5583 function, param, param, param, param, param, param, param, param)); |
5584 FOR_INT32_INPUTS(i) { | 5584 FOR_INT32_INPUTS(i) { |
5585 int32_t const x = *i; | 5585 int32_t const x = *i; |
5586 CHECK_EQ(x * 8, m.Call(x)); | 5586 CHECK_EQ(x * 8, m.Call(x)); |
5587 } | 5587 } |
5588 } | 5588 } |
5589 #endif // USE_SIMULATOR | 5589 #endif // USE_SIMULATOR |
5590 | 5590 |
| 5591 TEST(RunCallExternalReferenceF64Trunc) { |
| 5592 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); |
| 5593 Node* stack_slot = m.StackSlot(MachineRepresentation::kFloat64); |
| 5594 m.Store(MachineRepresentation::kFloat64, stack_slot, m.Parameter(0), |
| 5595 WriteBarrierKind::kNoWriteBarrier); |
| 5596 Node* function = m.ExternalConstant( |
| 5597 ExternalReference::trunc64_wrapper_function(m.isolate())); |
| 5598 m.CallCFunction1(MachineType::Pointer(), MachineType::Pointer(), function, |
| 5599 stack_slot); |
| 5600 m.Return(m.Load(MachineType::Float64(), stack_slot)); |
| 5601 FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(trunc(*i), m.Call(*i)); } |
| 5602 } |
| 5603 |
5591 #if V8_TARGET_ARCH_64_BIT | 5604 #if V8_TARGET_ARCH_64_BIT |
5592 // TODO(titzer): run int64 tests on all platforms when supported. | 5605 // TODO(titzer): run int64 tests on all platforms when supported. |
5593 TEST(RunCheckedLoadInt64) { | 5606 TEST(RunCheckedLoadInt64) { |
5594 int64_t buffer[] = {0x66bbccddeeff0011LL, 0x1122334455667788LL}; | 5607 int64_t buffer[] = {0x66bbccddeeff0011LL, 0x1122334455667788LL}; |
5595 RawMachineAssemblerTester<int64_t> m(MachineType::Int32()); | 5608 RawMachineAssemblerTester<int64_t> m(MachineType::Int32()); |
5596 Node* base = m.PointerConstant(buffer); | 5609 Node* base = m.PointerConstant(buffer); |
5597 Node* index = m.Parameter(0); | 5610 Node* index = m.Parameter(0); |
5598 Node* length = m.Int32Constant(16); | 5611 Node* length = m.Int32Constant(16); |
5599 Node* load = m.AddNode(m.machine()->CheckedLoad(MachineType::Int64()), base, | 5612 Node* load = m.AddNode(m.machine()->CheckedLoad(MachineType::Int64()), base, |
5600 index, length); | 5613 index, length); |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6085 Node* call = r.AddNode(r.common()->Call(desc), phi); | 6098 Node* call = r.AddNode(r.common()->Call(desc), phi); |
6086 r.Return(call); | 6099 r.Return(call); |
6087 | 6100 |
6088 CHECK_EQ(33, r.Call(1)); | 6101 CHECK_EQ(33, r.Call(1)); |
6089 CHECK_EQ(44, r.Call(0)); | 6102 CHECK_EQ(44, r.Call(0)); |
6090 } | 6103 } |
6091 | 6104 |
6092 } // namespace compiler | 6105 } // namespace compiler |
6093 } // namespace internal | 6106 } // namespace internal |
6094 } // namespace v8 | 6107 } // namespace v8 |
OLD | NEW |