| 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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 } | 645 } |
| 646 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 646 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
| 647 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); | 647 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); |
| 648 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 648 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| 649 Node* stub_arity = jsgraph()->Int32Constant(arg_count); | 649 Node* stub_arity = jsgraph()->Int32Constant(arg_count); |
| 650 node->InsertInput(zone(), 0, stub_code); | 650 node->InsertInput(zone(), 0, stub_code); |
| 651 node->InsertInput(zone(), 2, stub_arity); | 651 node->InsertInput(zone(), 2, stub_arity); |
| 652 NodeProperties::ChangeOp(node, common()->Call(desc)); | 652 NodeProperties::ChangeOp(node, common()->Call(desc)); |
| 653 } | 653 } |
| 654 | 654 |
| 655 void JSGenericLowering::LowerJSCallWithArrayLike(Node* node) { |
| 656 Callable callable = CodeFactory::CallWithArrayLike(isolate()); |
| 657 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
| 658 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
| 659 isolate(), zone(), callable.descriptor(), 1, flags); |
| 660 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| 661 Node* receiver = node->InputAt(1); |
| 662 Node* arguments_list = node->InputAt(2); |
| 663 node->InsertInput(zone(), 0, stub_code); |
| 664 node->ReplaceInput(3, receiver); |
| 665 node->ReplaceInput(2, arguments_list); |
| 666 NodeProperties::ChangeOp(node, common()->Call(desc)); |
| 667 } |
| 668 |
| 655 void JSGenericLowering::LowerJSCallWithSpread(Node* node) { | 669 void JSGenericLowering::LowerJSCallWithSpread(Node* node) { |
| 656 SpreadWithArityParameter const& p = SpreadWithArityParameterOf(node->op()); | 670 SpreadWithArityParameter const& p = SpreadWithArityParameterOf(node->op()); |
| 657 int const arg_count = static_cast<int>(p.arity() - 2); | 671 int const arg_count = static_cast<int>(p.arity() - 2); |
| 658 int const spread_index = static_cast<int>(p.arity() + 1); | 672 int const spread_index = static_cast<int>(p.arity() + 1); |
| 659 CallDescriptor::Flags flags = FrameStateFlagForCall(node); | 673 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
| 660 Callable callable = CodeFactory::CallWithSpread(isolate()); | 674 Callable callable = CodeFactory::CallWithSpread(isolate()); |
| 661 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 675 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
| 662 isolate(), zone(), callable.descriptor(), arg_count, flags); | 676 isolate(), zone(), callable.descriptor(), arg_count, flags); |
| 663 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 677 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| 664 // We pass the spread in a register, not on the stack. | 678 // We pass the spread in a register, not on the stack. |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 } | 804 } |
| 791 | 805 |
| 792 | 806 |
| 793 MachineOperatorBuilder* JSGenericLowering::machine() const { | 807 MachineOperatorBuilder* JSGenericLowering::machine() const { |
| 794 return jsgraph()->machine(); | 808 return jsgraph()->machine(); |
| 795 } | 809 } |
| 796 | 810 |
| 797 } // namespace compiler | 811 } // namespace compiler |
| 798 } // namespace internal | 812 } // namespace internal |
| 799 } // namespace v8 | 813 } // namespace v8 |
| OLD | NEW |