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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 RawMachineAssembler(Isolate* isolate, Graph* graph, | 50 RawMachineAssembler(Isolate* isolate, Graph* graph, |
51 CallDescriptor* call_descriptor, | 51 CallDescriptor* call_descriptor, |
52 MachineType word = kMachPtr, | 52 MachineType word = kMachPtr, |
53 MachineOperatorBuilder::Flags flags = | 53 MachineOperatorBuilder::Flags flags = |
54 MachineOperatorBuilder::Flag::kNoFlags); | 54 MachineOperatorBuilder::Flag::kNoFlags); |
55 ~RawMachineAssembler() {} | 55 ~RawMachineAssembler() {} |
56 | 56 |
57 Isolate* isolate() const { return isolate_; } | 57 Isolate* isolate() const { return isolate_; } |
58 Graph* graph() const { return graph_; } | 58 Graph* graph() const { return graph_; } |
59 Schedule* schedule() { return schedule_; } | |
60 Zone* zone() const { return graph()->zone(); } | 59 Zone* zone() const { return graph()->zone(); } |
61 MachineOperatorBuilder* machine() { return &machine_; } | 60 MachineOperatorBuilder* machine() { return &machine_; } |
62 CommonOperatorBuilder* common() { return &common_; } | 61 CommonOperatorBuilder* common() { return &common_; } |
63 CallDescriptor* call_descriptor() const { return call_descriptor_; } | 62 CallDescriptor* call_descriptor() const { return call_descriptor_; } |
64 size_t parameter_count() const { return machine_sig()->parameter_count(); } | |
65 const MachineSignature* machine_sig() const { | |
66 return call_descriptor_->GetMachineSignature(); | |
67 } | |
68 | 63 |
69 // Finalizes the schedule and exports it to be used for code generation. Note | 64 // Finalizes the schedule and exports it to be used for code generation. Note |
70 // that this RawMachineAssembler becomes invalid after export. | 65 // that this RawMachineAssembler becomes invalid after export. |
71 Schedule* Export(); | 66 Schedule* Export(); |
72 | 67 |
73 // =========================================================================== | 68 // =========================================================================== |
74 // The following utility methods create new nodes with specific operators and | 69 // The following utility methods create new nodes with specific operators and |
75 // place them into the current basic block. They don't perform control flow, | 70 // place them into the current basic block. They don't perform control flow, |
76 // hence will not switch the current basic block. | 71 // hence will not switch the current basic block. |
77 | 72 |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 Node* buffer[] = {n1, args...}; | 606 Node* buffer[] = {n1, args...}; |
612 return AddNode(op, sizeof...(args) + 1, buffer); | 607 return AddNode(op, sizeof...(args) + 1, buffer); |
613 } | 608 } |
614 | 609 |
615 private: | 610 private: |
616 Node* MakeNode(const Operator* op, int input_count, Node** inputs); | 611 Node* MakeNode(const Operator* op, int input_count, Node** inputs); |
617 BasicBlock* Use(Label* label); | 612 BasicBlock* Use(Label* label); |
618 BasicBlock* EnsureBlock(Label* label); | 613 BasicBlock* EnsureBlock(Label* label); |
619 BasicBlock* CurrentBlock(); | 614 BasicBlock* CurrentBlock(); |
620 | 615 |
| 616 Schedule* schedule() { return schedule_; } |
| 617 size_t parameter_count() const { return machine_sig()->parameter_count(); } |
| 618 const MachineSignature* machine_sig() const { |
| 619 return call_descriptor_->GetMachineSignature(); |
| 620 } |
| 621 |
621 Isolate* isolate_; | 622 Isolate* isolate_; |
622 Graph* graph_; | 623 Graph* graph_; |
623 Schedule* schedule_; | 624 Schedule* schedule_; |
624 MachineOperatorBuilder machine_; | 625 MachineOperatorBuilder machine_; |
625 CommonOperatorBuilder common_; | 626 CommonOperatorBuilder common_; |
626 CallDescriptor* call_descriptor_; | 627 CallDescriptor* call_descriptor_; |
627 NodeVector parameters_; | 628 NodeVector parameters_; |
628 BasicBlock* current_block_; | 629 BasicBlock* current_block_; |
629 | 630 |
630 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); | 631 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); |
631 }; | 632 }; |
632 | 633 |
633 } // namespace compiler | 634 } // namespace compiler |
634 } // namespace internal | 635 } // namespace internal |
635 } // namespace v8 | 636 } // namespace v8 |
636 | 637 |
637 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 638 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
OLD | NEW |