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 #ifndef V8_COMPILER_LINKAGE_IMPL_H_ | 5 #ifndef V8_COMPILER_LINKAGE_IMPL_H_ |
6 #define V8_COMPILER_LINKAGE_IMPL_H_ | 6 #define V8_COMPILER_LINKAGE_IMPL_H_ |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 namespace compiler { | 10 namespace compiler { |
11 | 11 |
12 class LinkageHelper { | 12 class LinkageHelper { |
13 public: | 13 public: |
14 static LinkageLocation TaggedStackSlot(int index) { | 14 static LinkageLocation TaggedStackSlot(int index) { |
15 ASSERT(index < 0); | 15 DCHECK(index < 0); |
16 return LinkageLocation(kMachineTagged, index); | 16 return LinkageLocation(kMachineTagged, index); |
17 } | 17 } |
18 | 18 |
19 static LinkageLocation TaggedRegisterLocation(Register reg) { | 19 static LinkageLocation TaggedRegisterLocation(Register reg) { |
20 return LinkageLocation(kMachineTagged, Register::ToAllocationIndex(reg)); | 20 return LinkageLocation(kMachineTagged, Register::ToAllocationIndex(reg)); |
21 } | 21 } |
22 | 22 |
23 static inline LinkageLocation WordRegisterLocation(Register reg) { | 23 static inline LinkageLocation WordRegisterLocation(Register reg) { |
24 return LinkageLocation(MachineOperatorBuilder::pointer_rep(), | 24 return LinkageLocation(MachineOperatorBuilder::pointer_rep(), |
25 Register::ToAllocationIndex(reg)); | 25 Register::ToAllocationIndex(reg)); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 int index = 0; | 89 int index = 0; |
90 if (return_count > 0) { | 90 if (return_count > 0) { |
91 locations[index++] = | 91 locations[index++] = |
92 TaggedRegisterLocation(LinkageTraits::ReturnValueReg()); | 92 TaggedRegisterLocation(LinkageTraits::ReturnValueReg()); |
93 } | 93 } |
94 if (return_count > 1) { | 94 if (return_count > 1) { |
95 locations[index++] = | 95 locations[index++] = |
96 TaggedRegisterLocation(LinkageTraits::ReturnValue2Reg()); | 96 TaggedRegisterLocation(LinkageTraits::ReturnValue2Reg()); |
97 } | 97 } |
98 | 98 |
99 ASSERT_LE(return_count, 2); | 99 DCHECK_LE(return_count, 2); |
100 | 100 |
101 locations[index++] = UnconstrainedRegister(kMachineTagged); // CEntryStub | 101 locations[index++] = UnconstrainedRegister(kMachineTagged); // CEntryStub |
102 | 102 |
103 for (int i = 0; i < parameter_count; i++) { | 103 for (int i = 0; i < parameter_count; i++) { |
104 // All parameters to runtime calls go on the stack. | 104 // All parameters to runtime calls go on the stack. |
105 int spill_slot_index = i - parameter_count; | 105 int spill_slot_index = i - parameter_count; |
106 locations[index++] = TaggedStackSlot(spill_slot_index); | 106 locations[index++] = TaggedStackSlot(spill_slot_index); |
107 } | 107 } |
108 locations[index++] = | 108 locations[index++] = |
109 TaggedRegisterLocation(LinkageTraits::RuntimeCallFunctionReg()); | 109 TaggedRegisterLocation(LinkageTraits::RuntimeCallFunctionReg()); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 CallDescriptor::kCallAddress, 1, num_params, num_params + 1, locations, | 197 CallDescriptor::kCallAddress, 1, num_params, num_params + 1, locations, |
198 Operator::kNoProperties, LinkageTraits::CCalleeSaveRegisters(), | 198 Operator::kNoProperties, LinkageTraits::CCalleeSaveRegisters(), |
199 CallDescriptor::kCannotDeoptimize); // TODO(jarin) should deoptimize! | 199 CallDescriptor::kCannotDeoptimize); // TODO(jarin) should deoptimize! |
200 } | 200 } |
201 }; | 201 }; |
202 } | 202 } |
203 } | 203 } |
204 } // namespace v8::internal::compiler | 204 } // namespace v8::internal::compiler |
205 | 205 |
206 #endif // V8_COMPILER_LINKAGE_IMPL_H_ | 206 #endif // V8_COMPILER_LINKAGE_IMPL_H_ |
OLD | NEW |