Revision: 13488
Author: [email protected]
Date: Thu Jan 24 01:10:06 2013
Log: Allow removal of obsolete map checks after transitions.
This allows side effect dominator tracking to remove map checks that are
dominated by a single HStoreNamedField that performs a transition on the
same object. A similar trick could be applied to HAllocateObject.
[email protected]
Review URL: https://codereview.chromium.org/12035026
http://code.google.com/p/v8/source/detail?r=13488
Modified:
/branches/bleeding_edge/src/hydrogen-instructions.cc
/branches/bleeding_edge/src/hydrogen-instructions.h
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Wed Jan 23
05:52:00 2013
+++ /branches/bleeding_edge/src/hydrogen-instructions.cc Thu Jan 24
01:10:06 2013
@@ -1165,6 +1165,26 @@
UNREACHABLE();
}
}
+
+
+void HCheckMaps::SetSideEffectDominator(GVNFlag side_effect,
+ HValue* dominator) {
+ ASSERT(side_effect == kChangesMaps);
+ // TODO(mstarzinger): For now we specialize on HStoreNamedField, but once
+ // type information is rich enough we should generalize this to any HType
+ // for which the map is known.
+ if (dominator->IsStoreNamedField()) {
+ HStoreNamedField* store = HStoreNamedField::cast(dominator);
+ Handle<Map> map = store->transition();
+ if (map.is_null() || store->object() != value()) return;
+ for (int i = 0; i < map_set()->length(); i++) {
+ if (map.is_identical_to(map_set()->at(i))) {
+ DeleteAndReplaceWith(NULL);
+ return;
+ }
+ }
+ }
+}
void HLoadElements::PrintDataTo(StringStream* stream) {
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Wed Jan 23 07:58:49
2013
+++ /branches/bleeding_edge/src/hydrogen-instructions.h Thu Jan 24 01:10:06
2013
@@ -193,6 +193,7 @@
V(WrapReceiver)
#define GVN_TRACKED_FLAG_LIST(V) \
+ V(Maps) \
V(NewSpacePromotion)
#define GVN_UNTRACKED_FLAG_LIST(V) \
@@ -205,7 +206,6 @@
V(DoubleArrayElements) \
V(SpecializedArrayElements) \
V(GlobalVars) \
- V(Maps) \
V(ArrayLengths) \
V(ContextSlots) \
V(OsrEntries)
@@ -2248,6 +2248,7 @@
SetOperandAt(1, typecheck != NULL ? typecheck : value);
set_representation(Representation::Tagged());
SetFlag(kUseGVN);
+ SetFlag(kTrackSideEffectDominators);
SetGVNFlag(kDependsOnMaps);
SetGVNFlag(kDependsOnElementsKind);
map_set()->Add(map, zone);
@@ -2257,6 +2258,7 @@
SetOperandAt(1, value);
set_representation(Representation::Tagged());
SetFlag(kUseGVN);
+ SetFlag(kTrackSideEffectDominators);
SetGVNFlag(kDependsOnMaps);
SetGVNFlag(kDependsOnElementsKind);
for (int i = 0; i < maps->length(); i++) {
@@ -2291,7 +2293,7 @@
virtual Representation RequiredInputRepresentation(int index) {
return Representation::Tagged();
}
-
+ virtual void SetSideEffectDominator(GVNFlag side_effect, HValue*
dominator);
virtual void PrintDataTo(StringStream* stream);
virtual HType CalculateInferredType();
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev