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

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

Issue 1234023003: [turbofan] Build graphs for super constructor calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compilation in release mode. Created 5 years, 5 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/ast-graph-builder.cc ('k') | no next file » | 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/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/code-stubs.h" 6 #include "src/code-stubs.h"
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/js-generic-lowering.h" 8 #include "src/compiler/js-generic-lowering.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 ReplaceWithRuntimeCall(node, Runtime::kPushCatchContext); 533 ReplaceWithRuntimeCall(node, Runtime::kPushCatchContext);
534 } 534 }
535 535
536 536
537 void JSGenericLowering::LowerJSCallConstruct(Node* node) { 537 void JSGenericLowering::LowerJSCallConstruct(Node* node) {
538 int arity = OpParameter<int>(node); 538 int arity = OpParameter<int>(node);
539 CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS); 539 CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS);
540 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor(); 540 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor();
541 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); 541 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
542 CallDescriptor* desc = 542 CallDescriptor* desc =
543 Linkage::GetStubCallDescriptor(isolate(), zone(), d, arity, flags); 543 Linkage::GetStubCallDescriptor(isolate(), zone(), d, arity - 1, flags);
544 Node* stub_code = jsgraph()->HeapConstant(stub.GetCode()); 544 Node* stub_code = jsgraph()->HeapConstant(stub.GetCode());
545 Node* construct = NodeProperties::GetValueInput(node, 0); 545 Node* actual_construct = NodeProperties::GetValueInput(node, 0);
546 Node* original_construct = NodeProperties::GetValueInput(node, arity - 1);
547 node->RemoveInput(arity - 1); // Drop original constructor.
546 node->InsertInput(zone(), 0, stub_code); 548 node->InsertInput(zone(), 0, stub_code);
547 node->InsertInput(zone(), 1, jsgraph()->Int32Constant(arity - 1)); 549 node->InsertInput(zone(), 1, jsgraph()->Int32Constant(arity - 2));
548 node->InsertInput(zone(), 2, construct); 550 node->InsertInput(zone(), 2, actual_construct);
551 // TODO(mstarzinger): Pass original constructor in register.
552 CHECK_EQ(actual_construct, original_construct);
549 node->InsertInput(zone(), 3, jsgraph()->UndefinedConstant()); 553 node->InsertInput(zone(), 3, jsgraph()->UndefinedConstant());
550 node->set_op(common()->Call(desc)); 554 node->set_op(common()->Call(desc));
551 } 555 }
552 556
553 557
554 void JSGenericLowering::LowerJSCallFunction(Node* node) { 558 void JSGenericLowering::LowerJSCallFunction(Node* node) {
555 const CallFunctionParameters& p = CallFunctionParametersOf(node->op()); 559 const CallFunctionParameters& p = CallFunctionParametersOf(node->op());
556 int arg_count = static_cast<int>(p.arity() - 2); 560 int arg_count = static_cast<int>(p.arity() - 2);
557 CallFunctionStub stub(isolate(), arg_count, p.flags()); 561 CallFunctionStub stub(isolate(), arg_count, p.flags());
558 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor(); 562 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor();
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 } 841 }
838 842
839 843
840 MachineOperatorBuilder* JSGenericLowering::machine() const { 844 MachineOperatorBuilder* JSGenericLowering::machine() const {
841 return jsgraph()->machine(); 845 return jsgraph()->machine();
842 } 846 }
843 847
844 } // namespace compiler 848 } // namespace compiler
845 } // namespace internal 849 } // namespace internal
846 } // namespace v8 850 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698