| 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/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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 542 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
| 543 CallDescriptor* desc = | 543 CallDescriptor* desc = |
| 544 Linkage::GetStubCallDescriptor(isolate(), zone(), d, arity - 1, flags); | 544 Linkage::GetStubCallDescriptor(isolate(), zone(), d, arity - 1, flags); |
| 545 Node* stub_code = jsgraph()->HeapConstant(stub.GetCode()); | 545 Node* stub_code = jsgraph()->HeapConstant(stub.GetCode()); |
| 546 Node* actual_construct = NodeProperties::GetValueInput(node, 0); | 546 Node* actual_construct = NodeProperties::GetValueInput(node, 0); |
| 547 Node* original_construct = NodeProperties::GetValueInput(node, arity - 1); | 547 Node* original_construct = NodeProperties::GetValueInput(node, arity - 1); |
| 548 node->RemoveInput(arity - 1); // Drop original constructor. | 548 node->RemoveInput(arity - 1); // Drop original constructor. |
| 549 node->InsertInput(zone(), 0, stub_code); | 549 node->InsertInput(zone(), 0, stub_code); |
| 550 node->InsertInput(zone(), 1, jsgraph()->Int32Constant(arity - 2)); | 550 node->InsertInput(zone(), 1, jsgraph()->Int32Constant(arity - 2)); |
| 551 node->InsertInput(zone(), 2, actual_construct); | 551 node->InsertInput(zone(), 2, actual_construct); |
| 552 // TODO(mstarzinger): Pass original constructor in register. | 552 node->InsertInput(zone(), 3, original_construct); |
| 553 CHECK_EQ(actual_construct, original_construct); | 553 node->InsertInput(zone(), 4, jsgraph()->UndefinedConstant()); |
| 554 node->InsertInput(zone(), 3, jsgraph()->UndefinedConstant()); | |
| 555 node->set_op(common()->Call(desc)); | 554 node->set_op(common()->Call(desc)); |
| 556 } | 555 } |
| 557 | 556 |
| 558 | 557 |
| 559 void JSGenericLowering::LowerJSCallFunction(Node* node) { | 558 void JSGenericLowering::LowerJSCallFunction(Node* node) { |
| 560 const CallFunctionParameters& p = CallFunctionParametersOf(node->op()); | 559 const CallFunctionParameters& p = CallFunctionParametersOf(node->op()); |
| 561 int arg_count = static_cast<int>(p.arity() - 2); | 560 int arg_count = static_cast<int>(p.arity() - 2); |
| 562 CallFunctionStub stub(isolate(), arg_count, p.flags()); | 561 CallFunctionStub stub(isolate(), arg_count, p.flags()); |
| 563 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor(); | 562 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor(); |
| 564 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 563 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 } | 841 } |
| 843 | 842 |
| 844 | 843 |
| 845 MachineOperatorBuilder* JSGenericLowering::machine() const { | 844 MachineOperatorBuilder* JSGenericLowering::machine() const { |
| 846 return jsgraph()->machine(); | 845 return jsgraph()->machine(); |
| 847 } | 846 } |
| 848 | 847 |
| 849 } // namespace compiler | 848 } // namespace compiler |
| 850 } // namespace internal | 849 } // namespace internal |
| 851 } // namespace v8 | 850 } // namespace v8 |
| OLD | NEW |