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

Unified Diff: src/unique.h

Issue 23866016: Implement local check elimination on basic blocks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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: src/unique.h
diff --git a/src/unique.h b/src/unique.h
index 68166541bce4ff796eb49eb788614def857c4457..30264ffb63afd8a7060896ad0b54b9fce2d069a1 100644
--- a/src/unique.h
+++ b/src/unique.h
@@ -162,6 +162,17 @@ class UniqueSet V8_FINAL : public ZoneObject {
array_[size_++] = uniq;
}
+ // Remove an element from this set. Mutates this set. O(|this|)
+ void Remove(Unique<T> uniq) {
+ for (int i = 0; i < size_; i++) {
+ if (array_[i] == uniq) {
+ while (++i < size_) array_[i - 1] = array_[i];
+ size_--;
+ return;
+ }
+ }
+ }
+
// Compare this set against another set. O(|this|).
bool Equals(UniqueSet<T>* that) const {
if (that->size_ != this->size_) return false;
@@ -265,6 +276,10 @@ class UniqueSet V8_FINAL : public ZoneObject {
return copy;
}
+ void Clear() {
+ size_ = 0;
+ }
+
inline int size() const {
return size_;
}

Powered by Google App Engine
This is Rietveld 408576698