diff options
author | Myles Borins <mylesborins@google.com> | 2017-08-01 11:36:44 -0500 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2017-08-01 15:23:15 -0500 |
commit | 0a66b223e149a841669bfad5598e4254589730cb (patch) | |
tree | 5ec050f7f78aafbf5b1e0e50d639fb843141e162 /deps/v8/src/compiler/load-elimination.cc | |
parent | 1782b3836ba58ef0da6b687f2bb970c0bd8199ad (diff) | |
download | node-new-0a66b223e149a841669bfad5598e4254589730cb.tar.gz |
deps: update V8 to 6.0.286.52
PR-URL: https://github.com/nodejs/node/pull/14004
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'deps/v8/src/compiler/load-elimination.cc')
-rw-r--r-- | deps/v8/src/compiler/load-elimination.cc | 57 |
1 files changed, 41 insertions, 16 deletions
diff --git a/deps/v8/src/compiler/load-elimination.cc b/deps/v8/src/compiler/load-elimination.cc index 2c688a1cb5..b4a5b717e6 100644 --- a/deps/v8/src/compiler/load-elimination.cc +++ b/deps/v8/src/compiler/load-elimination.cc @@ -142,7 +142,7 @@ bool IsCompatibleCheck(Node const* a, Node const* b) { Node* LoadElimination::AbstractChecks::Lookup(Node* node) const { for (Node* const check : nodes_) { - if (check && IsCompatibleCheck(check, node)) { + if (check && !check->IsDead() && IsCompatibleCheck(check, node)) { return check; } } @@ -195,13 +195,23 @@ void LoadElimination::AbstractChecks::Print() const { } } -Node* LoadElimination::AbstractElements::Lookup(Node* object, - Node* index) const { +namespace { + +bool IsCompatible(MachineRepresentation r1, MachineRepresentation r2) { + if (r1 == r2) return true; + return IsAnyTagged(r1) && IsAnyTagged(r2); +} + +} // namespace + +Node* LoadElimination::AbstractElements::Lookup( + Node* object, Node* index, MachineRepresentation representation) const { for (Element const element : elements_) { if (element.object == nullptr) continue; DCHECK_NOT_NULL(element.index); DCHECK_NOT_NULL(element.value); - if (MustAlias(object, element.object) && MustAlias(index, element.index)) { + if (MustAlias(object, element.object) && MustAlias(index, element.index) && + IsCompatible(representation, element.representation)) { return element.value; } } @@ -470,22 +480,26 @@ LoadElimination::AbstractState const* LoadElimination::AbstractState::KillMaps( return this; } -Node* LoadElimination::AbstractState::LookupElement(Node* object, - Node* index) const { +Node* LoadElimination::AbstractState::LookupElement( + Node* object, Node* index, MachineRepresentation representation) const { if (this->elements_) { - return this->elements_->Lookup(object, index); + return this->elements_->Lookup(object, index, representation); } return nullptr; } LoadElimination::AbstractState const* LoadElimination::AbstractState::AddElement(Node* object, Node* index, - Node* value, Zone* zone) const { + Node* value, + MachineRepresentation representation, + Zone* zone) const { AbstractState* that = new (zone) AbstractState(*this); if (that->elements_) { - that->elements_ = that->elements_->Extend(object, index, value, zone); + that->elements_ = + that->elements_->Extend(object, index, value, representation, zone); } else { - that->elements_ = new (zone) AbstractElements(object, index, value, zone); + that->elements_ = + new (zone) AbstractElements(object, index, value, representation, zone); } return that; } @@ -823,7 +837,8 @@ Reduction LoadElimination::ReduceLoadElement(Node* node) { case MachineRepresentation::kTaggedSigned: case MachineRepresentation::kTaggedPointer: case MachineRepresentation::kTagged: - if (Node* replacement = state->LookupElement(object, index)) { + if (Node* replacement = state->LookupElement( + object, index, access.machine_type.representation())) { // Make sure we don't resurrect dead {replacement} nodes. if (!replacement->IsDead()) { // We might need to guard the {replacement} if the type of the @@ -838,7 +853,8 @@ Reduction LoadElimination::ReduceLoadElement(Node* node) { return Replace(replacement); } } - state = state->AddElement(object, index, node, zone()); + state = state->AddElement(object, index, node, + access.machine_type.representation(), zone()); return UpdateState(node, state); } return NoChange(); @@ -852,7 +868,8 @@ Reduction LoadElimination::ReduceStoreElement(Node* node) { Node* const effect = NodeProperties::GetEffectInput(node); AbstractState const* state = node_states_.Get(effect); if (state == nullptr) return NoChange(); - Node* const old_value = state->LookupElement(object, index); + Node* const old_value = + state->LookupElement(object, index, access.machine_type.representation()); if (old_value == new_value) { // This store is fully redundant. return Replace(effect); @@ -880,7 +897,8 @@ Reduction LoadElimination::ReduceStoreElement(Node* node) { case MachineRepresentation::kTaggedSigned: case MachineRepresentation::kTaggedPointer: case MachineRepresentation::kTagged: - state = state->AddElement(object, index, new_value, zone()); + state = state->AddElement(object, index, new_value, + access.machine_type.representation(), zone()); break; } return UpdateState(node, state); @@ -1007,8 +1025,15 @@ LoadElimination::AbstractState const* LoadElimination::ComputeLoopState( !ZoneHandleSet<Map>(transition.target()) .contains(object_maps)) { state = state->KillMaps(object, zone()); - state = state->KillField( - object, FieldIndexOf(JSObject::kElementsOffset), zone()); + switch (transition.mode()) { + case ElementsTransition::kFastTransition: + break; + case ElementsTransition::kSlowTransition: + // Kill the elements as well. + state = state->KillField( + object, FieldIndexOf(JSObject::kElementsOffset), zone()); + break; + } } break; } |