Chromium Code Reviews| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 void Remove(intptr_t i) { | 69 void Remove(intptr_t i) { |
| 70 ASSERT(i >= 0 && i < length()); | 70 ASSERT(i >= 0 && i < length()); |
| 71 data_[i / kBitsPerWord] &= ~(static_cast<uword>(1) << (i % kBitsPerWord)); | 71 data_[i / kBitsPerWord] &= ~(static_cast<uword>(1) << (i % kBitsPerWord)); |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool Equals(const BitVector& other) const; | 74 bool Equals(const BitVector& other) const; |
| 75 | 75 |
| 76 // Add all elements that are in the bitvector from. | 76 // Add all elements that are in the bitvector from. |
| 77 bool AddAll(const BitVector* from); | 77 bool AddAll(const BitVector* from); |
| 78 | 78 |
| 79 bool RemoveAll(const BitVector* from); | |
|
Florian Schneider
2012/12/13 13:17:13
Maybe add a short line what it does.
Vyacheslav Egorov (Google)
2012/12/13 14:02:59
Done.
| |
| 80 | |
| 79 // From the bitvector gen add those elements that are not in the | 81 // From the bitvector gen add those elements that are not in the |
| 80 // bitvector kill. | 82 // bitvector kill. |
| 81 bool KillAndAdd(BitVector* kill, BitVector* gen); | 83 bool KillAndAdd(BitVector* kill, BitVector* gen); |
| 82 | 84 |
| 83 void Intersect(const BitVector& other); | 85 void Intersect(const BitVector& other); |
| 84 | 86 |
| 85 bool Contains(int i) const { | 87 bool Contains(int i) const { |
| 86 ASSERT(i >= 0 && i < length()); | 88 ASSERT(i >= 0 && i < length()); |
| 87 uword block = data_[i / kBitsPerWord]; | 89 uword block = data_[i / kBitsPerWord]; |
| 88 return (block & (static_cast<uword>(1) << (i % kBitsPerWord))) != 0; | 90 return (block & (static_cast<uword>(1) << (i % kBitsPerWord))) != 0; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 108 intptr_t length_; | 110 intptr_t length_; |
| 109 intptr_t data_length_; | 111 intptr_t data_length_; |
| 110 uword* data_; | 112 uword* data_; |
| 111 | 113 |
| 112 DISALLOW_COPY_AND_ASSIGN(BitVector); | 114 DISALLOW_COPY_AND_ASSIGN(BitVector); |
| 113 }; | 115 }; |
| 114 | 116 |
| 115 } // namespace dart | 117 } // namespace dart |
| 116 | 118 |
| 117 #endif // VM_BIT_VECTOR_H_ | 119 #endif // VM_BIT_VECTOR_H_ |
| OLD | NEW |