| 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-generic-lowering.h" | 5 #include "src/compiler/js-generic-lowering.h" |
| 6 | 6 |
| 7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
| 8 #include "src/builtins/builtins-constructor.h" | 8 #include "src/builtins/builtins-constructor.h" |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 } | 638 } |
| 639 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 639 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
| 640 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); | 640 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); |
| 641 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 641 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| 642 Node* stub_arity = jsgraph()->Int32Constant(arg_count); | 642 Node* stub_arity = jsgraph()->Int32Constant(arg_count); |
| 643 node->InsertInput(zone(), 0, stub_code); | 643 node->InsertInput(zone(), 0, stub_code); |
| 644 node->InsertInput(zone(), 2, stub_arity); | 644 node->InsertInput(zone(), 2, stub_arity); |
| 645 NodeProperties::ChangeOp(node, common()->Call(desc)); | 645 NodeProperties::ChangeOp(node, common()->Call(desc)); |
| 646 } | 646 } |
| 647 | 647 |
| 648 void JSGenericLowering::LowerJSCallWithArrayLike(Node* node) { |
| 649 Callable callable = CodeFactory::CallWithArrayLike(isolate()); |
| 650 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
| 651 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
| 652 isolate(), zone(), callable.descriptor(), 1, flags); |
| 653 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| 654 Node* receiver = node->InputAt(1); |
| 655 Node* arguments_list = node->InputAt(2); |
| 656 node->InsertInput(zone(), 0, stub_code); |
| 657 node->ReplaceInput(3, receiver); |
| 658 node->ReplaceInput(2, arguments_list); |
| 659 NodeProperties::ChangeOp(node, common()->Call(desc)); |
| 660 } |
| 661 |
| 648 void JSGenericLowering::LowerJSCallWithSpread(Node* node) { | 662 void JSGenericLowering::LowerJSCallWithSpread(Node* node) { |
| 649 SpreadWithArityParameter const& p = SpreadWithArityParameterOf(node->op()); | 663 SpreadWithArityParameter const& p = SpreadWithArityParameterOf(node->op()); |
| 650 int const arg_count = static_cast<int>(p.arity() - 2); | 664 int const arg_count = static_cast<int>(p.arity() - 2); |
| 651 Callable callable = CodeFactory::CallWithSpread(isolate()); | 665 Callable callable = CodeFactory::CallWithSpread(isolate()); |
| 652 CallDescriptor::Flags flags = FrameStateFlagForCall(node); | 666 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
| 653 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 667 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
| 654 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); | 668 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); |
| 655 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 669 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| 656 Node* stub_arity = jsgraph()->Int32Constant(arg_count); | 670 Node* stub_arity = jsgraph()->Int32Constant(arg_count); |
| 657 node->InsertInput(zone(), 0, stub_code); | 671 node->InsertInput(zone(), 0, stub_code); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 } | 793 } |
| 780 | 794 |
| 781 | 795 |
| 782 MachineOperatorBuilder* JSGenericLowering::machine() const { | 796 MachineOperatorBuilder* JSGenericLowering::machine() const { |
| 783 return jsgraph()->machine(); | 797 return jsgraph()->machine(); |
| 784 } | 798 } |
| 785 | 799 |
| 786 } // namespace compiler | 800 } // namespace compiler |
| 787 } // namespace internal | 801 } // namespace internal |
| 788 } // namespace v8 | 802 } // namespace v8 |
| OLD | NEW |