Version 3.22.3
Added methods to enable configuration of ResourceConstraints based on limits derived at runtime. (Chromium issue 292928)
Added -optimize-for-size flag to optimize for memory size (will be used by pre-aging CL), and removed the is_memory_constrained ResourceConstraint. (Chromium issue 292928)
Performance and stability improvements on all platforms.
git-svn-id: http://v8.googlecode.com/svn/trunk@16974 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/unique.h b/src/unique.h
index fdb7016..a93b046 100644
--- a/src/unique.h
+++ b/src/unique.h
@@ -120,6 +120,10 @@
return handle_;
}
+ template <class S> static Unique<T> cast(Unique<S> that) {
+ return Unique<T>(that.raw_address_, Handle<T>::cast(that.handle_));
+ }
+
inline bool IsInitialized() const {
return raw_address_ != NULL || handle_.is_null();
}
@@ -169,6 +173,17 @@
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;
@@ -273,6 +288,10 @@
return copy;
}
+ void Clear() {
+ size_ = 0;
+ }
+
inline int size() const {
return size_;
}