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

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

Issue 2729143002: [compiler] Simplify paramerters for spread call. (Closed)
Patch Set: Address nits. Created 3 years, 9 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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 Node* receiver = jsgraph()->UndefinedConstant(); 521 Node* receiver = jsgraph()->UndefinedConstant();
522 node->RemoveInput(arg_count + 1); // Drop new target. 522 node->RemoveInput(arg_count + 1); // Drop new target.
523 node->InsertInput(zone(), 0, stub_code); 523 node->InsertInput(zone(), 0, stub_code);
524 node->InsertInput(zone(), 2, new_target); 524 node->InsertInput(zone(), 2, new_target);
525 node->InsertInput(zone(), 3, stub_arity); 525 node->InsertInput(zone(), 3, stub_arity);
526 node->InsertInput(zone(), 4, receiver); 526 node->InsertInput(zone(), 4, receiver);
527 NodeProperties::ChangeOp(node, common()->Call(desc)); 527 NodeProperties::ChangeOp(node, common()->Call(desc));
528 } 528 }
529 529
530 void JSGenericLowering::LowerJSConstructWithSpread(Node* node) { 530 void JSGenericLowering::LowerJSConstructWithSpread(Node* node) {
531 ConstructWithSpreadParameters const& p = 531 SpreadWithArityParameters const& p = SpreadWithArityParametersOf(node->op());
532 ConstructWithSpreadParametersOf(node->op());
533 int const arg_count = static_cast<int>(p.arity() - 2); 532 int const arg_count = static_cast<int>(p.arity() - 2);
534 CallDescriptor::Flags flags = FrameStateFlagForCall(node); 533 CallDescriptor::Flags flags = FrameStateFlagForCall(node);
535 Callable callable = CodeFactory::ConstructWithSpread(isolate()); 534 Callable callable = CodeFactory::ConstructWithSpread(isolate());
536 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 535 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
537 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); 536 isolate(), zone(), callable.descriptor(), arg_count + 1, flags);
538 Node* stub_code = jsgraph()->HeapConstant(callable.code()); 537 Node* stub_code = jsgraph()->HeapConstant(callable.code());
539 Node* stub_arity = jsgraph()->Int32Constant(arg_count); 538 Node* stub_arity = jsgraph()->Int32Constant(arg_count);
540 Node* new_target = node->InputAt(arg_count + 1); 539 Node* new_target = node->InputAt(arg_count + 1);
541 Node* receiver = jsgraph()->UndefinedConstant(); 540 Node* receiver = jsgraph()->UndefinedConstant();
542 node->RemoveInput(arg_count + 1); // Drop new target. 541 node->RemoveInput(arg_count + 1); // Drop new target.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 574 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
576 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); 575 isolate(), zone(), callable.descriptor(), arg_count + 1, flags);
577 Node* stub_code = jsgraph()->HeapConstant(callable.code()); 576 Node* stub_code = jsgraph()->HeapConstant(callable.code());
578 Node* stub_arity = jsgraph()->Int32Constant(arg_count); 577 Node* stub_arity = jsgraph()->Int32Constant(arg_count);
579 node->InsertInput(zone(), 0, stub_code); 578 node->InsertInput(zone(), 0, stub_code);
580 node->InsertInput(zone(), 2, stub_arity); 579 node->InsertInput(zone(), 2, stub_arity);
581 NodeProperties::ChangeOp(node, common()->Call(desc)); 580 NodeProperties::ChangeOp(node, common()->Call(desc));
582 } 581 }
583 582
584 void JSGenericLowering::LowerJSCallWithSpread(Node* node) { 583 void JSGenericLowering::LowerJSCallWithSpread(Node* node) {
585 CallWithSpreadParameters const& p = CallWithSpreadParametersOf(node->op()); 584 SpreadWithArityParameters const& p = SpreadWithArityParametersOf(node->op());
586 int const arg_count = static_cast<int>(p.arity() - 2); 585 int const arg_count = static_cast<int>(p.arity() - 2);
587 Callable callable = CodeFactory::CallWithSpread(isolate()); 586 Callable callable = CodeFactory::CallWithSpread(isolate());
588 CallDescriptor::Flags flags = FrameStateFlagForCall(node); 587 CallDescriptor::Flags flags = FrameStateFlagForCall(node);
589 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 588 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
590 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); 589 isolate(), zone(), callable.descriptor(), arg_count + 1, flags);
591 Node* stub_code = jsgraph()->HeapConstant(callable.code()); 590 Node* stub_code = jsgraph()->HeapConstant(callable.code());
592 Node* stub_arity = jsgraph()->Int32Constant(arg_count); 591 Node* stub_arity = jsgraph()->Int32Constant(arg_count);
593 node->InsertInput(zone(), 0, stub_code); 592 node->InsertInput(zone(), 0, stub_code);
594 node->InsertInput(zone(), 2, stub_arity); 593 node->InsertInput(zone(), 2, stub_arity);
595 NodeProperties::ChangeOp(node, common()->Call(desc)); 594 NodeProperties::ChangeOp(node, common()->Call(desc));
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 } 706 }
708 707
709 708
710 MachineOperatorBuilder* JSGenericLowering::machine() const { 709 MachineOperatorBuilder* JSGenericLowering::machine() const {
711 return jsgraph()->machine(); 710 return jsgraph()->machine();
712 } 711 }
713 712
714 } // namespace compiler 713 } // namespace compiler
715 } // namespace internal 714 } // namespace internal
716 } // namespace v8 715 } // 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