| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 | 81 |
| 82 Location Location::AnyOrConstant(Value* value) { | 82 Location Location::AnyOrConstant(Value* value) { |
| 83 ConstantInstr* constant = value->definition()->AsConstant(); | 83 ConstantInstr* constant = value->definition()->AsConstant(); |
| 84 return (constant != NULL) | 84 return (constant != NULL) |
| 85 ? Location::Constant(constant->value()) | 85 ? Location::Constant(constant->value()) |
| 86 : Location::Any(); | 86 : Location::Any(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 | 89 |
| 90 // TODO(regis): Remove all occurences of Address in the architecture independent | 90 intptr_t Location::ToStackSlotOffset() const { |
| 91 // portion of the vm. | |
| 92 Address Location::ToStackSlotAddress() const { | |
| 93 const intptr_t index = stack_index(); | 91 const intptr_t index = stack_index(); |
| 94 if (index < 0) { | 92 if (index < 0) { |
| 95 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize; | 93 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize; |
| 96 return Address(FPREG, offset); | 94 return offset; |
| 97 } else { | 95 } else { |
| 98 const intptr_t offset = (kFirstLocalSlotFromFp - index) * kWordSize; | 96 const intptr_t offset = (kFirstLocalSlotFromFp - index) * kWordSize; |
| 99 return Address(FPREG, offset); | 97 return offset; |
| 100 } | 98 } |
| 101 } | 99 } |
| 102 | 100 |
| 103 | 101 |
| 104 const char* Location::Name() const { | 102 const char* Location::Name() const { |
| 105 switch (kind()) { | 103 switch (kind()) { |
| 106 case kInvalid: return "?"; | 104 case kInvalid: return "?"; |
| 107 case kRegister: return Assembler::RegisterName(reg()); | 105 case kRegister: return Assembler::RegisterName(reg()); |
| 108 case kFpuRegister: return Assembler::FpuRegisterName(fpu_reg()); | 106 case kFpuRegister: return Assembler::FpuRegisterName(fpu_reg()); |
| 109 case kStackSlot: return "S"; | 107 case kStackSlot: return "S"; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 172 |
| 175 if (!out().IsInvalid()) { | 173 if (!out().IsInvalid()) { |
| 176 f->Print(" => "); | 174 f->Print(" => "); |
| 177 out().PrintTo(f); | 175 out().PrintTo(f); |
| 178 } | 176 } |
| 179 | 177 |
| 180 if (always_calls()) f->Print(" C"); | 178 if (always_calls()) f->Print(" C"); |
| 181 } | 179 } |
| 182 | 180 |
| 183 } // namespace dart | 181 } // namespace dart |
| OLD | NEW |