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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 | 42 |
43 // Register location represents a fixed register. Payload contains | 43 // Register location represents a fixed register. Payload contains |
44 // register code. | 44 // register code. |
45 kRegister = 3, | 45 kRegister = 3, |
46 | 46 |
47 // Spill slot allocated by the register allocator. Payload contains | 47 // Spill slot allocated by the register allocator. Payload contains |
48 // a spill index. | 48 // a spill index. |
49 kStackSlot = 4, | 49 kStackSlot = 4, |
50 }; | 50 }; |
51 | 51 |
52 enum ContainsCall { | |
Kevin Millikin (Google)
2012/07/31 11:06:09
I moved this here because the name is shorter at t
Vyacheslav Egorov (Google)
2012/07/31 11:21:26
But it is not a property of location, it's a prope
| |
53 kNoCall, | |
54 kCall, | |
55 }; | |
56 | |
52 enum { | 57 enum { |
53 // Number of bits required to encode Kind value. | 58 // Number of bits required to encode Kind value. |
54 kBitsForKind = 3, | 59 kBitsForKind = 3, |
55 kBitsForPayload = kWordSize * kBitsPerByte - kBitsForKind | 60 kBitsForPayload = kWordSize * kBitsPerByte - kBitsForKind, |
56 }; | 61 }; |
57 | 62 |
58 static const uword kInvalidLocation = 0; | 63 static const uword kInvalidLocation = 0; |
59 static const uword kConstantMask = 0x3; | 64 static const uword kConstantMask = 0x3; |
60 | 65 |
61 Location() : value_(kInvalidLocation) { | 66 Location() : value_(kInvalidLocation) { |
62 ASSERT(IsInvalid()); | 67 ASSERT(IsInvalid()); |
63 } | 68 } |
64 | 69 |
65 bool IsInvalid() const { | 70 bool IsInvalid() const { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 // Location either contains kind and payload fields or a tagged handle for | 207 // Location either contains kind and payload fields or a tagged handle for |
203 // a constant locations. Values of enumeration Kind are selected in such a | 208 // a constant locations. Values of enumeration Kind are selected in such a |
204 // way that none of them can be interpreted as a kConstant tag. | 209 // way that none of them can be interpreted as a kConstant tag. |
205 uword value_; | 210 uword value_; |
206 }; | 211 }; |
207 | 212 |
208 | 213 |
209 // Specification of locations for inputs and output. | 214 // Specification of locations for inputs and output. |
210 class LocationSummary : public ZoneAllocated { | 215 class LocationSummary : public ZoneAllocated { |
211 public: | 216 public: |
212 enum ContainsCall { | |
213 kNoCall, | |
214 kCall, | |
215 }; | |
216 | |
217 // TODO(vegorov): remove unsafe kNoCall default. | |
218 LocationSummary(intptr_t input_count, | 217 LocationSummary(intptr_t input_count, |
219 intptr_t temp_count, | 218 intptr_t temp_count, |
220 ContainsCall call = kNoCall); | 219 Location::ContainsCall contains_call); |
221 | 220 |
222 intptr_t input_count() const { | 221 intptr_t input_count() const { |
223 return input_locations_.length(); | 222 return input_locations_.length(); |
224 } | 223 } |
225 | 224 |
226 Location in(intptr_t index) const { | 225 Location in(intptr_t index) const { |
227 return input_locations_[index]; | 226 return input_locations_[index]; |
228 } | 227 } |
229 | 228 |
230 Location* in_slot(intptr_t index) { | 229 Location* in_slot(intptr_t index) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
268 } | 267 } |
269 | 268 |
270 bool is_call() const { | 269 bool is_call() const { |
271 return is_call_; | 270 return is_call_; |
272 } | 271 } |
273 | 272 |
274 void PrintTo(BufferFormatter* f) const; | 273 void PrintTo(BufferFormatter* f) const; |
275 | 274 |
276 static LocationSummary* Make(intptr_t input_count, | 275 static LocationSummary* Make(intptr_t input_count, |
277 Location out, | 276 Location out, |
278 ContainsCall contains_call = kNoCall); | 277 Location::ContainsCall contains_call); |
279 | 278 |
280 private: | 279 private: |
281 // TODO(vegorov): replace with ZoneArray. | 280 // TODO(vegorov): replace with ZoneArray. |
282 GrowableArray<Location> input_locations_; | 281 GrowableArray<Location> input_locations_; |
283 GrowableArray<Location> temp_locations_; | 282 GrowableArray<Location> temp_locations_; |
284 Location output_location_; | 283 Location output_location_; |
285 | 284 |
286 const bool is_call_; | 285 const bool is_call_; |
287 }; | 286 }; |
288 | 287 |
289 | 288 |
290 } // namespace dart | 289 } // namespace dart |
291 | 290 |
292 #endif // VM_LOCATIONS_H_ | 291 #endif // VM_LOCATIONS_H_ |
OLD | NEW |