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

Unified Diff: runtime/vm/bit_vector.h

Issue 10666026: Simple iterative liveness analysis over SSA. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 | « no previous file | runtime/vm/compiler.cc » ('j') | runtime/vm/compiler.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/bit_vector.h
diff --git a/runtime/vm/bit_vector.h b/runtime/vm/bit_vector.h
index 6faba2d2486a842586192e50ed35a746a13d6f3d..056223f436f4e0a97e73ec074a9db3e46214c75c 100644
--- a/runtime/vm/bit_vector.h
+++ b/runtime/vm/bit_vector.h
@@ -63,6 +63,31 @@ class BitVector: public ZoneAllocated {
data_[i / kBitsPerWord] |= (static_cast<uword>(1) << (i % kBitsPerWord));
}
+ bool AddAll(BitVector* from) {
Florian Schneider 2012/06/25 14:38:29 Maybe add a test to bit_vector_test.cc that covers
Vyacheslav Egorov (Google) 2012/06/25 16:58:26 Done.
srdjan 2012/06/25 17:30:05 The two methods seem to complex for header file, I
+ ASSERT(data_length_ == from->data_length_);
+ bool changed = false;
+ for (intptr_t i = 0; i < data_length_; i++) {
+ const uword before = data_[i];
+ const uword after = data_[i] | from->data_[i];
+ if (before != after) changed = true;
+ data_[i] = after;
+ }
+ return changed;
+ }
+
+ bool KillAndAdd(BitVector* kill, BitVector* gen) {
Florian Schneider 2012/06/25 14:38:29 Add a comment what this computes: sth like this +
Vyacheslav Egorov (Google) 2012/06/25 16:58:26 Done.
+ ASSERT(data_length_ == kill->data_length_);
+ ASSERT(data_length_ == gen->data_length_);
srdjan 2012/06/25 17:30:05 It may be clearer to have Kill without Add, do you
Vyacheslav Egorov (Google) 2012/06/25 17:42:23 It's not easy to have Kill without Add because we
+ bool changed = false;
+ for (intptr_t i = 0; i < data_length_; i++) {
+ const uword before = data_[i];
+ const uword after = data_[i] | (gen->data_[i] & ~kill->data_[i]);
+ if (before != after) changed = true;
+ data_[i] = after;
+ }
+ return changed;
+ }
+
bool Contains(int i) const {
ASSERT(i >= 0 && i < length());
uword block = data_[i / kBitsPerWord];
« no previous file with comments | « no previous file | runtime/vm/compiler.cc » ('j') | runtime/vm/compiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698