| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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-inlining.h" | 5 #include "src/compiler/js-inlining.h" |
| 6 | 6 |
| 7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
| 8 #include "src/compilation-info.h" | 8 #include "src/compilation-info.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/compiler/all-nodes.h" | 10 #include "src/compiler/all-nodes.h" |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 // Inline {JSConstruct} requires some additional magic. | 629 // Inline {JSConstruct} requires some additional magic. |
| 630 if (node->opcode() == IrOpcode::kJSConstruct) { | 630 if (node->opcode() == IrOpcode::kJSConstruct) { |
| 631 // Insert nodes around the call that model the behavior required for a | 631 // Insert nodes around the call that model the behavior required for a |
| 632 // constructor dispatch (allocate implicit receiver and check return value). | 632 // constructor dispatch (allocate implicit receiver and check return value). |
| 633 // This models the behavior usually accomplished by our {JSConstructStub}. | 633 // This models the behavior usually accomplished by our {JSConstructStub}. |
| 634 // Note that the context has to be the callers context (input to call node). | 634 // Note that the context has to be the callers context (input to call node). |
| 635 Node* receiver = jsgraph()->TheHoleConstant(); // Implicit receiver. | 635 Node* receiver = jsgraph()->TheHoleConstant(); // Implicit receiver. |
| 636 if (NeedsImplicitReceiver(shared_info)) { | 636 if (NeedsImplicitReceiver(shared_info)) { |
| 637 Node* frame_state_before = NodeProperties::FindFrameStateBefore(node); | 637 Node* frame_state_before = NodeProperties::FindFrameStateBefore(node); |
| 638 Node* effect = NodeProperties::GetEffectInput(node); | 638 Node* effect = NodeProperties::GetEffectInput(node); |
| 639 Node* control = NodeProperties::GetControlInput(node); |
| 639 Node* context = NodeProperties::GetContextInput(node); | 640 Node* context = NodeProperties::GetContextInput(node); |
| 640 Node* create = graph()->NewNode(javascript()->Create(), call.target(), | 641 Node* create = graph()->NewNode(javascript()->Create(), call.target(), |
| 641 call.new_target(), context, | 642 call.new_target(), context, |
| 642 frame_state_before, effect); | 643 frame_state_before, effect, control); |
| 644 Node* success = graph()->NewNode(common()->IfSuccess(), create); |
| 645 uncaught_subcalls.push_back(create); // Adds {IfException}. |
| 646 NodeProperties::ReplaceControlInput(node, success); |
| 643 NodeProperties::ReplaceEffectInput(node, create); | 647 NodeProperties::ReplaceEffectInput(node, create); |
| 644 // Insert a check of the return value to determine whether the return | 648 // Insert a check of the return value to determine whether the return |
| 645 // value or the implicit receiver should be selected as a result of the | 649 // value or the implicit receiver should be selected as a result of the |
| 646 // call. | 650 // call. |
| 647 Node* check = graph()->NewNode(simplified()->ObjectIsReceiver(), node); | 651 Node* check = graph()->NewNode(simplified()->ObjectIsReceiver(), node); |
| 648 Node* select = | 652 Node* select = |
| 649 graph()->NewNode(common()->Select(MachineRepresentation::kTagged), | 653 graph()->NewNode(common()->Select(MachineRepresentation::kTagged), |
| 650 check, node, create); | 654 check, node, create); |
| 651 NodeProperties::ReplaceUses(node, select, node, node, node); | 655 NodeProperties::ReplaceUses(node, select, node, node, node); |
| 652 // Fix-up inputs that have been mangled by the {ReplaceUses} call above. | 656 // Fix-up inputs that have been mangled by the {ReplaceUses} call above. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 | 726 |
| 723 CommonOperatorBuilder* JSInliner::common() const { return jsgraph()->common(); } | 727 CommonOperatorBuilder* JSInliner::common() const { return jsgraph()->common(); } |
| 724 | 728 |
| 725 SimplifiedOperatorBuilder* JSInliner::simplified() const { | 729 SimplifiedOperatorBuilder* JSInliner::simplified() const { |
| 726 return jsgraph()->simplified(); | 730 return jsgraph()->simplified(); |
| 727 } | 731 } |
| 728 | 732 |
| 729 } // namespace compiler | 733 } // namespace compiler |
| 730 } // namespace internal | 734 } // namespace internal |
| 731 } // namespace v8 | 735 } // namespace v8 |
| OLD | NEW |