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 18 matching lines...) Expand all Loading... |
29 // | 29 // |
30 // In order to create a schedule on-the-fly, the assembler keeps track of basic | 30 // In order to create a schedule on-the-fly, the assembler keeps track of basic |
31 // blocks by having one current basic block being populated and by referencing | 31 // blocks by having one current basic block being populated and by referencing |
32 // other basic blocks through the use of labels. | 32 // other basic blocks through the use of labels. |
33 // | 33 // |
34 // Also note that the generated graph is only valid together with the generated | 34 // Also note that the generated graph is only valid together with the generated |
35 // schedule, using one without the other is invalid as the graph is inherently | 35 // schedule, using one without the other is invalid as the graph is inherently |
36 // non-schedulable due to missing control and effect dependencies. | 36 // non-schedulable due to missing control and effect dependencies. |
37 class RawMachineAssembler { | 37 class RawMachineAssembler { |
38 public: | 38 public: |
39 RawMachineAssembler(Isolate* isolate, Graph* graph, | 39 RawMachineAssembler( |
40 CallDescriptor* call_descriptor, | 40 Isolate* isolate, Graph* graph, CallDescriptor* call_descriptor, |
41 MachineType word = kMachPtr, | 41 MachineRepresentation word = MachineType::PointerRepresentation(), |
42 MachineOperatorBuilder::Flags flags = | 42 MachineOperatorBuilder::Flags flags = |
43 MachineOperatorBuilder::Flag::kNoFlags); | 43 MachineOperatorBuilder::Flag::kNoFlags); |
44 ~RawMachineAssembler() {} | 44 ~RawMachineAssembler() {} |
45 | 45 |
46 Isolate* isolate() const { return isolate_; } | 46 Isolate* isolate() const { return isolate_; } |
47 Graph* graph() const { return graph_; } | 47 Graph* graph() const { return graph_; } |
48 Zone* zone() const { return graph()->zone(); } | 48 Zone* zone() const { return graph()->zone(); } |
49 MachineOperatorBuilder* machine() { return &machine_; } | 49 MachineOperatorBuilder* machine() { return &machine_; } |
50 CommonOperatorBuilder* common() { return &common_; } | 50 CommonOperatorBuilder* common() { return &common_; } |
51 CallDescriptor* call_descriptor() const { return call_descriptor_; } | 51 CallDescriptor* call_descriptor() const { return call_descriptor_; } |
52 | 52 |
53 // Finalizes the schedule and exports it to be used for code generation. Note | 53 // Finalizes the schedule and exports it to be used for code generation. Note |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 RawMachineLabel* false_val); | 604 RawMachineLabel* false_val); |
605 void Switch(Node* index, RawMachineLabel* default_label, int32_t* case_values, | 605 void Switch(Node* index, RawMachineLabel* default_label, int32_t* case_values, |
606 RawMachineLabel** case_labels, size_t case_count); | 606 RawMachineLabel** case_labels, size_t case_count); |
607 void Return(Node* value); | 607 void Return(Node* value); |
608 void Return(Node* v1, Node* v2); | 608 void Return(Node* v1, Node* v2); |
609 void Return(Node* v1, Node* v2, Node* v3); | 609 void Return(Node* v1, Node* v2, Node* v3); |
610 void Bind(RawMachineLabel* label); | 610 void Bind(RawMachineLabel* label); |
611 void Deoptimize(Node* state); | 611 void Deoptimize(Node* state); |
612 | 612 |
613 // Variables. | 613 // Variables. |
614 Node* Phi(MachineType type, Node* n1, Node* n2) { | 614 Node* Phi(MachineRepresentation rep, Node* n1, Node* n2) { |
615 return AddNode(common()->Phi(type, 2), n1, n2); | 615 return AddNode(common()->Phi(rep, 2), n1, n2); |
616 } | 616 } |
617 Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3) { | 617 Node* Phi(MachineRepresentation rep, Node* n1, Node* n2, Node* n3) { |
618 return AddNode(common()->Phi(type, 3), n1, n2, n3); | 618 return AddNode(common()->Phi(rep, 3), n1, n2, n3); |
619 } | 619 } |
620 Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3, Node* n4) { | 620 Node* Phi(MachineRepresentation rep, Node* n1, Node* n2, Node* n3, Node* n4) { |
621 return AddNode(common()->Phi(type, 4), n1, n2, n3, n4); | 621 return AddNode(common()->Phi(rep, 4), n1, n2, n3, n4); |
622 } | 622 } |
623 | 623 |
624 // =========================================================================== | 624 // =========================================================================== |
625 // The following generic node creation methods can be used for operators that | 625 // The following generic node creation methods can be used for operators that |
626 // are not covered by the above utility methods. There should rarely be a need | 626 // are not covered by the above utility methods. There should rarely be a need |
627 // to do that outside of testing though. | 627 // to do that outside of testing though. |
628 | 628 |
629 Node* AddNode(const Operator* op, int input_count, Node** inputs); | 629 Node* AddNode(const Operator* op, int input_count, Node** inputs); |
630 | 630 |
631 Node* AddNode(const Operator* op) { | 631 Node* AddNode(const Operator* op) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 bool bound_; | 674 bool bound_; |
675 friend class RawMachineAssembler; | 675 friend class RawMachineAssembler; |
676 DISALLOW_COPY_AND_ASSIGN(RawMachineLabel); | 676 DISALLOW_COPY_AND_ASSIGN(RawMachineLabel); |
677 }; | 677 }; |
678 | 678 |
679 } // namespace compiler | 679 } // namespace compiler |
680 } // namespace internal | 680 } // namespace internal |
681 } // namespace v8 | 681 } // namespace v8 |
682 | 682 |
683 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 683 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
OLD | NEW |