OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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-call-reducer.h" | 5 #include "src/compiler/js-call-reducer.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 // TODO(turbofan): Consider introducing a JSCallApiCallback operator for | 659 // TODO(turbofan): Consider introducing a JSCallApiCallback operator for |
660 // this and lower it during JSGenericLowering, and unify this with the | 660 // this and lower it during JSGenericLowering, and unify this with the |
661 // JSNativeContextSpecialization::InlineApiCall method a bit. | 661 // JSNativeContextSpecialization::InlineApiCall method a bit. |
662 Handle<CallHandlerInfo> call_handler_info( | 662 Handle<CallHandlerInfo> call_handler_info( |
663 CallHandlerInfo::cast(function_template_info->call_code()), isolate()); | 663 CallHandlerInfo::cast(function_template_info->call_code()), isolate()); |
664 Handle<Object> data(call_handler_info->data(), isolate()); | 664 Handle<Object> data(call_handler_info->data(), isolate()); |
665 CallApiCallbackStub stub(isolate(), argc, false); | 665 CallApiCallbackStub stub(isolate(), argc, false); |
666 CallInterfaceDescriptor cid = stub.GetCallInterfaceDescriptor(); | 666 CallInterfaceDescriptor cid = stub.GetCallInterfaceDescriptor(); |
667 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( | 667 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( |
668 isolate(), graph()->zone(), cid, | 668 isolate(), graph()->zone(), cid, |
669 cid.GetStackParameterCount() + argc + 1 /* implicit receiver */, | 669 cid.GetStackParameterCount() + argc + |
| 670 2 /* implicit receiver + accessor_holder */, |
670 CallDescriptor::kNeedsFrameState, Operator::kNoProperties, | 671 CallDescriptor::kNeedsFrameState, Operator::kNoProperties, |
671 MachineType::AnyTagged(), 1); | 672 MachineType::AnyTagged(), 1); |
672 ApiFunction api_function(v8::ToCData<Address>(call_handler_info->callback())); | 673 ApiFunction api_function(v8::ToCData<Address>(call_handler_info->callback())); |
673 Node* holder = lookup == CallOptimization::kHolderFound | 674 Node* holder = lookup == CallOptimization::kHolderFound |
674 ? jsgraph()->HeapConstant(api_holder) | 675 ? jsgraph()->HeapConstant(api_holder) |
675 : receiver; | 676 : receiver; |
676 ExternalReference function_reference( | 677 ExternalReference function_reference( |
677 &api_function, ExternalReference::DIRECT_API_CALL, isolate()); | 678 &api_function, ExternalReference::DIRECT_API_CALL, isolate()); |
678 node->InsertInput(graph()->zone(), 0, | 679 node->InsertInput(graph()->zone(), 0, |
679 jsgraph()->HeapConstant(stub.GetCode())); | 680 jsgraph()->HeapConstant(stub.GetCode())); |
680 node->InsertInput(graph()->zone(), 2, jsgraph()->Constant(data)); | 681 node->InsertInput(graph()->zone(), 2, jsgraph()->Constant(data)); |
681 node->InsertInput(graph()->zone(), 3, holder); | 682 node->InsertInput(graph()->zone(), 3, holder); |
682 node->InsertInput(graph()->zone(), 4, | 683 node->InsertInput(graph()->zone(), 4, |
683 jsgraph()->ExternalConstant(function_reference)); | 684 jsgraph()->ExternalConstant(function_reference)); |
684 node->ReplaceInput(5, receiver); | 685 node->InsertInput(graph()->zone(), 5, holder /* as accessor_holder */); |
| 686 node->ReplaceInput(6, receiver); |
685 NodeProperties::ChangeOp(node, common()->Call(call_descriptor)); | 687 NodeProperties::ChangeOp(node, common()->Call(call_descriptor)); |
686 return Changed(node); | 688 return Changed(node); |
687 } | 689 } |
688 | 690 |
689 Reduction JSCallReducer::ReduceCallOrConstructWithArrayLikeOrSpread( | 691 Reduction JSCallReducer::ReduceCallOrConstructWithArrayLikeOrSpread( |
690 Node* node, int arity, CallFrequency const& frequency) { | 692 Node* node, int arity, CallFrequency const& frequency) { |
691 DCHECK(node->opcode() == IrOpcode::kJSCallWithArrayLike || | 693 DCHECK(node->opcode() == IrOpcode::kJSCallWithArrayLike || |
692 node->opcode() == IrOpcode::kJSCallWithSpread || | 694 node->opcode() == IrOpcode::kJSCallWithSpread || |
693 node->opcode() == IrOpcode::kJSConstructWithArrayLike || | 695 node->opcode() == IrOpcode::kJSConstructWithArrayLike || |
694 node->opcode() == IrOpcode::kJSConstructWithSpread); | 696 node->opcode() == IrOpcode::kJSConstructWithSpread); |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 return jsgraph()->javascript(); | 1188 return jsgraph()->javascript(); |
1187 } | 1189 } |
1188 | 1190 |
1189 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { | 1191 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { |
1190 return jsgraph()->simplified(); | 1192 return jsgraph()->simplified(); |
1191 } | 1193 } |
1192 | 1194 |
1193 } // namespace compiler | 1195 } // namespace compiler |
1194 } // namespace internal | 1196 } // namespace internal |
1195 } // namespace v8 | 1197 } // namespace v8 |
OLD | NEW |