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

Side by Side Diff: src/compiler/load-elimination.cc

Issue 2476213002: [turbofan] Don't flush LoadElimination on unsupported field stores. (Closed)
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « src/compiler/load-elimination.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/load-elimination.h" 5 #include "src/compiler/load-elimination.h"
6 6
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 #include "src/compiler/simplified-operator.h" 10 #include "src/compiler/simplified-operator.h"
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 this_field = this_field->Kill(object, zone); 441 this_field = this_field->Kill(object, zone);
442 if (this->fields_[index] != this_field) { 442 if (this->fields_[index] != this_field) {
443 AbstractState* that = new (zone) AbstractState(*this); 443 AbstractState* that = new (zone) AbstractState(*this);
444 that->fields_[index] = this_field; 444 that->fields_[index] = this_field;
445 return that; 445 return that;
446 } 446 }
447 } 447 }
448 return this; 448 return this;
449 } 449 }
450 450
451 LoadElimination::AbstractState const*
452 LoadElimination::AbstractState::KillFields(Node* object, Zone* zone) const {
453 for (size_t i = 0;; ++i) {
454 if (i == arraysize(fields_)) return this;
455 if (AbstractField const* this_field = this->fields_[i]) {
456 AbstractField const* that_field = this_field->Kill(object, zone);
457 if (that_field != this_field) {
458 AbstractState* that = new (zone) AbstractState(*this);
459 that->fields_[i] = this_field;
460 while (++i < arraysize(fields_)) {
461 if (this->fields_[i] != nullptr) {
462 that->fields_[i] = this->fields_[i]->Kill(object, zone);
463 }
464 }
465 return that;
466 }
467 }
468 }
469 }
470
451 Node* LoadElimination::AbstractState::LookupField(Node* object, 471 Node* LoadElimination::AbstractState::LookupField(Node* object,
452 size_t index) const { 472 size_t index) const {
453 if (AbstractField const* this_field = this->fields_[index]) { 473 if (AbstractField const* this_field = this->fields_[index]) {
454 return this_field->Lookup(object); 474 return this_field->Lookup(object);
455 } 475 }
456 return nullptr; 476 return nullptr;
457 } 477 }
458 478
459 void LoadElimination::AbstractState::Print() const { 479 void LoadElimination::AbstractState::Print() const {
460 if (checks_) { 480 if (checks_) {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 Node* const old_value = state->LookupField(object, field_index); 675 Node* const old_value = state->LookupField(object, field_index);
656 if (old_value == new_value) { 676 if (old_value == new_value) {
657 // This store is fully redundant. 677 // This store is fully redundant.
658 return Replace(effect); 678 return Replace(effect);
659 } 679 }
660 // Kill all potentially aliasing fields and record the new value. 680 // Kill all potentially aliasing fields and record the new value.
661 state = state->KillField(object, field_index, zone()); 681 state = state->KillField(object, field_index, zone());
662 state = state->AddField(object, field_index, new_value, zone()); 682 state = state->AddField(object, field_index, new_value, zone());
663 } else { 683 } else {
664 // Unsupported StoreField operator. 684 // Unsupported StoreField operator.
665 state = empty_state(); 685 state = state->KillFields(object, zone());
666 } 686 }
667 return UpdateState(node, state); 687 return UpdateState(node, state);
668 } 688 }
669 689
670 Reduction LoadElimination::ReduceLoadElement(Node* node) { 690 Reduction LoadElimination::ReduceLoadElement(Node* node) {
671 Node* const object = NodeProperties::GetValueInput(node, 0); 691 Node* const object = NodeProperties::GetValueInput(node, 0);
672 Node* const index = NodeProperties::GetValueInput(node, 1); 692 Node* const index = NodeProperties::GetValueInput(node, 1);
673 Node* const effect = NodeProperties::GetEffectInput(node); 693 Node* const effect = NodeProperties::GetEffectInput(node);
674 Node* const control = NodeProperties::GetControlInput(node); 694 Node* const control = NodeProperties::GetControlInput(node);
675 AbstractState const* state = node_states_.Get(effect); 695 AbstractState const* state = node_states_.Get(effect);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 state = state->KillField( 869 state = state->KillField(
850 object, FieldIndexOf(HeapObject::kMapOffset), zone()); 870 object, FieldIndexOf(HeapObject::kMapOffset), zone());
851 state = state->KillField( 871 state = state->KillField(
852 object, FieldIndexOf(JSObject::kElementsOffset), zone()); 872 object, FieldIndexOf(JSObject::kElementsOffset), zone());
853 break; 873 break;
854 } 874 }
855 case IrOpcode::kStoreField: { 875 case IrOpcode::kStoreField: {
856 FieldAccess const& access = FieldAccessOf(current->op()); 876 FieldAccess const& access = FieldAccessOf(current->op());
857 Node* const object = NodeProperties::GetValueInput(current, 0); 877 Node* const object = NodeProperties::GetValueInput(current, 0);
858 int field_index = FieldIndexOf(access); 878 int field_index = FieldIndexOf(access);
859 if (field_index < 0) return empty_state(); 879 if (field_index < 0) {
860 state = state->KillField(object, field_index, zone()); 880 state = state->KillFields(object, zone());
881 } else {
882 state = state->KillField(object, field_index, zone());
883 }
861 break; 884 break;
862 } 885 }
863 case IrOpcode::kStoreElement: { 886 case IrOpcode::kStoreElement: {
864 Node* const object = NodeProperties::GetValueInput(current, 0); 887 Node* const object = NodeProperties::GetValueInput(current, 0);
865 Node* const index = NodeProperties::GetValueInput(current, 1); 888 Node* const index = NodeProperties::GetValueInput(current, 1);
866 state = state->KillElement(object, index, zone()); 889 state = state->KillElement(object, index, zone());
867 break; 890 break;
868 } 891 }
869 case IrOpcode::kStoreBuffer: 892 case IrOpcode::kStoreBuffer:
870 case IrOpcode::kStoreTypedElement: { 893 case IrOpcode::kStoreTypedElement: {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 953
931 CommonOperatorBuilder* LoadElimination::common() const { 954 CommonOperatorBuilder* LoadElimination::common() const {
932 return jsgraph()->common(); 955 return jsgraph()->common();
933 } 956 }
934 957
935 Graph* LoadElimination::graph() const { return jsgraph()->graph(); } 958 Graph* LoadElimination::graph() const { return jsgraph()->graph(); }
936 959
937 } // namespace compiler 960 } // namespace compiler
938 } // namespace internal 961 } // namespace internal
939 } // namespace v8 962 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/load-elimination.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698