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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 270 |
271 const char* Name() const; | 271 const char* Name() const; |
272 void PrintTo(BufferFormatter* f) const; | 272 void PrintTo(BufferFormatter* f) const; |
273 void Print() const; | 273 void Print() const; |
274 | 274 |
275 // Compare two locations. | 275 // Compare two locations. |
276 bool Equals(Location other) const { | 276 bool Equals(Location other) const { |
277 return value_ == other.value_; | 277 return value_ == other.value_; |
278 } | 278 } |
279 | 279 |
| 280 // If current location is constant might return something that |
| 281 // is not equal to any Kind. |
| 282 Kind kind() const { |
| 283 return KindField::decode(value_); |
| 284 } |
| 285 |
280 private: | 286 private: |
281 explicit Location(uword value) : value_(value) { } | 287 explicit Location(uword value) : value_(value) { } |
282 | 288 |
283 Location(Kind kind, uword payload) | 289 Location(Kind kind, uword payload) |
284 : value_(KindField::encode(kind) | PayloadField::encode(payload)) { } | 290 : value_(KindField::encode(kind) | PayloadField::encode(payload)) { } |
285 | 291 |
286 uword payload() const { | 292 uword payload() const { |
287 return PayloadField::decode(value_); | 293 return PayloadField::decode(value_); |
288 } | 294 } |
289 | 295 |
290 // If current location is constant might return something that | |
291 // is not equal to any Kind. | |
292 Kind kind() const { | |
293 return KindField::decode(value_); | |
294 } | |
295 | |
296 typedef BitField<Kind, 0, kBitsForKind> KindField; | 296 typedef BitField<Kind, 0, kBitsForKind> KindField; |
297 typedef BitField<uword, kBitsForKind, kBitsForPayload> PayloadField; | 297 typedef BitField<uword, kBitsForKind, kBitsForPayload> PayloadField; |
298 | 298 |
299 // Layout for kUnallocated locations payload. | 299 // Layout for kUnallocated locations payload. |
300 typedef BitField<Policy, 0, 3> PolicyField; | 300 typedef BitField<Policy, 0, 3> PolicyField; |
301 | 301 |
302 // Layout for register locations payload. The representation bit is only used | 302 // Layout for register locations payload. The representation bit is only used |
303 // for XmmRegister and unused for Register. | 303 // for XmmRegister and unused for Register. |
304 static const intptr_t kBitsForRepresentation = 1; | 304 static const intptr_t kBitsForRepresentation = 1; |
305 static const intptr_t kBitsForRegister = | 305 static const intptr_t kBitsForRegister = |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 BitmapBuilder* stack_bitmap_; | 469 BitmapBuilder* stack_bitmap_; |
470 | 470 |
471 const ContainsCall contains_call_; | 471 const ContainsCall contains_call_; |
472 RegisterSet live_registers_; | 472 RegisterSet live_registers_; |
473 }; | 473 }; |
474 | 474 |
475 | 475 |
476 } // namespace dart | 476 } // namespace dart |
477 | 477 |
478 #endif // VM_LOCATIONS_H_ | 478 #endif // VM_LOCATIONS_H_ |
OLD | NEW |