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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 } | 538 } |
539 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 539 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
540 isolate(), zone(), callable.descriptor(), 1, flags); | 540 isolate(), zone(), callable.descriptor(), 1, flags); |
541 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 541 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
542 Node* start_index = jsgraph()->Uint32Constant(p.start_index()); | 542 Node* start_index = jsgraph()->Uint32Constant(p.start_index()); |
543 node->InsertInput(zone(), 0, stub_code); | 543 node->InsertInput(zone(), 0, stub_code); |
544 node->InsertInput(zone(), 2, start_index); | 544 node->InsertInput(zone(), 2, start_index); |
545 NodeProperties::ChangeOp(node, common()->Call(desc)); | 545 NodeProperties::ChangeOp(node, common()->Call(desc)); |
546 } | 546 } |
547 | 547 |
548 void JSGenericLowering::LowerJSCallFunction(Node* node) { | 548 void JSGenericLowering::LowerJSCall(Node* node) { |
549 CallFunctionParameters const& p = CallFunctionParametersOf(node->op()); | 549 CallParameters const& p = CallParametersOf(node->op()); |
550 int const arg_count = static_cast<int>(p.arity() - 2); | 550 int const arg_count = static_cast<int>(p.arity() - 2); |
551 ConvertReceiverMode const mode = p.convert_mode(); | 551 ConvertReceiverMode const mode = p.convert_mode(); |
552 Callable callable = CodeFactory::Call(isolate(), mode); | 552 Callable callable = CodeFactory::Call(isolate(), mode); |
553 CallDescriptor::Flags flags = FrameStateFlagForCall(node); | 553 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
554 if (p.tail_call_mode() == TailCallMode::kAllow) { | 554 if (p.tail_call_mode() == TailCallMode::kAllow) { |
555 flags |= CallDescriptor::kSupportsTailCalls; | 555 flags |= CallDescriptor::kSupportsTailCalls; |
556 } | 556 } |
557 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 557 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
558 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); | 558 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); |
559 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 559 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
560 Node* stub_arity = jsgraph()->Int32Constant(arg_count); | 560 Node* stub_arity = jsgraph()->Int32Constant(arg_count); |
561 node->InsertInput(zone(), 0, stub_code); | 561 node->InsertInput(zone(), 0, stub_code); |
562 node->InsertInput(zone(), 2, stub_arity); | 562 node->InsertInput(zone(), 2, stub_arity); |
563 NodeProperties::ChangeOp(node, common()->Call(desc)); | 563 NodeProperties::ChangeOp(node, common()->Call(desc)); |
564 } | 564 } |
565 | 565 |
566 void JSGenericLowering::LowerJSCallFunctionWithSpread(Node* node) { | 566 void JSGenericLowering::LowerJSCallWithSpread(Node* node) { |
567 CallFunctionWithSpreadParameters const& p = | 567 CallWithSpreadParameters const& p = CallWithSpreadParametersOf(node->op()); |
568 CallFunctionWithSpreadParametersOf(node->op()); | |
569 int const arg_count = static_cast<int>(p.arity() - 2); | 568 int const arg_count = static_cast<int>(p.arity() - 2); |
570 Callable callable = CodeFactory::CallWithSpread(isolate()); | 569 Callable callable = CodeFactory::CallWithSpread(isolate()); |
571 CallDescriptor::Flags flags = FrameStateFlagForCall(node); | 570 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
572 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 571 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
573 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); | 572 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); |
574 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 573 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
575 Node* stub_arity = jsgraph()->Int32Constant(arg_count); | 574 Node* stub_arity = jsgraph()->Int32Constant(arg_count); |
576 node->InsertInput(zone(), 0, stub_code); | 575 node->InsertInput(zone(), 0, stub_code); |
577 node->InsertInput(zone(), 2, stub_arity); | 576 node->InsertInput(zone(), 2, stub_arity); |
578 NodeProperties::ChangeOp(node, common()->Call(desc)); | 577 NodeProperties::ChangeOp(node, common()->Call(desc)); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 } | 686 } |
688 | 687 |
689 | 688 |
690 MachineOperatorBuilder* JSGenericLowering::machine() const { | 689 MachineOperatorBuilder* JSGenericLowering::machine() const { |
691 return jsgraph()->machine(); | 690 return jsgraph()->machine(); |
692 } | 691 } |
693 | 692 |
694 } // namespace compiler | 693 } // namespace compiler |
695 } // namespace internal | 694 } // namespace internal |
696 } // namespace v8 | 695 } // namespace v8 |
OLD | NEW |