| OLD | NEW |
| 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/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
| 8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
| 9 #include "src/compiler/simplified-operator.h" | 9 #include "src/compiler/simplified-operator.h" |
| 10 | 10 |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 } | 386 } |
| 387 | 387 |
| 388 Reduction LoadElimination::ReduceTransitionElementsKind(Node* node) { | 388 Reduction LoadElimination::ReduceTransitionElementsKind(Node* node) { |
| 389 Node* const object = NodeProperties::GetValueInput(node, 0); | 389 Node* const object = NodeProperties::GetValueInput(node, 0); |
| 390 Node* const source_map = NodeProperties::GetValueInput(node, 1); | 390 Node* const source_map = NodeProperties::GetValueInput(node, 1); |
| 391 Node* const target_map = NodeProperties::GetValueInput(node, 2); | 391 Node* const target_map = NodeProperties::GetValueInput(node, 2); |
| 392 Node* const effect = NodeProperties::GetEffectInput(node); | 392 Node* const effect = NodeProperties::GetEffectInput(node); |
| 393 AbstractState const* state = node_states_.Get(effect); | 393 AbstractState const* state = node_states_.Get(effect); |
| 394 if (state == nullptr) return NoChange(); | 394 if (state == nullptr) return NoChange(); |
| 395 if (Node* const object_map = state->LookupField(object, 0)) { | 395 if (Node* const object_map = state->LookupField(object, 0)) { |
| 396 if (target_map == object_map) { |
| 397 // The {object} already has the {target_map}, so this TransitionElements |
| 398 // {node} is fully redundant (independent of what {source_map} is). |
| 399 return Replace(effect); |
| 400 } |
| 396 state = state->KillField(object, 0, zone()); | 401 state = state->KillField(object, 0, zone()); |
| 397 if (source_map == object_map) { | 402 if (source_map == object_map) { |
| 398 state = state->AddField(object, 0, target_map, zone()); | 403 state = state->AddField(object, 0, target_map, zone()); |
| 399 } | 404 } |
| 400 } else { | 405 } else { |
| 401 state = state->KillField(object, 0, zone()); | 406 state = state->KillField(object, 0, zone()); |
| 402 } | 407 } |
| 403 ElementsTransition transition = ElementsTransitionOf(node->op()); | 408 ElementsTransition transition = ElementsTransitionOf(node->op()); |
| 404 switch (transition) { | 409 switch (transition) { |
| 405 case ElementsTransition::kFastTransition: | 410 case ElementsTransition::kFastTransition: |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 DCHECK_EQ(kTaggedBase, access.base_is_tagged); | 696 DCHECK_EQ(kTaggedBase, access.base_is_tagged); |
| 692 DCHECK_EQ(0, access.offset % kPointerSize); | 697 DCHECK_EQ(0, access.offset % kPointerSize); |
| 693 int field_index = access.offset / kPointerSize; | 698 int field_index = access.offset / kPointerSize; |
| 694 if (field_index >= static_cast<int>(kMaxTrackedFields)) return -1; | 699 if (field_index >= static_cast<int>(kMaxTrackedFields)) return -1; |
| 695 return field_index; | 700 return field_index; |
| 696 } | 701 } |
| 697 | 702 |
| 698 } // namespace compiler | 703 } // namespace compiler |
| 699 } // namespace internal | 704 } // namespace internal |
| 700 } // namespace v8 | 705 } // namespace v8 |
| OLD | NEW |