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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 Node* new_target = node->InputAt(arg_count + 1); | 523 Node* new_target = node->InputAt(arg_count + 1); |
524 Node* receiver = jsgraph()->UndefinedConstant(); | 524 Node* receiver = jsgraph()->UndefinedConstant(); |
525 node->RemoveInput(arg_count + 1); // Drop new target. | 525 node->RemoveInput(arg_count + 1); // Drop new target. |
526 node->InsertInput(zone(), 0, stub_code); | 526 node->InsertInput(zone(), 0, stub_code); |
527 node->InsertInput(zone(), 2, new_target); | 527 node->InsertInput(zone(), 2, new_target); |
528 node->InsertInput(zone(), 3, stub_arity); | 528 node->InsertInput(zone(), 3, stub_arity); |
529 node->InsertInput(zone(), 4, receiver); | 529 node->InsertInput(zone(), 4, receiver); |
530 NodeProperties::ChangeOp(node, common()->Call(desc)); | 530 NodeProperties::ChangeOp(node, common()->Call(desc)); |
531 } | 531 } |
532 | 532 |
| 533 void JSGenericLowering::LowerJSCallForwardVarargs(Node* node) { |
| 534 CallForwardVarargsParameters p = CallForwardVarargsParametersOf(node->op()); |
| 535 Callable callable = CodeFactory::CallForwardVarargs(isolate()); |
| 536 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
| 537 if (p.tail_call_mode() == TailCallMode::kAllow) { |
| 538 flags |= CallDescriptor::kSupportsTailCalls; |
| 539 } |
| 540 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
| 541 isolate(), zone(), callable.descriptor(), 1, flags); |
| 542 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| 543 Node* start_index = jsgraph()->Uint32Constant(p.start_index()); |
| 544 node->InsertInput(zone(), 0, stub_code); |
| 545 node->InsertInput(zone(), 2, start_index); |
| 546 NodeProperties::ChangeOp(node, common()->Call(desc)); |
| 547 } |
| 548 |
533 void JSGenericLowering::LowerJSCallFunction(Node* node) { | 549 void JSGenericLowering::LowerJSCallFunction(Node* node) { |
534 CallFunctionParameters const& p = CallFunctionParametersOf(node->op()); | 550 CallFunctionParameters const& p = CallFunctionParametersOf(node->op()); |
535 int const arg_count = static_cast<int>(p.arity() - 2); | 551 int const arg_count = static_cast<int>(p.arity() - 2); |
536 ConvertReceiverMode const mode = p.convert_mode(); | 552 ConvertReceiverMode const mode = p.convert_mode(); |
537 Callable callable = CodeFactory::Call(isolate(), mode); | 553 Callable callable = CodeFactory::Call(isolate(), mode); |
538 CallDescriptor::Flags flags = FrameStateFlagForCall(node); | 554 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
539 if (p.tail_call_mode() == TailCallMode::kAllow) { | 555 if (p.tail_call_mode() == TailCallMode::kAllow) { |
540 flags |= CallDescriptor::kSupportsTailCalls; | 556 flags |= CallDescriptor::kSupportsTailCalls; |
541 } | 557 } |
542 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 558 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 } | 683 } |
668 | 684 |
669 | 685 |
670 MachineOperatorBuilder* JSGenericLowering::machine() const { | 686 MachineOperatorBuilder* JSGenericLowering::machine() const { |
671 return jsgraph()->machine(); | 687 return jsgraph()->machine(); |
672 } | 688 } |
673 | 689 |
674 } // namespace compiler | 690 } // namespace compiler |
675 } // namespace internal | 691 } // namespace internal |
676 } // namespace v8 | 692 } // namespace v8 |
OLD | NEW |