OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/locations.h" | 5 #include "vm/locations.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/il_printer.h" | 8 #include "vm/il_printer.h" |
9 #include "vm/log.h" | 9 #include "vm/log.h" |
10 #include "vm/stack_frame.h" | 10 #include "vm/stack_frame.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 | 112 |
113 Location Location::AnyOrConstant(Value* value) { | 113 Location Location::AnyOrConstant(Value* value) { |
114 ConstantInstr* constant = value->definition()->AsConstant(); | 114 ConstantInstr* constant = value->definition()->AsConstant(); |
115 return ((constant != NULL) && Assembler::IsSafe(constant->value())) | 115 return ((constant != NULL) && Assembler::IsSafe(constant->value())) |
116 ? Location::Constant(constant) | 116 ? Location::Constant(constant) |
117 : Location::Any(); | 117 : Location::Any(); |
118 } | 118 } |
119 | 119 |
120 | 120 |
| 121 #if !defined(TARGET_ARCH_DBC) |
121 Address Location::ToStackSlotAddress() const { | 122 Address Location::ToStackSlotAddress() const { |
122 const intptr_t index = stack_index(); | 123 const intptr_t index = stack_index(); |
123 const Register base = base_reg(); | 124 const Register base = base_reg(); |
124 if (base == FPREG) { | 125 if (base == FPREG) { |
125 if (index < 0) { | 126 if (index < 0) { |
126 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize; | 127 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize; |
127 return Address(base, offset); | 128 return Address(base, offset); |
128 } else { | 129 } else { |
129 const intptr_t offset = (kFirstLocalSlotFromFp - index) * kWordSize; | 130 const intptr_t offset = (kFirstLocalSlotFromFp - index) * kWordSize; |
130 return Address(base, offset); | 131 return Address(base, offset); |
131 } | 132 } |
132 } else { | 133 } else { |
133 ASSERT(base == SPREG); | 134 ASSERT(base == SPREG); |
134 return Address(base, index * kWordSize); | 135 return Address(base, index * kWordSize); |
135 } | 136 } |
136 } | 137 } |
137 | 138 #endif |
138 | 139 |
139 intptr_t Location::ToStackSlotOffset() const { | 140 intptr_t Location::ToStackSlotOffset() const { |
140 const intptr_t index = stack_index(); | 141 const intptr_t index = stack_index(); |
141 if (base_reg() == FPREG) { | 142 if (base_reg() == FPREG) { |
142 if (index < 0) { | 143 if (index < 0) { |
143 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize; | 144 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize; |
144 return offset; | 145 return offset; |
145 } else { | 146 } else { |
146 const intptr_t offset = (kFirstLocalSlotFromFp - index) * kWordSize; | 147 const intptr_t offset = (kFirstLocalSlotFromFp - index) * kWordSize; |
147 return offset; | 148 return offset; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 // with the right representation because register allocator does not know | 354 // with the right representation because register allocator does not know |
354 // how they are used within the instruction template. | 355 // how they are used within the instruction template. |
355 ASSERT(in(i).IsMachineRegister()); | 356 ASSERT(in(i).IsMachineRegister()); |
356 ASSERT(live_registers()->Contains(in(i))); | 357 ASSERT(live_registers()->Contains(in(i))); |
357 } | 358 } |
358 } | 359 } |
359 } | 360 } |
360 #endif | 361 #endif |
361 | 362 |
362 } // namespace dart | 363 } // namespace dart |
OLD | NEW |