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

Unified Diff: src/compiler/load-elimination.cc

Issue 2196653002: [turbofan] Introduce a dedicated CheckMaps simplified operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@TurboFan_JSNativeContextSpecialization_NonElementKeyedAccess
Patch Set: Created 4 years, 5 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
Index: src/compiler/load-elimination.cc
diff --git a/src/compiler/load-elimination.cc b/src/compiler/load-elimination.cc
index d326ed179b06eeca57e51ab36f512ec4fa1bf405..de625cc94a8b05ed0f43c55c8f98f35e0dc9598b 100644
--- a/src/compiler/load-elimination.cc
+++ b/src/compiler/load-elimination.cc
@@ -51,6 +51,10 @@ bool MustAlias(Node* a, Node* b) { return QueryAlias(a, b) == kMustAlias; }
Reduction LoadElimination::Reduce(Node* node) {
switch (node->opcode()) {
+ case IrOpcode::kCheckMaps:
+ return ReduceCheckMaps(node);
+ case IrOpcode::kTransitionElementsKind:
+ return ReduceTransitionElementsKind(node);
case IrOpcode::kLoadField:
return ReduceLoadField(node);
case IrOpcode::kStoreField:
@@ -301,6 +305,52 @@ void LoadElimination::AbstractStateForEffectNodes::Set(
info_for_node_[id] = state;
}
+Reduction LoadElimination::ReduceCheckMaps(Node* node) {
+ Node* const object = NodeProperties::GetValueInput(node, 0);
+ Node* const effect = NodeProperties::GetEffectInput(node);
+ AbstractState const* state = node_states_.Get(effect);
+ if (state == nullptr) return NoChange();
+ int const map_input_count = node->op()->ValueInputCount() - 1;
+ if (Node* const object_map = state->LookupField(object, 0)) {
+ for (int i = 0; i < map_input_count; ++i) {
+ Node* map = NodeProperties::GetValueInput(node, 1 + i);
+ if (map == object_map) return Replace(effect);
+ }
+ }
+ if (map_input_count == 1) {
+ Node* const map0 = NodeProperties::GetValueInput(node, 1);
+ state = state->AddField(object, 0, map0, zone());
+ }
+ return UpdateState(node, state);
+}
+
+Reduction LoadElimination::ReduceTransitionElementsKind(Node* node) {
+ Node* const object = NodeProperties::GetValueInput(node, 0);
+ Node* const source_map = NodeProperties::GetValueInput(node, 1);
+ Node* const target_map = NodeProperties::GetValueInput(node, 2);
+ Node* const effect = NodeProperties::GetEffectInput(node);
+ AbstractState const* state = node_states_.Get(effect);
+ if (state == nullptr) return NoChange();
+ if (Node* const object_map = state->LookupField(object, 0)) {
+ state = state->KillField(object, 0, zone());
+ if (source_map == object_map) {
+ state = state->AddField(object, 0, target_map, zone());
+ }
+ } else {
+ state = state->KillField(object, 0, zone());
+ }
+ ElementsTransition transition = ElementsTransitionOf(node->op());
+ switch (transition) {
+ case ElementsTransition::kFastTransition:
+ break;
+ case ElementsTransition::kSlowTransition:
+ // Kill the elements as well.
+ state = state->KillField(object, 2, zone());
+ break;
+ }
+ return UpdateState(node, state);
+}
+
Reduction LoadElimination::ReduceLoadField(Node* node) {
FieldAccess const& access = FieldAccessOf(node->op());
Node* const object = NodeProperties::GetValueInput(node, 0);

Powered by Google App Engine
This is Rietveld 408576698