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 #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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 SmallSet() : data_(0) { } | 452 SmallSet() : data_(0) { } |
453 | 453 |
454 explicit SmallSet(intptr_t data) : data_(data) { } | 454 explicit SmallSet(intptr_t data) : data_(data) { } |
455 | 455 |
456 bool Contains(T value) const { return (data_ & ToMask(value)) != 0; } | 456 bool Contains(T value) const { return (data_ & ToMask(value)) != 0; } |
457 | 457 |
458 void Add(T value) { data_ |= ToMask(value); } | 458 void Add(T value) { data_ |= ToMask(value); } |
459 | 459 |
460 void Remove(T value) { data_ &= ~ToMask(value); } | 460 void Remove(T value) { data_ &= ~ToMask(value); } |
461 | 461 |
462 bool IsEmpty() const { return data_ != 0; } | 462 bool IsEmpty() const { return data_ == 0; } |
463 | 463 |
464 intptr_t data() const { return data_; } | 464 intptr_t data() const { return data_; } |
465 | 465 |
466 private: | 466 private: |
467 static intptr_t ToMask(T value) { | 467 static intptr_t ToMask(T value) { |
468 ASSERT(static_cast<intptr_t>(value) < (kWordSize * kBitsPerByte)); | 468 ASSERT(static_cast<intptr_t>(value) < (kWordSize * kBitsPerByte)); |
469 return 1 << static_cast<intptr_t>(value); | 469 return 1 << static_cast<intptr_t>(value); |
470 } | 470 } |
471 | 471 |
472 intptr_t data_; | 472 intptr_t data_; |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 | 709 |
710 #if defined(DEBUG) | 710 #if defined(DEBUG) |
711 intptr_t writable_inputs_; | 711 intptr_t writable_inputs_; |
712 #endif | 712 #endif |
713 }; | 713 }; |
714 | 714 |
715 | 715 |
716 } // namespace dart | 716 } // namespace dart |
717 | 717 |
718 #endif // VM_LOCATIONS_H_ | 718 #endif // VM_LOCATIONS_H_ |
OLD | NEW |