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

Unified Diff: runtime/vm/bit_vector.cc

Issue 10377104: Compute assigned variables and dominance frontiers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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
Index: runtime/vm/bit_vector.cc
diff --git a/runtime/vm/bit_vector.cc b/runtime/vm/bit_vector.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e828cfa424913af8ab76c25a6d213f5da2b03734
--- /dev/null
+++ b/runtime/vm/bit_vector.cc
@@ -0,0 +1,52 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#include "vm/bit_vector.h"
+
+#include "vm/os.h"
+
+namespace dart {
+
+#ifdef DEBUG
+void BitVector::Print() {
+ bool first = true;
+ OS::Print("{");
+ for (int i = 0; i < length(); i++) {
+ if (Contains(i)) {
+ if (!first) OS::Print(",");
+ first = false;
+ OS::Print("%d", i);
+ }
+ }
+ OS::Print("}");
+}
+#endif
+
+
+void BitVector::Iterator::Advance() {
+ ++bit_index_;
+ // Skip zero words.
+ if (current_word_ == 0) {
+ do {
+ ++word_index_;
+ if (Done()) return;
+ current_word_ = target_->data_[word_index_];
+ } while (current_word_ == 0);
+ bit_index_ = current_word_ * sizeof(uword);
+ }
+ // Skip zero bytes.
+ while ((current_word_ & 0xff) == 0) {
+ current_word_ >>= 8;
+ bit_index_ += 8;
+ }
+ // Skip zero bits.
+ while ((current_word_ & 0x1) == 0) {
+ current_word_ >>= 1;
+ ++bit_index_;
+ }
+ current_word_ = current_word_ >> 1;
+}
+
+
+} // namespace dart

Powered by Google App Engine
This is Rietveld 408576698