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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 { | 52 enum { |
53 // Number of bits required to encode Kind value. | 53 // Number of bits required to encode Kind value. |
54 kBitsForKind = 3, | 54 kBitsForKind = 3, |
55 kBitsForPayload = kWordSize * kBitsPerByte - kBitsForKind | 55 kBitsForPayload = kWordSize * kBitsPerByte - kBitsForKind, |
56 }; | 56 }; |
57 | 57 |
58 static const uword kInvalidLocation = 0; | 58 static const uword kInvalidLocation = 0; |
59 static const uword kConstantMask = 0x3; | 59 static const uword kConstantMask = 0x3; |
60 | 60 |
61 Location() : value_(kInvalidLocation) { | 61 Location() : value_(kInvalidLocation) { |
62 ASSERT(IsInvalid()); | 62 ASSERT(IsInvalid()); |
63 } | 63 } |
64 | 64 |
65 bool IsInvalid() const { | 65 bool IsInvalid() const { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 207 |
208 | 208 |
209 // Specification of locations for inputs and output. | 209 // Specification of locations for inputs and output. |
210 class LocationSummary : public ZoneAllocated { | 210 class LocationSummary : public ZoneAllocated { |
211 public: | 211 public: |
212 enum ContainsCall { | 212 enum ContainsCall { |
213 kNoCall, | 213 kNoCall, |
214 kCall, | 214 kCall, |
215 }; | 215 }; |
216 | 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 LocationSummary::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 LocationSummary::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 |