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

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: Fix HCheckMaps and reduce HLoadNamedField of the map in check elimination. 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
« no previous file with comments | « src/hydrogen-instructions.h ('k') | test/cctest/test-unique.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
}
« no previous file with comments | « src/hydrogen-instructions.h ('k') | test/cctest/test-unique.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698