| 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/il_printer.h" | 7 #include "vm/il_printer.h" |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 #include "vm/flow_graph_compiler.h" | 9 #include "vm/flow_graph_compiler.h" |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 | 47 |
| 48 Location Location::RegisterOrConstant(Value* value) { | 48 Location Location::RegisterOrConstant(Value* value) { |
| 49 ConstantInstr* constant = value->definition()->AsConstant(); | 49 ConstantInstr* constant = value->definition()->AsConstant(); |
| 50 return (constant != NULL) | 50 return (constant != NULL) |
| 51 ? Location::Constant(constant->value()) | 51 ? Location::Constant(constant->value()) |
| 52 : Location::RequiresRegister(); | 52 : Location::RequiresRegister(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 | 55 |
| 56 Location Location::RegisterOrSmiConstant(Value* value) { |
| 57 ConstantInstr* constant = value->definition()->AsConstant(); |
| 58 return ((constant != NULL) && constant->value().IsSmi()) |
| 59 ? Location::Constant(constant->value()) |
| 60 : Location::RequiresRegister(); |
| 61 } |
| 62 |
| 63 |
| 56 Location Location::FixedRegisterOrConstant(Value* value, Register reg) { | 64 Location Location::FixedRegisterOrConstant(Value* value, Register reg) { |
| 57 ConstantInstr* constant = value->definition()->AsConstant(); | 65 ConstantInstr* constant = value->definition()->AsConstant(); |
| 58 return (constant != NULL) | 66 return (constant != NULL) |
| 59 ? Location::Constant(constant->value()) | 67 ? Location::Constant(constant->value()) |
| 60 : Location::RegisterLocation(reg); | 68 : Location::RegisterLocation(reg); |
| 61 } | 69 } |
| 62 | 70 |
| 63 | 71 |
| 72 Location Location::FixedRegisterOrSmiConstant(Value* value, Register reg) { |
| 73 ConstantInstr* constant = value->definition()->AsConstant(); |
| 74 return ((constant != NULL) && constant->value().IsSmi()) |
| 75 ? Location::Constant(constant->value()) |
| 76 : Location::RegisterLocation(reg); |
| 77 } |
| 78 |
| 79 |
| 64 const char* Location::Name() const { | 80 const char* Location::Name() const { |
| 65 switch (kind()) { | 81 switch (kind()) { |
| 66 case kInvalid: return "?"; | 82 case kInvalid: return "?"; |
| 67 case kRegister: return Assembler::RegisterName(reg()); | 83 case kRegister: return Assembler::RegisterName(reg()); |
| 68 case kXmmRegister: return Assembler::XmmRegisterName(xmm_reg()); | 84 case kXmmRegister: return Assembler::XmmRegisterName(xmm_reg()); |
| 69 case kStackSlot: return "S"; | 85 case kStackSlot: return "S"; |
| 70 case kDoubleStackSlot: return "DS"; | 86 case kDoubleStackSlot: return "DS"; |
| 71 case kUnallocated: | 87 case kUnallocated: |
| 72 switch (policy()) { | 88 switch (policy()) { |
| 73 case kAny: | 89 case kAny: |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 149 |
| 134 if (!out().IsInvalid()) { | 150 if (!out().IsInvalid()) { |
| 135 f->Print(" => "); | 151 f->Print(" => "); |
| 136 out().PrintTo(f); | 152 out().PrintTo(f); |
| 137 } | 153 } |
| 138 | 154 |
| 139 if (always_calls()) f->Print(" C"); | 155 if (always_calls()) f->Print(" C"); |
| 140 } | 156 } |
| 141 | 157 |
| 142 } // namespace dart | 158 } // namespace dart |
| OLD | NEW |