Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index b2b3a6183047e2cc0290e2a28fec101b0289e9fb..39e395025190b248ff259dc323152a8e87b01234 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -186,6 +186,7 @@ class LChunkBuilder; |
V(InobjectFields) \ |
V(BackingStoreFields) \ |
V(ElementsKind) \ |
+ V(ElementsPointer) \ |
V(ArrayElements) \ |
V(DoubleArrayElements) \ |
V(SpecializedArrayElements) \ |
@@ -646,6 +647,18 @@ class HValue: public ZoneObject { |
return gvn_flags_.ContainsAnyOf(AllObservableSideEffectsFlagSet()); |
} |
+ GVNFlagSet DependsOnFlags() const { |
+ GVNFlagSet result = gvn_flags_; |
+ result.Intersect(AllDependsOnFlagSet()); |
+ return result; |
+ } |
+ |
+ GVNFlagSet SideEffectFlags() const { |
+ GVNFlagSet result = gvn_flags_; |
+ result.Intersect(AllSideEffectsFlagSet()); |
+ return result; |
+ } |
+ |
GVNFlagSet ChangesFlags() const { |
GVNFlagSet result = gvn_flags_; |
result.Intersect(AllChangesFlagSet()); |
@@ -722,6 +735,15 @@ class HValue: public ZoneObject { |
representation_ = r; |
} |
+ static GVNFlagSet AllDependsOnFlagSet() { |
+ GVNFlagSet result; |
+ // Create changes mask. |
+#define ADD_FLAG(type) result.Add(kDependsOn##type); |
+ GVN_FLAG_LIST(ADD_FLAG) |
+#undef ADD_FLAG |
+ return result; |
+ } |
+ |
static GVNFlagSet AllChangesFlagSet() { |
GVNFlagSet result; |
// Create changes mask. |
@@ -743,6 +765,8 @@ class HValue: public ZoneObject { |
static GVNFlagSet AllObservableSideEffectsFlagSet() { |
GVNFlagSet result = AllChangesFlagSet(); |
result.Remove(kChangesElementsKind); |
+ result.Remove(kChangesElementsPointer); |
+ result.Remove(kChangesMaps); |
return result; |
} |
@@ -1920,8 +1944,7 @@ class HLoadElements: public HUnaryOperation { |
explicit HLoadElements(HValue* value) : HUnaryOperation(value) { |
set_representation(Representation::Tagged()); |
SetFlag(kUseGVN); |
- SetGVNFlag(kDependsOnMaps); |
- SetGVNFlag(kDependsOnElementsKind); |
+ SetGVNFlag(kDependsOnElementsPointer); |
} |
virtual Representation RequiredInputRepresentation(int index) { |
@@ -1972,6 +1995,11 @@ class HCheckMap: public HTemplateInstruction<2> { |
set_representation(Representation::Tagged()); |
SetFlag(kUseGVN); |
SetGVNFlag(kDependsOnMaps); |
+ // If the map to check doesn't have the untransitioned elements, it must not |
+ // be hoisted above TransitionElements instructions. |
+ if (mode == REQUIRE_EXACT_MAP || !map->has_fast_smi_only_elements()) { |
+ SetGVNFlag(kDependsOnElementsKind); |
+ } |
has_element_transitions_ = |
map->LookupElementsTransitionMap(FAST_DOUBLE_ELEMENTS, NULL) != NULL || |
map->LookupElementsTransitionMap(FAST_ELEMENTS, NULL) != NULL; |
@@ -4135,7 +4163,17 @@ class HTransitionElementsKind: public HTemplateInstruction<1> { |
transitioned_map_(transitioned_map) { |
SetOperandAt(0, object); |
SetFlag(kUseGVN); |
+ SetGVNFlag(kDependsOnMaps); |
SetGVNFlag(kChangesElementsKind); |
+ if (original_map->has_fast_double_elements()) { |
+ SetGVNFlag(kChangesElementsPointer); |
+ SetGVNFlag(kDependsOnElementsPointer); |
+ SetGVNFlag(kDependsOnDoubleArrayElements); |
+ } else if (transitioned_map->has_fast_double_elements()) { |
+ SetGVNFlag(kChangesElementsPointer); |
+ SetGVNFlag(kDependsOnElementsPointer); |
+ SetGVNFlag(kDependsOnArrayElements); |
+ } |
set_representation(Representation::Tagged()); |
} |