Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(639)

Side by Side Diff: src/compiler/js-generic-lowering.cc

Issue 2946893004: [WIP] Start adding JSCallWithVarargs
Patch Set: REBASE Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/js-call-reducer.cc ('k') | src/compiler/js-operator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 node->RemoveInput(spread_index); 625 node->RemoveInput(spread_index);
626 626
627 node->InsertInput(zone(), 0, stub_code); 627 node->InsertInput(zone(), 0, stub_code);
628 node->InsertInput(zone(), 2, new_target); 628 node->InsertInput(zone(), 2, new_target);
629 node->InsertInput(zone(), 3, stack_arg_count); 629 node->InsertInput(zone(), 3, stack_arg_count);
630 node->InsertInput(zone(), 4, spread); 630 node->InsertInput(zone(), 4, spread);
631 node->InsertInput(zone(), 5, receiver); 631 node->InsertInput(zone(), 5, receiver);
632 NodeProperties::ChangeOp(node, common()->Call(desc)); 632 NodeProperties::ChangeOp(node, common()->Call(desc));
633 } 633 }
634 634
635 void JSGenericLowering::LowerJSCall(Node* node) {
636 CallParameters const& p = CallParametersOf(node->op());
637 int const arg_count = static_cast<int>(p.arity() - 2);
638 ConvertReceiverMode const mode = p.convert_mode();
639 Callable callable = CodeFactory::Call(isolate(), mode);
640 CallDescriptor::Flags flags = FrameStateFlagForCall(node);
641 if (p.tail_call_mode() == TailCallMode::kAllow) {
642 flags |= CallDescriptor::kSupportsTailCalls;
643 }
644 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
645 isolate(), zone(), callable.descriptor(), arg_count + 1, flags);
646 Node* stub_code = jsgraph()->HeapConstant(callable.code());
647 Node* stub_arity = jsgraph()->Int32Constant(arg_count);
648 node->InsertInput(zone(), 0, stub_code);
649 node->InsertInput(zone(), 2, stub_arity);
650 NodeProperties::ChangeOp(node, common()->Call(desc));
651 }
652
635 void JSGenericLowering::LowerJSCallForwardVarargs(Node* node) { 653 void JSGenericLowering::LowerJSCallForwardVarargs(Node* node) {
636 CallForwardVarargsParameters p = CallForwardVarargsParametersOf(node->op()); 654 CallForwardVarargsParameters p = CallForwardVarargsParametersOf(node->op());
637 int const arg_count = static_cast<int>(p.arity() - 2); 655 int const arg_count = static_cast<int>(p.arity() - 2);
638 CallDescriptor::Flags flags = FrameStateFlagForCall(node); 656 CallDescriptor::Flags flags = FrameStateFlagForCall(node);
639 Callable callable = CodeFactory::CallForwardVarargs(isolate()); 657 Callable callable = CodeFactory::CallForwardVarargs(isolate());
640 if (p.tail_call_mode() == TailCallMode::kAllow) { 658 if (p.tail_call_mode() == TailCallMode::kAllow) {
641 flags |= CallDescriptor::kSupportsTailCalls; 659 flags |= CallDescriptor::kSupportsTailCalls;
642 } 660 }
643 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 661 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
644 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); 662 isolate(), zone(), callable.descriptor(), arg_count + 1, flags);
645 Node* stub_code = jsgraph()->HeapConstant(callable.code()); 663 Node* stub_code = jsgraph()->HeapConstant(callable.code());
646 Node* stub_arity = jsgraph()->Int32Constant(arg_count); 664 Node* stub_arity = jsgraph()->Int32Constant(arg_count);
647 Node* start_index = jsgraph()->Uint32Constant(p.start_index()); 665 Node* start_index = jsgraph()->Uint32Constant(p.start_index());
648 node->InsertInput(zone(), 0, stub_code); 666 node->InsertInput(zone(), 0, stub_code);
649 node->InsertInput(zone(), 2, stub_arity); 667 node->InsertInput(zone(), 2, stub_arity);
650 node->InsertInput(zone(), 3, start_index); 668 node->InsertInput(zone(), 3, start_index);
651 NodeProperties::ChangeOp(node, common()->Call(desc)); 669 NodeProperties::ChangeOp(node, common()->Call(desc));
652 } 670 }
653 671
654 void JSGenericLowering::LowerJSCall(Node* node) { 672 void JSGenericLowering::LowerJSCallVarargs(Node* node) {
655 CallParameters const& p = CallParametersOf(node->op()); 673 CallVarargsParameters p = CallVarargsParametersOf(node->op());
656 int const arg_count = static_cast<int>(p.arity() - 2); 674 int const arg_count = static_cast<int>(p.arity() - 2);
657 ConvertReceiverMode const mode = p.convert_mode();
658 Callable callable = CodeFactory::Call(isolate(), mode);
659 CallDescriptor::Flags flags = FrameStateFlagForCall(node); 675 CallDescriptor::Flags flags = FrameStateFlagForCall(node);
660 if (p.tail_call_mode() == TailCallMode::kAllow) { 676 Callable callable = CodeFactory::CallVarargs(isolate());
661 flags |= CallDescriptor::kSupportsTailCalls;
662 }
663 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 677 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
664 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); 678 isolate(), zone(), callable.descriptor(), arg_count + 1, flags);
665 Node* stub_code = jsgraph()->HeapConstant(callable.code()); 679 Node* stub_code = jsgraph()->HeapConstant(callable.code());
666 Node* stub_arity = jsgraph()->Int32Constant(arg_count); 680 Node* stub_arity = jsgraph()->Int32Constant(arg_count);
681 Node* arguments_list = node->InputAt(arg_count + 2);
682 Node* arguments_length = node->InputAt(arg_count + 3);
683 node->RemoveInput(arg_count + 3);
684 node->RemoveInput(arg_count + 2);
667 node->InsertInput(zone(), 0, stub_code); 685 node->InsertInput(zone(), 0, stub_code);
668 node->InsertInput(zone(), 2, stub_arity); 686 node->InsertInput(zone(), 2, stub_arity);
687 node->InsertInput(zone(), 3, arguments_list);
688 node->InsertInput(zone(), 4, arguments_length);
669 NodeProperties::ChangeOp(node, common()->Call(desc)); 689 NodeProperties::ChangeOp(node, common()->Call(desc));
670 } 690 }
671 691
672 void JSGenericLowering::LowerJSCallWithArrayLike(Node* node) { 692 void JSGenericLowering::LowerJSCallWithArrayLike(Node* node) {
673 Callable callable = CodeFactory::CallWithArrayLike(isolate()); 693 Callable callable = CodeFactory::CallWithArrayLike(isolate());
674 CallDescriptor::Flags flags = FrameStateFlagForCall(node); 694 CallDescriptor::Flags flags = FrameStateFlagForCall(node);
675 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 695 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
676 isolate(), zone(), callable.descriptor(), 1, flags); 696 isolate(), zone(), callable.descriptor(), 1, flags);
677 Node* stub_code = jsgraph()->HeapConstant(callable.code()); 697 Node* stub_code = jsgraph()->HeapConstant(callable.code());
678 Node* receiver = node->InputAt(1); 698 Node* receiver = node->InputAt(1);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 } 841 }
822 842
823 843
824 MachineOperatorBuilder* JSGenericLowering::machine() const { 844 MachineOperatorBuilder* JSGenericLowering::machine() const {
825 return jsgraph()->machine(); 845 return jsgraph()->machine();
826 } 846 }
827 847
828 } // namespace compiler 848 } // namespace compiler
829 } // namespace internal 849 } // namespace internal
830 } // namespace v8 850 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-call-reducer.cc ('k') | src/compiler/js-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698