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

Unified Diff: src/elements-kind.cc

Issue 11365174: A change in the way we place TransitionElementKinds in the tree. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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
Index: src/elements-kind.cc
diff --git a/src/elements-kind.cc b/src/elements-kind.cc
index 7b1651a953fc8120f4c1a29fcb9bef77c330e62c..792c334286c36aa060ae1dd53d9ec09f5a65e4da 100644
--- a/src/elements-kind.cc
+++ b/src/elements-kind.cc
@@ -136,4 +136,27 @@ bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind,
}
+ElementsKind GetUnifiedFastElementsKind(ElementsKind e1, ElementsKind e2) {
+ ASSERT(IsFastElementsKind(e1));
+ ASSERT(IsFastElementsKind(e2));
danno 2012/11/14 15:28:18 I think you can simplify this code: int i1 = GetS
mvstanton 2012/11/16 15:15:06 Done.
+ if (e1 == e2) {
+ return e1;
+ }
+
+ int i1 = GetSequenceIndexFromFastElementsKind(e1);
+ int i2 = GetSequenceIndexFromFastElementsKind(e2);
+ ASSERT(i1 != i2);
+ int max = i1 > i2 ? i1 : i2;
+ int min = i1 < i2 ? i1 : i2;
+ // The only reason not to take the max as the result is if the max is packed and the
+ // min is holey
+ ElementsKind eMax = GetFastElementsKindFromSequenceIndex(max);
+ ElementsKind eMin = GetFastElementsKindFromSequenceIndex(min);
+ if (IsFastPackedElementsKind(eMax) && !IsFastPackedElementsKind(eMin)) {
+ return GetNextMoreGeneralFastElementsKind(eMin, false);
+ }
+ return eMax;
+}
+
+
} } // namespace v8::internal

Powered by Google App Engine
This is Rietveld 408576698