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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 Node* new_target = node->InputAt(arg_count + 1); | 582 Node* new_target = node->InputAt(arg_count + 1); |
583 Node* receiver = jsgraph()->UndefinedConstant(); | 583 Node* receiver = jsgraph()->UndefinedConstant(); |
584 node->RemoveInput(arg_count + 1); // Drop new target. | 584 node->RemoveInput(arg_count + 1); // Drop new target. |
585 node->InsertInput(zone(), 0, stub_code); | 585 node->InsertInput(zone(), 0, stub_code); |
586 node->InsertInput(zone(), 2, new_target); | 586 node->InsertInput(zone(), 2, new_target); |
587 node->InsertInput(zone(), 3, stub_arity); | 587 node->InsertInput(zone(), 3, stub_arity); |
588 node->InsertInput(zone(), 4, receiver); | 588 node->InsertInput(zone(), 4, receiver); |
589 NodeProperties::ChangeOp(node, common()->Call(desc)); | 589 NodeProperties::ChangeOp(node, common()->Call(desc)); |
590 } | 590 } |
591 | 591 |
| 592 void JSGenericLowering::LowerJSConstructWithArrayLike(Node* node) { |
| 593 Callable callable = CodeFactory::ConstructWithArrayLike(isolate()); |
| 594 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
| 595 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
| 596 isolate(), zone(), callable.descriptor(), 1, flags); |
| 597 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| 598 Node* receiver = jsgraph()->UndefinedConstant(); |
| 599 Node* arguments_list = node->InputAt(1); |
| 600 Node* new_target = node->InputAt(2); |
| 601 node->InsertInput(zone(), 0, stub_code); |
| 602 node->ReplaceInput(2, new_target); |
| 603 node->ReplaceInput(3, arguments_list); |
| 604 node->InsertInput(zone(), 4, receiver); |
| 605 NodeProperties::ChangeOp(node, common()->Call(desc)); |
| 606 } |
| 607 |
592 void JSGenericLowering::LowerJSConstructWithSpread(Node* node) { | 608 void JSGenericLowering::LowerJSConstructWithSpread(Node* node) { |
593 SpreadWithArityParameter const& p = SpreadWithArityParameterOf(node->op()); | 609 SpreadWithArityParameter const& p = SpreadWithArityParameterOf(node->op()); |
594 int const arg_count = static_cast<int>(p.arity() - 2); | 610 int const arg_count = static_cast<int>(p.arity() - 2); |
595 int const spread_index = arg_count; | 611 int const spread_index = arg_count; |
596 int const new_target_index = arg_count + 1; | 612 int const new_target_index = arg_count + 1; |
597 CallDescriptor::Flags flags = FrameStateFlagForCall(node); | 613 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
598 Callable callable = CodeFactory::ConstructWithSpread(isolate()); | 614 Callable callable = CodeFactory::ConstructWithSpread(isolate()); |
599 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 615 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
600 isolate(), zone(), callable.descriptor(), arg_count, flags); | 616 isolate(), zone(), callable.descriptor(), arg_count, flags); |
601 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 617 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 } | 820 } |
805 | 821 |
806 | 822 |
807 MachineOperatorBuilder* JSGenericLowering::machine() const { | 823 MachineOperatorBuilder* JSGenericLowering::machine() const { |
808 return jsgraph()->machine(); | 824 return jsgraph()->machine(); |
809 } | 825 } |
810 | 826 |
811 } // namespace compiler | 827 } // namespace compiler |
812 } // namespace internal | 828 } // namespace internal |
813 } // namespace v8 | 829 } // namespace v8 |
OLD | NEW |