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

Unified Diff: src/unique.h

Issue 300423003: Handle HCheckInstanceType and HIsStringAndBranch in check elimination. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 6 years, 7 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.cc ('k') | no next file » | 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 8ed26829012c3980139d1a5d71c6d053e70eebe4..8c7c47ed4fc0e3b76778226ba2dd359a73e6472b 100644
--- a/src/unique.h
+++ b/src/unique.h
@@ -275,6 +275,25 @@ class UniqueSet V8_FINAL : public ZoneObject {
return out;
}
+ // Returns a new set representing all elements from this set which are not in
+ // that set. O(|this| * |that|).
+ UniqueSet<T>* Subtract(const UniqueSet<T>* that, Zone* zone) const {
+ if (that->size_ == 0) return this->Copy(zone);
+
+ UniqueSet<T>* out = new(zone) UniqueSet<T>(this->size_, zone);
+
+ int i = 0, j = 0;
+ while (i < this->size_) {
+ Unique<T> cand = this->array_[i];
+ if (!that->Contains(cand)) {
+ out->array_[j++] = cand;
+ }
+ }
+
+ out->size_ = j;
+ return out;
+ }
+
// Makes an exact copy of this set. O(|this|).
UniqueSet<T>* Copy(Zone* zone) const {
UniqueSet<T>* copy = new(zone) UniqueSet<T>(this->size_, zone);
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698