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

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

Issue 2949813002: [turbofan] Introduce new JSConstructWithArrayLike operator. (Closed)
Patch Set: Address feedback. 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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 =
594 Builtins::CallableFor(isolate(), Builtins::kConstructWithArrayLike);
595 CallDescriptor::Flags flags = FrameStateFlagForCall(node);
596 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
597 isolate(), zone(), callable.descriptor(), 1, flags);
598 Node* stub_code = jsgraph()->HeapConstant(callable.code());
599 Node* receiver = jsgraph()->UndefinedConstant();
600 Node* arguments_list = node->InputAt(1);
601 Node* new_target = node->InputAt(2);
602 node->InsertInput(zone(), 0, stub_code);
603 node->ReplaceInput(2, new_target);
604 node->ReplaceInput(3, arguments_list);
605 node->InsertInput(zone(), 4, receiver);
606 NodeProperties::ChangeOp(node, common()->Call(desc));
607 }
608
592 void JSGenericLowering::LowerJSConstructWithSpread(Node* node) { 609 void JSGenericLowering::LowerJSConstructWithSpread(Node* node) {
593 SpreadWithArityParameter const& p = SpreadWithArityParameterOf(node->op()); 610 SpreadWithArityParameter const& p = SpreadWithArityParameterOf(node->op());
594 int const arg_count = static_cast<int>(p.arity() - 2); 611 int const arg_count = static_cast<int>(p.arity() - 2);
595 int const spread_index = arg_count; 612 int const spread_index = arg_count;
596 int const new_target_index = arg_count + 1; 613 int const new_target_index = arg_count + 1;
597 CallDescriptor::Flags flags = FrameStateFlagForCall(node); 614 CallDescriptor::Flags flags = FrameStateFlagForCall(node);
598 Callable callable = CodeFactory::ConstructWithSpread(isolate()); 615 Callable callable = CodeFactory::ConstructWithSpread(isolate());
599 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 616 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
600 isolate(), zone(), callable.descriptor(), arg_count, flags); 617 isolate(), zone(), callable.descriptor(), arg_count, flags);
601 Node* stub_code = jsgraph()->HeapConstant(callable.code()); 618 Node* stub_code = jsgraph()->HeapConstant(callable.code());
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 } 821 }
805 822
806 823
807 MachineOperatorBuilder* JSGenericLowering::machine() const { 824 MachineOperatorBuilder* JSGenericLowering::machine() const {
808 return jsgraph()->machine(); 825 return jsgraph()->machine();
809 } 826 }
810 827
811 } // namespace compiler 828 } // namespace compiler
812 } // namespace internal 829 } // namespace internal
813 } // namespace v8 830 } // 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