| 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 #ifndef V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 5 #ifndef V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
| 6 #define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 6 #define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
| 7 | 7 |
| 8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
| 9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
| 10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 Node* arg5, Node* arg6, Node* arg7); | 591 Node* arg5, Node* arg6, Node* arg7); |
| 592 | 592 |
| 593 // Tail call the given call descriptor and the given arguments. | 593 // Tail call the given call descriptor and the given arguments. |
| 594 Node* TailCallN(CallDescriptor* call_descriptor, Node* function, Node** args); | 594 Node* TailCallN(CallDescriptor* call_descriptor, Node* function, Node** args); |
| 595 // Tail call to a runtime function with one argument. | 595 // Tail call to a runtime function with one argument. |
| 596 Node* TailCallRuntime1(Runtime::FunctionId function, Node* arg0, | 596 Node* TailCallRuntime1(Runtime::FunctionId function, Node* arg0, |
| 597 Node* context); | 597 Node* context); |
| 598 // Tail call to a runtime function with two arguments. | 598 // Tail call to a runtime function with two arguments. |
| 599 Node* TailCallRuntime2(Runtime::FunctionId function, Node* arg1, Node* arg2, | 599 Node* TailCallRuntime2(Runtime::FunctionId function, Node* arg1, Node* arg2, |
| 600 Node* context); | 600 Node* context); |
| 601 | 601 // Tail call to a runtime function with three arguments. |
| 602 Node* TailCallRuntime3(Runtime::FunctionId function, Node* arg1, Node* arg2, |
| 603 Node* arg3, Node* context); |
| 604 // Tail call to a runtime function with four arguments. |
| 605 Node* TailCallRuntime4(Runtime::FunctionId function, Node* arg1, Node* arg2, |
| 606 Node* arg3, Node* arg4, Node* context); |
| 602 | 607 |
| 603 // =========================================================================== | 608 // =========================================================================== |
| 604 // The following utility methods deal with control flow, hence might switch | 609 // The following utility methods deal with control flow, hence might switch |
| 605 // the current basic block or create new basic blocks for labels. | 610 // the current basic block or create new basic blocks for labels. |
| 606 | 611 |
| 607 // Control flow. | 612 // Control flow. |
| 608 void Goto(RawMachineLabel* label); | 613 void Goto(RawMachineLabel* label); |
| 609 void Branch(Node* condition, RawMachineLabel* true_val, | 614 void Branch(Node* condition, RawMachineLabel* true_val, |
| 610 RawMachineLabel* false_val); | 615 RawMachineLabel* false_val); |
| 611 void Switch(Node* index, RawMachineLabel* default_label, int32_t* case_values, | 616 void Switch(Node* index, RawMachineLabel* default_label, int32_t* case_values, |
| 612 RawMachineLabel** case_labels, size_t case_count); | 617 RawMachineLabel** case_labels, size_t case_count); |
| 613 void Return(Node* value); | 618 void Return(Node* value); |
| 614 void Return(Node* v1, Node* v2); | 619 void Return(Node* v1, Node* v2); |
| 615 void Return(Node* v1, Node* v2, Node* v3); | 620 void Return(Node* v1, Node* v2, Node* v3); |
| 616 void Bind(RawMachineLabel* label); | 621 void Bind(RawMachineLabel* label); |
| 617 void Deoptimize(Node* state); | 622 void Deoptimize(Node* state); |
| 618 | 623 |
| 619 // Variables. | 624 // Variables. |
| 620 Node* Phi(MachineRepresentation rep, Node* n1, Node* n2) { | 625 Node* Phi(MachineRepresentation rep, Node* n1, Node* n2) { |
| 621 return AddNode(common()->Phi(rep, 2), n1, n2); | 626 return AddNode(common()->Phi(rep, 2), n1, n2, graph()->start()); |
| 622 } | 627 } |
| 623 Node* Phi(MachineRepresentation rep, Node* n1, Node* n2, Node* n3) { | 628 Node* Phi(MachineRepresentation rep, Node* n1, Node* n2, Node* n3) { |
| 624 return AddNode(common()->Phi(rep, 3), n1, n2, n3); | 629 return AddNode(common()->Phi(rep, 3), n1, n2, n3, graph()->start()); |
| 625 } | 630 } |
| 626 Node* Phi(MachineRepresentation rep, Node* n1, Node* n2, Node* n3, Node* n4) { | 631 Node* Phi(MachineRepresentation rep, Node* n1, Node* n2, Node* n3, Node* n4) { |
| 627 return AddNode(common()->Phi(rep, 4), n1, n2, n3, n4); | 632 return AddNode(common()->Phi(rep, 4), n1, n2, n3, n4, graph()->start()); |
| 628 } | 633 } |
| 634 Node* Phi(MachineRepresentation rep, int input_count, Node* const* inputs); |
| 635 void AppendPhiInput(Node* phi, Node* new_input); |
| 629 | 636 |
| 630 // =========================================================================== | 637 // =========================================================================== |
| 631 // The following generic node creation methods can be used for operators that | 638 // The following generic node creation methods can be used for operators that |
| 632 // are not covered by the above utility methods. There should rarely be a need | 639 // are not covered by the above utility methods. There should rarely be a need |
| 633 // to do that outside of testing though. | 640 // to do that outside of testing though. |
| 634 | 641 |
| 635 Node* AddNode(const Operator* op, int input_count, Node** inputs); | 642 Node* AddNode(const Operator* op, int input_count, Node* const* inputs); |
| 636 | 643 |
| 637 Node* AddNode(const Operator* op) { | 644 Node* AddNode(const Operator* op) { |
| 638 return AddNode(op, 0, static_cast<Node**>(nullptr)); | 645 return AddNode(op, 0, static_cast<Node* const*>(nullptr)); |
| 639 } | 646 } |
| 640 | 647 |
| 641 template <class... TArgs> | 648 template <class... TArgs> |
| 642 Node* AddNode(const Operator* op, Node* n1, TArgs... args) { | 649 Node* AddNode(const Operator* op, Node* n1, TArgs... args) { |
| 643 Node* buffer[] = {n1, args...}; | 650 Node* buffer[] = {n1, args...}; |
| 644 return AddNode(op, sizeof...(args) + 1, buffer); | 651 return AddNode(op, sizeof...(args) + 1, buffer); |
| 645 } | 652 } |
| 646 | 653 |
| 647 private: | 654 private: |
| 648 Node* MakeNode(const Operator* op, int input_count, Node** inputs); | 655 Node* MakeNode(const Operator* op, int input_count, Node* const* inputs); |
| 649 BasicBlock* Use(RawMachineLabel* label); | 656 BasicBlock* Use(RawMachineLabel* label); |
| 650 BasicBlock* EnsureBlock(RawMachineLabel* label); | 657 BasicBlock* EnsureBlock(RawMachineLabel* label); |
| 651 BasicBlock* CurrentBlock(); | 658 BasicBlock* CurrentBlock(); |
| 652 | 659 |
| 653 Schedule* schedule() { return schedule_; } | 660 Schedule* schedule() { return schedule_; } |
| 654 size_t parameter_count() const { return machine_sig()->parameter_count(); } | 661 size_t parameter_count() const { return machine_sig()->parameter_count(); } |
| 655 const MachineSignature* machine_sig() const { | 662 const MachineSignature* machine_sig() const { |
| 656 return call_descriptor_->GetMachineSignature(); | 663 return call_descriptor_->GetMachineSignature(); |
| 657 } | 664 } |
| 658 | 665 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 680 bool bound_; | 687 bool bound_; |
| 681 friend class RawMachineAssembler; | 688 friend class RawMachineAssembler; |
| 682 DISALLOW_COPY_AND_ASSIGN(RawMachineLabel); | 689 DISALLOW_COPY_AND_ASSIGN(RawMachineLabel); |
| 683 }; | 690 }; |
| 684 | 691 |
| 685 } // namespace compiler | 692 } // namespace compiler |
| 686 } // namespace internal | 693 } // namespace internal |
| 687 } // namespace v8 | 694 } // namespace v8 |
| 688 | 695 |
| 689 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 696 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
| OLD | NEW |