| 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/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 Location Location::AnyOrConstant(Value* value) { | 114 Location Location::AnyOrConstant(Value* value) { |
| 115 ConstantInstr* constant = value->definition()->AsConstant(); | 115 ConstantInstr* constant = value->definition()->AsConstant(); |
| 116 return ((constant != NULL) && Assembler::IsSafe(constant->value())) | 116 return ((constant != NULL) && Assembler::IsSafe(constant->value())) |
| 117 ? Location::Constant(constant) | 117 ? Location::Constant(constant) |
| 118 : Location::Any(); | 118 : Location::Any(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 | 121 |
| 122 Address Location::ToStackSlotAddress() const { | 122 Address Location::ToStackSlotAddress() const { |
| 123 const intptr_t index = stack_index(); | 123 const intptr_t index = stack_index(); |
| 124 if (index < 0) { | 124 const Register base = base_reg(); |
| 125 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize; | 125 if (base == FPREG) { |
| 126 return Address(FPREG, offset); | 126 if (index < 0) { |
| 127 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize; |
| 128 return Address(base, offset); |
| 129 } else { |
| 130 const intptr_t offset = (kFirstLocalSlotFromFp - index) * kWordSize; |
| 131 return Address(base, offset); |
| 132 } |
| 127 } else { | 133 } else { |
| 128 const intptr_t offset = (kFirstLocalSlotFromFp - index) * kWordSize; | 134 ASSERT(base == SPREG); |
| 129 return Address(FPREG, offset); | 135 return Address(base, index * kWordSize); |
| 130 } | 136 } |
| 131 } | 137 } |
| 132 | 138 |
| 133 | 139 |
| 134 intptr_t Location::ToStackSlotOffset() const { | 140 intptr_t Location::ToStackSlotOffset() const { |
| 135 const intptr_t index = stack_index(); | 141 const intptr_t index = stack_index(); |
| 136 if (index < 0) { | 142 if (base_reg() == FPREG) { |
| 137 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize; | 143 if (index < 0) { |
| 138 return offset; | 144 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize; |
| 145 return offset; |
| 146 } else { |
| 147 const intptr_t offset = (kFirstLocalSlotFromFp - index) * kWordSize; |
| 148 return offset; |
| 149 } |
| 139 } else { | 150 } else { |
| 140 const intptr_t offset = (kFirstLocalSlotFromFp - index) * kWordSize; | 151 ASSERT(base_reg() == SPREG); |
| 141 return offset; | 152 return index * kWordSize; |
| 142 } | 153 } |
| 143 } | 154 } |
| 144 | 155 |
| 145 | 156 |
| 146 const Object& Location::constant() const { | 157 const Object& Location::constant() const { |
| 147 return constant_instruction()->value(); | 158 return constant_instruction()->value(); |
| 148 } | 159 } |
| 149 | 160 |
| 150 | 161 |
| 151 const char* Location::Name() const { | 162 const char* Location::Name() const { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 // with the right representation because register allocator does not know | 295 // with the right representation because register allocator does not know |
| 285 // how they are used within the instruction template. | 296 // how they are used within the instruction template. |
| 286 ASSERT(in(i).IsMachineRegister()); | 297 ASSERT(in(i).IsMachineRegister()); |
| 287 ASSERT(live_registers()->Contains(in(i))); | 298 ASSERT(live_registers()->Contains(in(i))); |
| 288 } | 299 } |
| 289 } | 300 } |
| 290 } | 301 } |
| 291 #endif | 302 #endif |
| 292 | 303 |
| 293 } // namespace dart | 304 } // namespace dart |
| OLD | NEW |