| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/il_printer.h" | 8 #include "vm/il_printer.h" |
| 8 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
| 9 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| 10 | 11 |
| 11 namespace dart { | 12 namespace dart { |
| 12 | 13 |
| 13 LocationSummary::LocationSummary(intptr_t input_count, | 14 LocationSummary::LocationSummary(intptr_t input_count, |
| 14 intptr_t temp_count, | 15 intptr_t temp_count, |
| 15 LocationSummary::ContainsCall contains_call) | 16 LocationSummary::ContainsCall contains_call) |
| 16 : input_locations_(input_count), | 17 : input_locations_(input_count), |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 71 |
| 71 | 72 |
| 72 Location Location::FixedRegisterOrSmiConstant(Value* value, Register reg) { | 73 Location Location::FixedRegisterOrSmiConstant(Value* value, Register reg) { |
| 73 ConstantInstr* constant = value->definition()->AsConstant(); | 74 ConstantInstr* constant = value->definition()->AsConstant(); |
| 74 return ((constant != NULL) && constant->value().IsSmi()) | 75 return ((constant != NULL) && constant->value().IsSmi()) |
| 75 ? Location::Constant(constant->value()) | 76 ? Location::Constant(constant->value()) |
| 76 : Location::RegisterLocation(reg); | 77 : Location::RegisterLocation(reg); |
| 77 } | 78 } |
| 78 | 79 |
| 79 | 80 |
| 81 Location Location::AnyOrConstant(Value* value) { |
| 82 ConstantInstr* constant = value->definition()->AsConstant(); |
| 83 return (constant != NULL) |
| 84 ? Location::Constant(constant->value()) |
| 85 : Location::Any(); |
| 86 } |
| 87 |
| 88 |
| 89 Address Location::ToStackSlotAddress() const { |
| 90 const intptr_t index = stack_index(); |
| 91 if (index < 0) { |
| 92 const intptr_t offset = (1 - index) * kWordSize; |
| 93 return Address(FPREG, offset); |
| 94 } else { |
| 95 const intptr_t offset = |
| 96 (ParsedFunction::kFirstLocalSlotIndex - index) * kWordSize; |
| 97 return Address(FPREG, offset); |
| 98 } |
| 99 } |
| 100 |
| 101 |
| 80 const char* Location::Name() const { | 102 const char* Location::Name() const { |
| 81 switch (kind()) { | 103 switch (kind()) { |
| 82 case kInvalid: return "?"; | 104 case kInvalid: return "?"; |
| 83 case kRegister: return Assembler::RegisterName(reg()); | 105 case kRegister: return Assembler::RegisterName(reg()); |
| 84 case kXmmRegister: return Assembler::XmmRegisterName(xmm_reg()); | 106 case kXmmRegister: return Assembler::XmmRegisterName(xmm_reg()); |
| 85 case kStackSlot: return "S"; | 107 case kStackSlot: return "S"; |
| 86 case kDoubleStackSlot: return "DS"; | 108 case kDoubleStackSlot: return "DS"; |
| 87 case kUnallocated: | 109 case kUnallocated: |
| 88 switch (policy()) { | 110 switch (policy()) { |
| 89 case kAny: | 111 case kAny: |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 171 |
| 150 if (!out().IsInvalid()) { | 172 if (!out().IsInvalid()) { |
| 151 f->Print(" => "); | 173 f->Print(" => "); |
| 152 out().PrintTo(f); | 174 out().PrintTo(f); |
| 153 } | 175 } |
| 154 | 176 |
| 155 if (always_calls()) f->Print(" C"); | 177 if (always_calls()) f->Print(" C"); |
| 156 } | 178 } |
| 157 | 179 |
| 158 } // namespace dart | 180 } // namespace dart |
| OLD | NEW |