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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 for (intptr_t i = 0; i < input_count; i++) { | 53 for (intptr_t i = 0; i < input_count; i++) { |
54 summary->set_in(i, Location::RequiresRegister()); | 54 summary->set_in(i, Location::RequiresRegister()); |
55 } | 55 } |
56 summary->set_out(out); | 56 summary->set_out(out); |
57 return summary; | 57 return summary; |
58 } | 58 } |
59 | 59 |
60 | 60 |
61 Location Location::RegisterOrConstant(Value* value) { | 61 Location Location::RegisterOrConstant(Value* value) { |
62 ConstantInstr* constant = value->definition()->AsConstant(); | 62 ConstantInstr* constant = value->definition()->AsConstant(); |
63 return (constant != NULL) | 63 return ((constant != NULL) && Assembler::IsSafe(constant->value())) |
64 ? Location::Constant(constant->value()) | 64 ? Location::Constant(constant->value()) |
65 : Location::RequiresRegister(); | 65 : Location::RequiresRegister(); |
66 } | 66 } |
67 | 67 |
68 | 68 |
69 Location Location::RegisterOrSmiConstant(Value* value) { | 69 Location Location::RegisterOrSmiConstant(Value* value) { |
70 ConstantInstr* constant = value->definition()->AsConstant(); | 70 ConstantInstr* constant = value->definition()->AsConstant(); |
71 return ((constant != NULL) && constant->value().IsSmi()) | 71 return ((constant != NULL) && Assembler::IsSafeSmi(constant->value())) |
72 ? Location::Constant(constant->value()) | 72 ? Location::Constant(constant->value()) |
73 : Location::RequiresRegister(); | 73 : Location::RequiresRegister(); |
74 } | 74 } |
75 | 75 |
76 | 76 |
77 Location Location::FixedRegisterOrConstant(Value* value, Register reg) { | 77 Location Location::FixedRegisterOrConstant(Value* value, Register reg) { |
78 ConstantInstr* constant = value->definition()->AsConstant(); | 78 ConstantInstr* constant = value->definition()->AsConstant(); |
79 return (constant != NULL) | 79 return ((constant != NULL) && Assembler::IsSafe(constant->value())) |
80 ? Location::Constant(constant->value()) | 80 ? Location::Constant(constant->value()) |
81 : Location::RegisterLocation(reg); | 81 : Location::RegisterLocation(reg); |
82 } | 82 } |
83 | 83 |
84 | 84 |
85 Location Location::FixedRegisterOrSmiConstant(Value* value, Register reg) { | 85 Location Location::FixedRegisterOrSmiConstant(Value* value, Register reg) { |
86 ConstantInstr* constant = value->definition()->AsConstant(); | 86 ConstantInstr* constant = value->definition()->AsConstant(); |
87 return ((constant != NULL) && constant->value().IsSmi()) | 87 return ((constant != NULL) && Assembler::IsSafeSmi(constant->value())) |
88 ? Location::Constant(constant->value()) | 88 ? Location::Constant(constant->value()) |
89 : Location::RegisterLocation(reg); | 89 : Location::RegisterLocation(reg); |
90 } | 90 } |
91 | 91 |
92 | 92 |
93 Location Location::AnyOrConstant(Value* value) { | 93 Location Location::AnyOrConstant(Value* value) { |
94 ConstantInstr* constant = value->definition()->AsConstant(); | 94 ConstantInstr* constant = value->definition()->AsConstant(); |
95 return (constant != NULL) | 95 return ((constant != NULL) && Assembler::IsSafe(constant->value())) |
96 ? Location::Constant(constant->value()) | 96 ? Location::Constant(constant->value()) |
97 : Location::Any(); | 97 : Location::Any(); |
98 } | 98 } |
99 | 99 |
100 | 100 |
101 Address Location::ToStackSlotAddress() const { | 101 Address Location::ToStackSlotAddress() const { |
102 const intptr_t index = stack_index(); | 102 const intptr_t index = stack_index(); |
103 if (index < 0) { | 103 if (index < 0) { |
104 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize; | 104 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize; |
105 return Address(FPREG, offset); | 105 return Address(FPREG, offset); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 if (!out().IsInvalid()) { | 196 if (!out().IsInvalid()) { |
197 f->Print(" => "); | 197 f->Print(" => "); |
198 out().PrintTo(f); | 198 out().PrintTo(f); |
199 } | 199 } |
200 | 200 |
201 if (always_calls()) f->Print(" C"); | 201 if (always_calls()) f->Print(" C"); |
202 } | 202 } |
203 | 203 |
204 } // namespace dart | 204 } // namespace dart |
OLD | NEW |