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

Unified Diff: src/compiler/js-native-context-specialization.cc

Issue 2704563005: [turbofan] Infer receiver maps from earlier map checks. (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-native-context-specialization.cc
diff --git a/src/compiler/js-native-context-specialization.cc b/src/compiler/js-native-context-specialization.cc
index 6abdd678eb1d38bc9011985b7f92523060a77855..47308cb5728669526595dfe079400532f0684529 100644
--- a/src/compiler/js-native-context-specialization.cc
+++ b/src/compiler/js-native-context-specialization.cc
@@ -2178,7 +2178,34 @@ MaybeHandle<Map> JSNativeContextSpecialization::InferReceiverMap(Node* receiver,
}
}
}
- // TODO(turbofan): Go hunting for CheckMaps(receiver) in the effect chain?
+ // Go hunting for a matching CheckMaps(receiver) or StoreField[Map](receiver)
+ // in the {effect} chain.
+ // TODO(turbofan): Propagate the information along the control/effect chains
+ // instead at some point to avoid this potentially inefficient hunting.
+ while (true) {
+ if (effect->opcode() == IrOpcode::kCheckMaps) {
+ ZoneHandleSet<Map> maps = CheckMapsParametersOf(effect->op()).maps();
+ if (maps.size() == 1u) {
+ Node* object = NodeProperties::GetValueInput(effect, 0);
+ if (NodeProperties::IsSame(receiver, object)) return maps[0];
+ }
+ } else if (effect->opcode() == IrOpcode::kStoreField) {
+ FieldAccess const access = FieldAccessOf(effect->op());
+ if (access.offset == HeapObject::kMapOffset) {
+ Node* object = NodeProperties::GetValueInput(effect, 0);
+ Node* value = NodeProperties::GetValueInput(effect, 1);
+ if (object == receiver) {
+ HeapObjectMatcher m(value);
+ if (m.HasValue()) return Handle<Map>::cast(m.Value());
+ }
+ break;
+ }
+ } else if (!effect->op()->HasProperty(Operator::kNoWrite) ||
+ effect->op()->EffectInputCount() != 1) {
+ break;
+ }
+ effect = NodeProperties::GetEffectInput(effect);
+ }
return MaybeHandle<Map>();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698