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_; |
} |