| 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-call-reducer.h" | 5 #include "src/compiler/js-call-reducer.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
| 10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 jsgraph()->Constant(FeedbackVector::GetIndex(p.feedback().slot())); | 610 jsgraph()->Constant(FeedbackVector::GetIndex(p.feedback().slot())); |
| 611 Node* feedback_vector = jsgraph()->HeapConstant(p.feedback().vector()); | 611 Node* feedback_vector = jsgraph()->HeapConstant(p.feedback().vector()); |
| 612 node->InsertInput(graph()->zone(), 0, stub_code); | 612 node->InsertInput(graph()->zone(), 0, stub_code); |
| 613 node->InsertInput(graph()->zone(), 2, stub_arity); | 613 node->InsertInput(graph()->zone(), 2, stub_arity); |
| 614 node->InsertInput(graph()->zone(), 3, slot_index); | 614 node->InsertInput(graph()->zone(), 3, slot_index); |
| 615 node->InsertInput(graph()->zone(), 4, feedback_vector); | 615 node->InsertInput(graph()->zone(), 4, feedback_vector); |
| 616 NodeProperties::ChangeOp(node, common()->Call(desc)); | 616 NodeProperties::ChangeOp(node, common()->Call(desc)); |
| 617 return Changed(node); | 617 return Changed(node); |
| 618 } | 618 } |
| 619 | 619 |
| 620 // Not much we can do if deoptimization support is disabled. | |
| 621 if (!(flags() & kDeoptimizationEnabled)) return NoChange(); | |
| 622 | |
| 623 Handle<Object> feedback(nexus.GetFeedback(), isolate()); | 620 Handle<Object> feedback(nexus.GetFeedback(), isolate()); |
| 624 if (feedback->IsAllocationSite()) { | 621 if (feedback->IsAllocationSite()) { |
| 625 // Retrieve the Array function from the {node}. | 622 // Retrieve the Array function from the {node}. |
| 626 Node* array_function = jsgraph()->HeapConstant( | 623 Node* array_function = jsgraph()->HeapConstant( |
| 627 handle(native_context()->array_function(), isolate())); | 624 handle(native_context()->array_function(), isolate())); |
| 628 | 625 |
| 629 // Check that the {target} is still the {array_function}. | 626 // Check that the {target} is still the {array_function}. |
| 630 Node* check = graph()->NewNode(simplified()->ReferenceEqual(), target, | 627 Node* check = graph()->NewNode(simplified()->ReferenceEqual(), target, |
| 631 array_function); | 628 array_function); |
| 632 effect = graph()->NewNode(simplified()->CheckIf(), check, effect, control); | 629 effect = graph()->NewNode(simplified()->CheckIf(), check, effect, control); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 NodeProperties::ChangeOp(node, javascript()->CreateArray(arity, site)); | 717 NodeProperties::ChangeOp(node, javascript()->CreateArray(arity, site)); |
| 721 return Changed(node); | 718 return Changed(node); |
| 722 } | 719 } |
| 723 } | 720 } |
| 724 | 721 |
| 725 // Don't mess with other {node}s that have a constant {target}. | 722 // Don't mess with other {node}s that have a constant {target}. |
| 726 // TODO(bmeurer): Also support optimizing bound functions and proxies here. | 723 // TODO(bmeurer): Also support optimizing bound functions and proxies here. |
| 727 return NoChange(); | 724 return NoChange(); |
| 728 } | 725 } |
| 729 | 726 |
| 730 // Not much we can do if deoptimization support is disabled. | |
| 731 if (!(flags() & kDeoptimizationEnabled)) return NoChange(); | |
| 732 | |
| 733 if (!p.feedback().IsValid()) return NoChange(); | 727 if (!p.feedback().IsValid()) return NoChange(); |
| 734 CallICNexus nexus(p.feedback().vector(), p.feedback().slot()); | 728 CallICNexus nexus(p.feedback().vector(), p.feedback().slot()); |
| 735 Handle<Object> feedback(nexus.GetFeedback(), isolate()); | 729 Handle<Object> feedback(nexus.GetFeedback(), isolate()); |
| 736 if (feedback->IsAllocationSite()) { | 730 if (feedback->IsAllocationSite()) { |
| 737 // The feedback is an AllocationSite, which means we have called the | 731 // The feedback is an AllocationSite, which means we have called the |
| 738 // Array function and collected transition (and pretenuring) feedback | 732 // Array function and collected transition (and pretenuring) feedback |
| 739 // for the resulting arrays. This has to be kept in sync with the | 733 // for the resulting arrays. This has to be kept in sync with the |
| 740 // implementation of the CallConstructStub. | 734 // implementation of the CallConstructStub. |
| 741 Handle<AllocationSite> site = Handle<AllocationSite>::cast(feedback); | 735 Handle<AllocationSite> site = Handle<AllocationSite>::cast(feedback); |
| 742 | 736 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 return jsgraph()->javascript(); | 806 return jsgraph()->javascript(); |
| 813 } | 807 } |
| 814 | 808 |
| 815 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { | 809 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { |
| 816 return jsgraph()->simplified(); | 810 return jsgraph()->simplified(); |
| 817 } | 811 } |
| 818 | 812 |
| 819 } // namespace compiler | 813 } // namespace compiler |
| 820 } // namespace internal | 814 } // namespace internal |
| 821 } // namespace v8 | 815 } // namespace v8 |
| OLD | NEW |