Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: src/bit-vector.cc

Issue 683243005: convert BitVector to use pointer size blocks (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/bit-vector.h ('k') | src/compiler/ast-loop-assignment-analyzer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bit-vector.cc
diff --git a/src/data-flow.cc b/src/bit-vector.cc
similarity index 74%
rename from src/data-flow.cc
rename to src/bit-vector.cc
index bd92ea0531511b0b970a32e6fa4dddb73c42a085..198b24273c2c2cf032cbf90e9d5bb998d540792b 100644
--- a/src/data-flow.cc
+++ b/src/bit-vector.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/data-flow.h"
+#include "src/bit-vector.h"
#include "src/base/bits.h"
#include "src/scopes.h"
@@ -28,12 +28,12 @@ void BitVector::Print() {
void BitVector::Iterator::Advance() {
current_++;
- uint32_t val = current_value_;
+ uintptr_t val = current_value_;
while (val == 0) {
current_index_++;
if (Done()) return;
val = target_->data_[current_index_];
- current_ = current_index_ << 5;
+ current_ = current_index_ << kDataBitShift;
}
val = SkipZeroBytes(val);
val = SkipZeroBits(val);
@@ -44,8 +44,12 @@ void BitVector::Iterator::Advance() {
int BitVector::Count() const {
int count = 0;
for (int i = 0; i < data_length_; i++) {
- int data = data_[i];
- if (data != 0) count += base::bits::CountPopulation32(data);
+ uintptr_t data = data_[i];
+ if (sizeof(data) == 8) {
+ count += base::bits::CountPopulation64(data);
+ } else {
+ count += base::bits::CountPopulation32(static_cast<uint32_t>(data));
+ }
}
return count;
}
« no previous file with comments | « src/bit-vector.h ('k') | src/compiler/ast-loop-assignment-analyzer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698