Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/data-flow.h" | 5 #include "src/data-flow.h" |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/scopes.h" | 8 #include "src/scopes.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 PrintF("%d", i); | 21 PrintF("%d", i); |
| 22 } | 22 } |
| 23 } | 23 } |
| 24 PrintF("}"); | 24 PrintF("}"); |
| 25 } | 25 } |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 | 28 |
| 29 void BitVector::Iterator::Advance() { | 29 void BitVector::Iterator::Advance() { |
| 30 current_++; | 30 current_++; |
| 31 uint32_t val = current_value_; | 31 uintptr_t val = current_value_; |
| 32 while (val == 0) { | 32 while (val == 0) { |
| 33 current_index_++; | 33 current_index_++; |
| 34 if (Done()) return; | 34 if (Done()) return; |
| 35 val = target_->data_[current_index_]; | 35 val = target_->data_[current_index_]; |
| 36 current_ = current_index_ << 5; | 36 current_ = current_index_ << kDataBitShift; |
| 37 } | 37 } |
| 38 val = SkipZeroBytes(val); | 38 val = SkipZeroBytes(val); |
| 39 val = SkipZeroBits(val); | 39 val = SkipZeroBits(val); |
| 40 current_value_ = val >> 1; | 40 current_value_ = val >> 1; |
| 41 } | 41 } |
| 42 | 42 |
| 43 | 43 |
| 44 int BitVector::Count() const { | 44 int BitVector::Count() const { |
| 45 int count = 0; | 45 int count = 0; |
| 46 for (int i = 0; i < data_length_; i++) { | 46 for (int i = 0; i < data_length_; i++) { |
| 47 int data = data_[i]; | 47 uintptr_t data = data_[i]; |
| 48 if (data != 0) count += base::bits::CountPopulation32(data); | 48 if (data != 0) { |
| 49 if (sizeof(data) == 8) { | |
| 50 count += base::bits::CountPopulation64(data); | |
|
Sven Panne
2014/10/31 10:18:54
Not really related to your CL, but I think we shou
| |
| 51 } else { | |
| 52 count += base::bits::CountPopulation32(data); | |
| 53 } | |
| 54 } | |
| 49 } | 55 } |
| 50 return count; | 56 return count; |
| 51 } | 57 } |
| 52 | 58 |
| 53 } // namespace internal | 59 } // namespace internal |
| 54 } // namespace v8 | 60 } // namespace v8 |
| OLD | NEW |