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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 | 523 |
524 void JSGenericLowering::LowerJSCallConstruct(Node* node) { | 524 void JSGenericLowering::LowerJSCallConstruct(Node* node) { |
525 // TODO(bmeurer): Use the Construct builtin here. | 525 // TODO(bmeurer): Use the Construct builtin here. |
526 int arity = OpParameter<int>(node); | 526 int arity = OpParameter<int>(node); |
527 CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL); | 527 CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL); |
528 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor(); | 528 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor(); |
529 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 529 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
530 CallDescriptor* desc = | 530 CallDescriptor* desc = |
531 Linkage::GetStubCallDescriptor(isolate(), zone(), d, arity - 1, flags); | 531 Linkage::GetStubCallDescriptor(isolate(), zone(), d, arity - 1, flags); |
532 Node* stub_code = jsgraph()->HeapConstant(stub.GetCode()); | 532 Node* stub_code = jsgraph()->HeapConstant(stub.GetCode()); |
533 Node* actual_construct = NodeProperties::GetValueInput(node, 0); | 533 Node* target = NodeProperties::GetValueInput(node, 0); |
534 Node* original_construct = NodeProperties::GetValueInput(node, arity - 1); | 534 Node* new_target = NodeProperties::GetValueInput(node, arity - 1); |
535 node->RemoveInput(arity - 1); // Drop original constructor. | 535 node->RemoveInput(arity - 1); // Drop new target. |
536 node->InsertInput(zone(), 0, stub_code); | 536 node->InsertInput(zone(), 0, stub_code); |
537 node->InsertInput(zone(), 1, jsgraph()->Int32Constant(arity - 2)); | 537 node->InsertInput(zone(), 1, jsgraph()->Int32Constant(arity - 2)); |
538 node->InsertInput(zone(), 2, actual_construct); | 538 node->InsertInput(zone(), 2, target); |
539 node->InsertInput(zone(), 3, original_construct); | 539 node->InsertInput(zone(), 3, new_target); |
540 node->InsertInput(zone(), 4, jsgraph()->UndefinedConstant()); | 540 node->InsertInput(zone(), 4, jsgraph()->UndefinedConstant()); |
541 NodeProperties::ChangeOp(node, common()->Call(desc)); | 541 NodeProperties::ChangeOp(node, common()->Call(desc)); |
542 } | 542 } |
543 | 543 |
544 | 544 |
545 void JSGenericLowering::LowerJSCallFunction(Node* node) { | 545 void JSGenericLowering::LowerJSCallFunction(Node* node) { |
546 CallFunctionParameters const& p = CallFunctionParametersOf(node->op()); | 546 CallFunctionParameters const& p = CallFunctionParametersOf(node->op()); |
547 int const arg_count = static_cast<int>(p.arity() - 2); | 547 int const arg_count = static_cast<int>(p.arity() - 2); |
548 ConvertReceiverMode const mode = p.convert_mode(); | 548 ConvertReceiverMode const mode = p.convert_mode(); |
549 Callable callable = CodeFactory::Call(isolate(), mode); | 549 Callable callable = CodeFactory::Call(isolate(), mode); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 } | 855 } |
856 | 856 |
857 | 857 |
858 MachineOperatorBuilder* JSGenericLowering::machine() const { | 858 MachineOperatorBuilder* JSGenericLowering::machine() const { |
859 return jsgraph()->machine(); | 859 return jsgraph()->machine(); |
860 } | 860 } |
861 | 861 |
862 } // namespace compiler | 862 } // namespace compiler |
863 } // namespace internal | 863 } // namespace internal |
864 } // namespace v8 | 864 } // namespace v8 |
OLD | NEW |