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/ieee754.h" | 10 #include "src/base/ieee754.h" |
(...skipping 6721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6732 r.Goto(&merge); | 6732 r.Goto(&merge); |
6733 r.Bind(&flabel); | 6733 r.Bind(&flabel); |
6734 Node* fb = r.Int32Constant(0); | 6734 Node* fb = r.Int32Constant(0); |
6735 r.Goto(&merge); | 6735 r.Goto(&merge); |
6736 r.Bind(&merge); | 6736 r.Bind(&merge); |
6737 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); | 6737 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); |
6738 r.Return(phi); | 6738 r.Return(phi); |
6739 CHECK_EQ(1, r.Call(1)); | 6739 CHECK_EQ(1, r.Call(1)); |
6740 } | 6740 } |
6741 | 6741 |
| 6742 #if V8_HOST_ARCH_MIPS || V8_HOST_ARCH_MIPS64 |
| 6743 |
| 6744 TEST(StackSlotAlignment) { |
| 6745 RawMachineAssemblerTester<int32_t> r; |
| 6746 RawMachineLabel tlabel; |
| 6747 RawMachineLabel flabel; |
| 6748 RawMachineLabel merge; |
| 6749 |
| 6750 int alignments[] = {4, 8, 16}; |
| 6751 int alignment_count = arraysize(alignments); |
| 6752 |
| 6753 Node* alignment_counter = r.Int32Constant(0); |
| 6754 for (int i = 0; i < alignment_count; i++) { |
| 6755 for (int j = 0; j < 5; j++) { |
| 6756 Node* stack_slot = |
| 6757 r.StackSlot(MachineRepresentation::kWord32, alignments[i]); |
| 6758 alignment_counter = r.Int32Add( |
| 6759 alignment_counter, |
| 6760 r.Word32And(stack_slot, r.Int32Constant(alignments[i] - 1))); |
| 6761 } |
| 6762 } |
| 6763 |
| 6764 r.Return(alignment_counter); |
| 6765 CHECK_EQ(0, r.Call(1)); |
| 6766 } |
| 6767 |
| 6768 #endif // V8_HOST_ARCH_MIPS || V8_HOST_ARCH_MIPS64 |
| 6769 |
6742 #if V8_TARGET_ARCH_64_BIT | 6770 #if V8_TARGET_ARCH_64_BIT |
6743 | 6771 |
6744 TEST(Regression5923) { | 6772 TEST(Regression5923) { |
6745 { | 6773 { |
6746 BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Int64()); | 6774 BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Int64()); |
6747 m.Return(m.Int64Add( | 6775 m.Return(m.Int64Add( |
6748 m.Word64Shr(m.Parameter(0), m.Int64Constant(4611686018427387888)), | 6776 m.Word64Shr(m.Parameter(0), m.Int64Constant(4611686018427387888)), |
6749 m.Parameter(0))); | 6777 m.Parameter(0))); |
6750 int64_t input = 16; | 6778 int64_t input = 16; |
6751 m.Call(input); | 6779 m.Call(input); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6811 BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Int32()); | 6839 BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Int32()); |
6812 m.Return(m.Word32And(m.Word32Shr(m.Parameter(0), m.Int32Constant(0)), | 6840 m.Return(m.Word32And(m.Word32Shr(m.Parameter(0), m.Int32Constant(0)), |
6813 m.Int32Constant(0xffffffff))); | 6841 m.Int32Constant(0xffffffff))); |
6814 int32_t input = 1234; | 6842 int32_t input = 1234; |
6815 CHECK_EQ(input, m.Call(input)); | 6843 CHECK_EQ(input, m.Call(input)); |
6816 } | 6844 } |
6817 | 6845 |
6818 } // namespace compiler | 6846 } // namespace compiler |
6819 } // namespace internal | 6847 } // namespace internal |
6820 } // namespace v8 | 6848 } // namespace v8 |
OLD | NEW |