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 #ifndef VM_LOCATIONS_H_ | 5 #ifndef VM_LOCATIONS_H_ |
6 #define VM_LOCATIONS_H_ | 6 #define VM_LOCATIONS_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/bitfield.h" | 10 #include "vm/bitfield.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 ASSERT((kConstant & kConstantMask) == kConstant); | 55 ASSERT((kConstant & kConstantMask) == kConstant); |
56 return (value_ & kConstantMask) == kConstant; | 56 return (value_ & kConstantMask) == kConstant; |
57 } | 57 } |
58 | 58 |
59 static Location Constant(const Object& obj) { | 59 static Location Constant(const Object& obj) { |
60 Location loc(reinterpret_cast<uword>(&obj) | kConstant); | 60 Location loc(reinterpret_cast<uword>(&obj) | kConstant); |
61 ASSERT(&obj == &loc.constant()); | 61 ASSERT(&obj == &loc.constant()); |
62 return loc; | 62 return loc; |
63 } | 63 } |
64 | 64 |
65 const Object& constant() { | 65 const Object& constant() const { |
66 ASSERT(IsConstant()); | 66 ASSERT(IsConstant()); |
67 return *reinterpret_cast<const Object*>(value_ & ~kConstantMask); | 67 return *reinterpret_cast<const Object*>(value_ & ~kConstantMask); |
68 } | 68 } |
69 | 69 |
70 // Unallocated locations. | 70 // Unallocated locations. |
71 enum Policy { | 71 enum Policy { |
72 kRequiresRegister, | 72 kRequiresRegister, |
73 kSameAsFirstInput, | 73 kSameAsFirstInput, |
74 }; | 74 }; |
75 | 75 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 class LocationSummary : public ZoneAllocated { | 157 class LocationSummary : public ZoneAllocated { |
158 public: | 158 public: |
159 enum ContainsCall { | 159 enum ContainsCall { |
160 kNoCall, | 160 kNoCall, |
161 kCall, | 161 kCall, |
162 }; | 162 }; |
163 | 163 |
164 // TODO(vegorov): remove unsafe kNoCall default. | 164 // TODO(vegorov): remove unsafe kNoCall default. |
165 LocationSummary(intptr_t input_count, | 165 LocationSummary(intptr_t input_count, |
166 intptr_t temp_count, | 166 intptr_t temp_count, |
167 ContainsCall call = kNoCall) | 167 ContainsCall call = kNoCall); |
168 : input_locations_(input_count), | |
169 temp_locations_(temp_count), | |
170 output_location_(), | |
171 is_call_(call == kCall) { | |
172 for (intptr_t i = 0; i < input_count; i++) { | |
173 input_locations_.Add(Location()); | |
174 } | |
175 for (intptr_t i = 0; i < temp_count; i++) { | |
176 temp_locations_.Add(Location()); | |
177 } | |
178 } | |
179 | 168 |
180 intptr_t input_count() const { | 169 intptr_t input_count() const { |
181 return input_locations_.length(); | 170 return input_locations_.length(); |
182 } | 171 } |
183 | 172 |
184 Location in(intptr_t index) const { | 173 Location in(intptr_t index) const { |
185 return input_locations_[index]; | 174 return input_locations_[index]; |
186 } | 175 } |
187 | 176 |
188 Location* in_slot(intptr_t index) { | 177 Location* in_slot(intptr_t index) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 GrowableArray<Location> temp_locations_; | 227 GrowableArray<Location> temp_locations_; |
239 Location output_location_; | 228 Location output_location_; |
240 | 229 |
241 const bool is_call_; | 230 const bool is_call_; |
242 }; | 231 }; |
243 | 232 |
244 | 233 |
245 } // namespace dart | 234 } // namespace dart |
246 | 235 |
247 #endif // VM_LOCATIONS_H_ | 236 #endif // VM_LOCATIONS_H_ |
OLD | NEW |