| 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 DCHECK(index < 0); | 15 DCHECK(index < 0); |
| 16 return LinkageLocation(kMachineTagged, index); | 16 return LinkageLocation(kMachAnyTagged, 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(kMachAnyTagged, 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)); |
| 26 } | 26 } |
| 27 | 27 |
| 28 static LinkageLocation UnconstrainedRegister(MachineType rep) { | 28 static LinkageLocation UnconstrainedRegister(MachineType rep) { |
| 29 return LinkageLocation(rep, LinkageLocation::ANY_REGISTER); | 29 return LinkageLocation(rep, LinkageLocation::ANY_REGISTER); |
| 30 } | 30 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 DCHECK_LE(return_count, 2); | 99 DCHECK_LE(return_count, 2); |
| 100 | 100 |
| 101 locations[index++] = UnconstrainedRegister(kMachineTagged); // CEntryStub | 101 locations[index++] = UnconstrainedRegister(kMachAnyTagged); // 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()); |
| 110 locations[index++] = | 110 locations[index++] = |
| 111 WordRegisterLocation(LinkageTraits::RuntimeCallArgCountReg()); | 111 WordRegisterLocation(LinkageTraits::RuntimeCallArgCountReg()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 136 const int context_count = 1; | 136 const int context_count = 1; |
| 137 int input_count = code_count + parameter_count + context_count; | 137 int input_count = code_count + parameter_count + context_count; |
| 138 | 138 |
| 139 const int return_count = 1; | 139 const int return_count = 1; |
| 140 LinkageLocation* locations = | 140 LinkageLocation* locations = |
| 141 zone->NewArray<LinkageLocation>(return_count + input_count); | 141 zone->NewArray<LinkageLocation>(return_count + input_count); |
| 142 | 142 |
| 143 int index = 0; | 143 int index = 0; |
| 144 locations[index++] = | 144 locations[index++] = |
| 145 TaggedRegisterLocation(LinkageTraits::ReturnValueReg()); | 145 TaggedRegisterLocation(LinkageTraits::ReturnValueReg()); |
| 146 locations[index++] = UnconstrainedRegister(kMachineTagged); // code | 146 locations[index++] = UnconstrainedRegister(kMachAnyTagged); // code |
| 147 for (int i = 0; i < parameter_count; i++) { | 147 for (int i = 0; i < parameter_count; i++) { |
| 148 if (i < register_parameter_count) { | 148 if (i < register_parameter_count) { |
| 149 // The first parameters to code stub calls go in registers. | 149 // The first parameters to code stub calls go in registers. |
| 150 Register reg = descriptor->GetEnvironmentParameterRegister(i); | 150 Register reg = descriptor->GetEnvironmentParameterRegister(i); |
| 151 locations[index++] = TaggedRegisterLocation(reg); | 151 locations[index++] = TaggedRegisterLocation(reg); |
| 152 } else { | 152 } else { |
| 153 // The rest of the parameters go on the stack. | 153 // The rest of the parameters go on the stack. |
| 154 int stack_slot = i - register_parameter_count - stack_parameter_count; | 154 int stack_slot = i - register_parameter_count - stack_parameter_count; |
| 155 locations[index++] = TaggedStackSlot(stack_slot); | 155 locations[index++] = TaggedStackSlot(stack_slot); |
| 156 } | 156 } |
| (...skipping 40 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 |