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/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 explicit Label(BasicBlock* block) | 38 explicit Label(BasicBlock* block) |
39 : block_(block), used_(false), bound_(false) {} | 39 : block_(block), used_(false), bound_(false) {} |
40 | 40 |
41 BasicBlock* block_; | 41 BasicBlock* block_; |
42 bool used_; | 42 bool used_; |
43 bool bound_; | 43 bool bound_; |
44 friend class RawMachineAssembler; | 44 friend class RawMachineAssembler; |
45 DISALLOW_COPY_AND_ASSIGN(Label); | 45 DISALLOW_COPY_AND_ASSIGN(Label); |
46 }; | 46 }; |
47 | 47 |
48 RawMachineAssembler( | 48 RawMachineAssembler(Graph* graph, |
49 Graph* graph, MachineCallDescriptorBuilder* call_descriptor_builder, | 49 MachineCallDescriptorBuilder* call_descriptor_builder, |
50 MachineRepresentation word = MachineOperatorBuilder::pointer_rep()); | 50 MachineType word = MachineOperatorBuilder::pointer_rep()); |
51 virtual ~RawMachineAssembler() {} | 51 virtual ~RawMachineAssembler() {} |
52 | 52 |
53 Isolate* isolate() const { return zone()->isolate(); } | 53 Isolate* isolate() const { return zone()->isolate(); } |
54 Zone* zone() const { return graph()->zone(); } | 54 Zone* zone() const { return graph()->zone(); } |
55 MachineOperatorBuilder* machine() { return &machine_; } | 55 MachineOperatorBuilder* machine() { return &machine_; } |
56 CommonOperatorBuilder* common() { return &common_; } | 56 CommonOperatorBuilder* common() { return &common_; } |
57 CallDescriptor* call_descriptor() const { | 57 CallDescriptor* call_descriptor() const { |
58 return call_descriptor_builder_->BuildCallDescriptor(zone()); | 58 return call_descriptor_builder_->BuildCallDescriptor(zone()); |
59 } | 59 } |
60 int parameter_count() const { | 60 int parameter_count() const { |
61 return call_descriptor_builder_->parameter_count(); | 61 return call_descriptor_builder_->parameter_count(); |
62 } | 62 } |
63 const MachineRepresentation* parameter_types() const { | 63 const MachineType* parameter_types() const { |
64 return call_descriptor_builder_->parameter_types(); | 64 return call_descriptor_builder_->parameter_types(); |
65 } | 65 } |
66 | 66 |
67 // Parameters. | 67 // Parameters. |
68 Node* Parameter(int index); | 68 Node* Parameter(int index); |
69 | 69 |
70 // Control flow. | 70 // Control flow. |
71 Label* Exit(); | 71 Label* Exit(); |
72 void Goto(Label* label); | 72 void Goto(Label* label); |
73 void Branch(Node* condition, Label* true_val, Label* false_val); | 73 void Branch(Node* condition, Label* true_val, Label* false_val); |
(...skipping 27 matching lines...) Expand all Loading... |
101 return schedule_; | 101 return schedule_; |
102 } | 102 } |
103 | 103 |
104 private: | 104 private: |
105 bool ScheduleValid() { return schedule_ != NULL; } | 105 bool ScheduleValid() { return schedule_ != NULL; } |
106 | 106 |
107 BasicBlock* Use(Label* label); | 107 BasicBlock* Use(Label* label); |
108 BasicBlock* EnsureBlock(Label* label); | 108 BasicBlock* EnsureBlock(Label* label); |
109 BasicBlock* CurrentBlock(); | 109 BasicBlock* CurrentBlock(); |
110 | 110 |
111 typedef std::vector<MachineRepresentation, | 111 typedef std::vector<MachineType, zone_allocator<MachineType> > |
112 zone_allocator<MachineRepresentation> > | |
113 RepresentationVector; | 112 RepresentationVector; |
114 | 113 |
115 Schedule* schedule_; | 114 Schedule* schedule_; |
116 MachineOperatorBuilder machine_; | 115 MachineOperatorBuilder machine_; |
117 CommonOperatorBuilder common_; | 116 CommonOperatorBuilder common_; |
118 MachineCallDescriptorBuilder* call_descriptor_builder_; | 117 MachineCallDescriptorBuilder* call_descriptor_builder_; |
119 Node** parameters_; | 118 Node** parameters_; |
120 Label exit_label_; | 119 Label exit_label_; |
121 BasicBlock* current_block_; | 120 BasicBlock* current_block_; |
122 | 121 |
123 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); | 122 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); |
124 }; | 123 }; |
125 | 124 |
126 } // namespace compiler | 125 } // namespace compiler |
127 } // namespace internal | 126 } // namespace internal |
128 } // namespace v8 | 127 } // namespace v8 |
129 | 128 |
130 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 129 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
OLD | NEW |