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/code-assembler.h" | 5 #include "src/compiler/code-assembler.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 size_t result_size, Node* target, Node* context, | 540 size_t result_size, Node* target, Node* context, |
541 TArgs... args) { | 541 TArgs... args) { |
542 Node* nodes[] = {target, args..., context}; | 542 Node* nodes[] = {target, args..., context}; |
543 return CallStubN(descriptor, result_size, arraysize(nodes), nodes); | 543 return CallStubN(descriptor, result_size, arraysize(nodes), nodes); |
544 } | 544 } |
545 | 545 |
546 // Instantiate CallStubR() with up to 6 arguments. | 546 // Instantiate CallStubR() with up to 6 arguments. |
547 #define INSTANTIATE(...) \ | 547 #define INSTANTIATE(...) \ |
548 template V8_EXPORT_PRIVATE Node* CodeAssembler::CallStubR( \ | 548 template V8_EXPORT_PRIVATE Node* CodeAssembler::CallStubR( \ |
549 const CallInterfaceDescriptor& descriptor, size_t, Node*, __VA_ARGS__); | 549 const CallInterfaceDescriptor& descriptor, size_t, Node*, __VA_ARGS__); |
550 REPEAT_1_TO_7(INSTANTIATE, Node*) | 550 REPEAT_1_TO_8(INSTANTIATE, Node*) |
551 #undef INSTANTIATE | 551 #undef INSTANTIATE |
552 | 552 |
553 Node* CodeAssembler::CallStubN(const CallInterfaceDescriptor& descriptor, | 553 Node* CodeAssembler::CallStubN(const CallInterfaceDescriptor& descriptor, |
554 size_t result_size, int input_count, | 554 size_t result_size, int input_count, |
555 Node* const* inputs) { | 555 Node* const* inputs) { |
556 // 2 is for target and context. | 556 // 2 is for target and context. |
557 DCHECK_LE(2, input_count); | 557 DCHECK_LE(2, input_count); |
558 int argc = input_count - 2; | 558 int argc = input_count - 2; |
559 DCHECK_LE(descriptor.GetParameterCount(), argc); | 559 DCHECK_LE(descriptor.GetParameterCount(), argc); |
560 // Extra arguments not mentioned in the descriptor are passed on the stack. | 560 // Extra arguments not mentioned in the descriptor are passed on the stack. |
(...skipping 28 matching lines...) Expand all Loading... |
589 // Instantiate TailCallStub() with up to 6 arguments. | 589 // Instantiate TailCallStub() with up to 6 arguments. |
590 #define INSTANTIATE(...) \ | 590 #define INSTANTIATE(...) \ |
591 template V8_EXPORT_PRIVATE Node* CodeAssembler::TailCallStub( \ | 591 template V8_EXPORT_PRIVATE Node* CodeAssembler::TailCallStub( \ |
592 const CallInterfaceDescriptor& descriptor, Node*, __VA_ARGS__); | 592 const CallInterfaceDescriptor& descriptor, Node*, __VA_ARGS__); |
593 REPEAT_1_TO_7(INSTANTIATE, Node*) | 593 REPEAT_1_TO_7(INSTANTIATE, Node*) |
594 #undef INSTANTIATE | 594 #undef INSTANTIATE |
595 | 595 |
596 template <class... TArgs> | 596 template <class... TArgs> |
597 Node* CodeAssembler::TailCallBytecodeDispatch( | 597 Node* CodeAssembler::TailCallBytecodeDispatch( |
598 const CallInterfaceDescriptor& descriptor, Node* target, TArgs... args) { | 598 const CallInterfaceDescriptor& descriptor, Node* target, TArgs... args) { |
| 599 Comment("TailCallBytecodeDispatch"); |
599 DCHECK_EQ(descriptor.GetParameterCount(), sizeof...(args)); | 600 DCHECK_EQ(descriptor.GetParameterCount(), sizeof...(args)); |
600 CallDescriptor* desc = Linkage::GetBytecodeDispatchCallDescriptor( | 601 CallDescriptor* desc = Linkage::GetBytecodeDispatchCallDescriptor( |
601 isolate(), zone(), descriptor, descriptor.GetStackParameterCount()); | 602 isolate(), zone(), descriptor, descriptor.GetStackParameterCount()); |
602 | 603 |
603 Node* nodes[] = {target, args...}; | 604 Node* nodes[] = {target, args...}; |
| 605 Comment("TAIL"); |
604 return raw_assembler()->TailCallN(desc, arraysize(nodes), nodes); | 606 return raw_assembler()->TailCallN(desc, arraysize(nodes), nodes); |
605 } | 607 } |
606 | 608 |
607 // Instantiate TailCallBytecodeDispatch() with 4 arguments. | 609 // Instantiate TailCallBytecodeDispatch() with 4 arguments. |
608 template V8_EXPORT_PRIVATE Node* CodeAssembler::TailCallBytecodeDispatch( | 610 template V8_EXPORT_PRIVATE Node* CodeAssembler::TailCallBytecodeDispatch( |
609 const CallInterfaceDescriptor& descriptor, Node* target, Node*, Node*, | 611 const CallInterfaceDescriptor& descriptor, Node* target, Node*, Node*, |
610 Node*, Node*); | 612 Node*, Node*); |
611 | 613 |
612 Node* CodeAssembler::CallCFunctionN(Signature<MachineType>* signature, | 614 Node* CodeAssembler::CallCFunctionN(Signature<MachineType>* signature, |
613 int input_count, Node* const* inputs) { | 615 int input_count, Node* const* inputs) { |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 } | 842 } |
841 } | 843 } |
842 } | 844 } |
843 | 845 |
844 bound_ = true; | 846 bound_ = true; |
845 } | 847 } |
846 | 848 |
847 } // namespace compiler | 849 } // namespace compiler |
848 } // namespace internal | 850 } // namespace internal |
849 } // namespace v8 | 851 } // namespace v8 |
OLD | NEW |