| 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_BIT_VECTOR_H_ | 5 #ifndef VM_BIT_VECTOR_H_ |
| 6 #define VM_BIT_VECTOR_H_ | 6 #define VM_BIT_VECTOR_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/zone.h" | 10 #include "vm/zone.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 static intptr_t SizeFor(intptr_t length) { | 57 static intptr_t SizeFor(intptr_t length) { |
| 58 return 1 + ((length - 1) / kBitsPerWord); | 58 return 1 + ((length - 1) / kBitsPerWord); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void Add(intptr_t i) { | 61 void Add(intptr_t i) { |
| 62 ASSERT(i >= 0 && i < length()); | 62 ASSERT(i >= 0 && i < length()); |
| 63 data_[i / kBitsPerWord] |= (static_cast<uword>(1) << (i % kBitsPerWord)); | 63 data_[i / kBitsPerWord] |= (static_cast<uword>(1) << (i % kBitsPerWord)); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void Remove(intptr_t i) { |
| 67 ASSERT(i >= 0 && i < length()); |
| 68 data_[i / kBitsPerWord] &= ~(static_cast<uword>(1) << (i % kBitsPerWord)); |
| 69 } |
| 70 |
| 66 // Add all elements that are in the bitvector from. | 71 // Add all elements that are in the bitvector from. |
| 67 bool AddAll(BitVector* from); | 72 bool AddAll(BitVector* from); |
| 68 | 73 |
| 69 // From the bitvector gen add those elements that are not in the | 74 // From the bitvector gen add those elements that are not in the |
| 70 // bitvector kill. | 75 // bitvector kill. |
| 71 bool KillAndAdd(BitVector* kill, BitVector* gen); | 76 bool KillAndAdd(BitVector* kill, BitVector* gen); |
| 72 | 77 |
| 73 bool Contains(int i) const { | 78 bool Contains(int i) const { |
| 74 ASSERT(i >= 0 && i < length()); | 79 ASSERT(i >= 0 && i < length()); |
| 75 uword block = data_[i / kBitsPerWord]; | 80 uword block = data_[i / kBitsPerWord]; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 88 intptr_t length_; | 93 intptr_t length_; |
| 89 intptr_t data_length_; | 94 intptr_t data_length_; |
| 90 uword* data_; | 95 uword* data_; |
| 91 | 96 |
| 92 DISALLOW_COPY_AND_ASSIGN(BitVector); | 97 DISALLOW_COPY_AND_ASSIGN(BitVector); |
| 93 }; | 98 }; |
| 94 | 99 |
| 95 } // namespace dart | 100 } // namespace dart |
| 96 | 101 |
| 97 #endif // VM_BIT_VECTOR_H_ | 102 #endif // VM_BIT_VECTOR_H_ |
| OLD | NEW |