OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/js-native-context-specialization.h" | 5 #include "src/compiler/js-native-context-specialization.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 common()->Phi(MachineRepresentation::kTagged, control_count), | 564 common()->Phi(MachineRepresentation::kTagged, control_count), |
565 control_count + 1, &values.front()); | 565 control_count + 1, &values.front()); |
566 effects.push_back(control); | 566 effects.push_back(control); |
567 effect = graph()->NewNode(common()->EffectPhi(control_count), | 567 effect = graph()->NewNode(common()->EffectPhi(control_count), |
568 control_count + 1, &effects.front()); | 568 control_count + 1, &effects.front()); |
569 } | 569 } |
570 ReplaceWithValue(node, value, effect, control); | 570 ReplaceWithValue(node, value, effect, control); |
571 return Replace(value); | 571 return Replace(value); |
572 } | 572 } |
573 | 573 |
574 | 574 template <typename KeyedICNexus> |
575 Reduction JSNativeContextSpecialization::ReduceKeyedAccess( | 575 Reduction JSNativeContextSpecialization::ReduceKeyedAccess( |
576 Node* node, Node* index, Node* value, FeedbackNexus const& nexus, | 576 Node* node, Node* index, Node* value, KeyedICNexus const& nexus, |
577 AccessMode access_mode, LanguageMode language_mode, | 577 AccessMode access_mode, LanguageMode language_mode, |
578 KeyedAccessStoreMode store_mode) { | 578 KeyedAccessStoreMode store_mode) { |
579 DCHECK(node->opcode() == IrOpcode::kJSLoadProperty || | 579 DCHECK(node->opcode() == IrOpcode::kJSLoadProperty || |
580 node->opcode() == IrOpcode::kJSStoreProperty); | 580 node->opcode() == IrOpcode::kJSStoreProperty); |
581 Node* const receiver = NodeProperties::GetValueInput(node, 0); | 581 Node* const receiver = NodeProperties::GetValueInput(node, 0); |
582 Node* const effect = NodeProperties::GetEffectInput(node); | 582 Node* const effect = NodeProperties::GetEffectInput(node); |
583 | 583 |
584 // Check if the {nexus} reports type feedback for the IC. | 584 // Check if the {nexus} reports type feedback for the IC. |
585 if (nexus.IsUninitialized()) { | 585 if (nexus.IsUninitialized()) { |
586 if ((flags() & kDeoptimizationEnabled) && | 586 if ((flags() & kDeoptimizationEnabled) && |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 language_mode); | 625 language_mode); |
626 } | 626 } |
627 } | 627 } |
628 } | 628 } |
629 | 629 |
630 // Check if we have feedback for a named access. | 630 // Check if we have feedback for a named access. |
631 if (Name* name = nexus.FindFirstName()) { | 631 if (Name* name = nexus.FindFirstName()) { |
632 return ReduceNamedAccess(node, value, receiver_maps, | 632 return ReduceNamedAccess(node, value, receiver_maps, |
633 handle(name, isolate()), access_mode, | 633 handle(name, isolate()), access_mode, |
634 language_mode, index); | 634 language_mode, index); |
| 635 } else if (nexus.GetKeyType() != ELEMENT) { |
| 636 // The KeyedLoad/StoreIC has seen non-element accesses, so we cannot assume |
| 637 // that the {index} is a valid array index, thus we just let the IC continue |
| 638 // to deal with this load/store. |
| 639 return NoChange(); |
635 } | 640 } |
636 | 641 |
637 // Try to lower the element access based on the {receiver_maps}. | 642 // Try to lower the element access based on the {receiver_maps}. |
638 return ReduceElementAccess(node, index, value, receiver_maps, access_mode, | 643 return ReduceElementAccess(node, index, value, receiver_maps, access_mode, |
639 language_mode, store_mode); | 644 language_mode, store_mode); |
640 } | 645 } |
641 | 646 |
642 Reduction JSNativeContextSpecialization::ReduceSoftDeoptimize( | 647 Reduction JSNativeContextSpecialization::ReduceSoftDeoptimize( |
643 Node* node, DeoptimizeReason reason) { | 648 Node* node, DeoptimizeReason reason) { |
644 Node* effect = NodeProperties::GetEffectInput(node); | 649 Node* effect = NodeProperties::GetEffectInput(node); |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 } | 1100 } |
1096 | 1101 |
1097 | 1102 |
1098 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 1103 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
1099 return jsgraph()->simplified(); | 1104 return jsgraph()->simplified(); |
1100 } | 1105 } |
1101 | 1106 |
1102 } // namespace compiler | 1107 } // namespace compiler |
1103 } // namespace internal | 1108 } // namespace internal |
1104 } // namespace v8 | 1109 } // namespace v8 |
OLD | NEW |