| 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 #include "vm/bit_vector.h" | 5 #include "vm/bit_vector.h" |
| 6 | 6 |
| 7 #include "vm/os.h" | 7 #include "vm/os.h" |
| 8 | 8 |
| 9 namespace dart { | 9 namespace dart { |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 return true; | 48 return true; |
| 49 } | 49 } |
| 50 | 50 |
| 51 | 51 |
| 52 bool BitVector::AddAll(const BitVector* from) { | 52 bool BitVector::AddAll(const BitVector* from) { |
| 53 ASSERT(data_length_ == from->data_length_); | 53 ASSERT(data_length_ == from->data_length_); |
| 54 bool changed = false; | 54 bool changed = false; |
| 55 for (intptr_t i = 0; i < data_length_; i++) { | 55 for (intptr_t i = 0; i < data_length_; i++) { |
| 56 const uword before = data_[i]; | 56 const uword before = data_[i]; |
| 57 const uword after = data_[i] | from->data_[i]; | 57 const uword after = data_[i] | from->data_[i]; |
| 58 if (before != after) changed = true; | 58 if (before != after) { |
| 59 data_[i] = after; | 59 changed = true; |
| 60 data_[i] = after; |
| 61 } |
| 60 } | 62 } |
| 61 return changed; | 63 return changed; |
| 62 } | 64 } |
| 63 | 65 |
| 64 | 66 |
| 65 bool BitVector::RemoveAll(const BitVector* from) { | 67 bool BitVector::RemoveAll(const BitVector* from) { |
| 66 ASSERT(data_length_ == from->data_length_); | 68 ASSERT(data_length_ == from->data_length_); |
| 67 bool changed = false; | 69 bool changed = false; |
| 68 for (intptr_t i = 0; i < data_length_; i++) { | 70 for (intptr_t i = 0; i < data_length_; i++) { |
| 69 const uword before = data_[i]; | 71 const uword before = data_[i]; |
| 70 const uword after = data_[i] & ~from->data_[i]; | 72 const uword after = data_[i] & ~from->data_[i]; |
| 71 if (before != after) changed = true; | 73 if (before != after) { |
| 72 data_[i] = after; | 74 changed = true; |
| 75 data_[i] = after; |
| 76 } |
| 73 } | 77 } |
| 74 return changed; | 78 return changed; |
| 75 } | 79 } |
| 76 | 80 |
| 77 bool BitVector::KillAndAdd(BitVector* kill, BitVector* gen) { | 81 bool BitVector::KillAndAdd(BitVector* kill, BitVector* gen) { |
| 78 ASSERT(data_length_ == kill->data_length_); | 82 ASSERT(data_length_ == kill->data_length_); |
| 79 ASSERT(data_length_ == gen->data_length_); | 83 ASSERT(data_length_ == gen->data_length_); |
| 80 bool changed = false; | 84 bool changed = false; |
| 81 for (intptr_t i = 0; i < data_length_; i++) { | 85 for (intptr_t i = 0; i < data_length_; i++) { |
| 82 const uword before = data_[i]; | 86 const uword before = data_[i]; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 98 | 102 |
| 99 void BitVector::Print() const { | 103 void BitVector::Print() const { |
| 100 OS::Print("["); | 104 OS::Print("["); |
| 101 for (intptr_t i = 0; i < length_; i++) { | 105 for (intptr_t i = 0; i < length_; i++) { |
| 102 OS::Print(Contains(i) ? "1" : "0"); | 106 OS::Print(Contains(i) ? "1" : "0"); |
| 103 } | 107 } |
| 104 OS::Print("]"); | 108 OS::Print("]"); |
| 105 } | 109 } |
| 106 | 110 |
| 107 } // namespace dart | 111 } // namespace dart |
| OLD | NEW |