| Index: src/unique.h
|
| diff --git a/src/unique.h b/src/unique.h
|
| index fdb7016d799376f5dd390a1a2a4ca5f6f6ce768f..a93b04699350dddc4aa9de528eba9abfbd199177 100644
|
| --- a/src/unique.h
|
| +++ b/src/unique.h
|
| @@ -120,6 +120,10 @@ class Unique V8_FINAL {
|
| 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 @@ 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;
|
| @@ -273,6 +288,10 @@ class UniqueSet V8_FINAL : public ZoneObject {
|
| return copy;
|
| }
|
|
|
| + void Clear() {
|
| + size_ = 0;
|
| + }
|
| +
|
| inline int size() const {
|
| return size_;
|
| }
|
|
|