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_STRUCTURED_MACHINE_ASSEMBLER_H_ | 5 #ifndef V8_COMPILER_STRUCTURED_MACHINE_ASSEMBLER_H_ |
6 #define V8_COMPILER_STRUCTURED_MACHINE_ASSEMBLER_H_ | 6 #define V8_COMPILER_STRUCTURED_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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 virtual Node* MakeNode(Operator* op, int input_count, Node** inputs); | 94 virtual Node* MakeNode(Operator* op, int input_count, Node** inputs); |
95 | 95 |
96 Schedule* schedule() { | 96 Schedule* schedule() { |
97 DCHECK(ScheduleValid()); | 97 DCHECK(ScheduleValid()); |
98 return schedule_; | 98 return schedule_; |
99 } | 99 } |
100 | 100 |
101 private: | 101 private: |
102 bool ScheduleValid() { return schedule_ != NULL; } | 102 bool ScheduleValid() { return schedule_ != NULL; } |
103 | 103 |
104 typedef std::vector<Environment*, zone_allocator<Environment*> > | 104 typedef ZoneVector<Environment*> EnvironmentVector; |
105 EnvironmentVector; | |
106 | 105 |
107 NodeVector* CurrentVars() { return ¤t_environment_->variables_; } | 106 NodeVector* CurrentVars() { return ¤t_environment_->variables_; } |
108 Node*& VariableAt(Environment* environment, int offset); | 107 Node*& VariableAt(Environment* environment, int offset); |
109 Node* GetVariable(int offset); | 108 Node* GetVariable(int offset); |
110 void SetVariable(int offset, Node* value); | 109 void SetVariable(int offset, Node* value); |
111 | 110 |
112 void AddBranch(Environment* environment, Node* condition, | 111 void AddBranch(Environment* environment, Node* condition, |
113 Environment* true_val, Environment* false_val); | 112 Environment* true_val, Environment* false_val); |
114 void AddGoto(Environment* from, Environment* to); | 113 void AddGoto(Environment* from, Environment* to); |
115 BasicBlock* TrampolineFor(BasicBlock* block); | 114 BasicBlock* TrampolineFor(BasicBlock* block); |
116 | 115 |
117 void CopyCurrentAsDead(); | 116 void CopyCurrentAsDead(); |
118 Environment* Copy(Environment* environment) { | 117 Environment* Copy(Environment* environment) { |
119 return Copy(environment, static_cast<int>(environment->variables_.size())); | 118 return Copy(environment, static_cast<int>(environment->variables_.size())); |
120 } | 119 } |
121 Environment* Copy(Environment* environment, int truncate_at); | 120 Environment* Copy(Environment* environment, int truncate_at); |
122 void Merge(EnvironmentVector* environments, int truncate_at); | 121 void Merge(EnvironmentVector* environments, int truncate_at); |
123 Environment* CopyForLoopHeader(Environment* environment); | 122 Environment* CopyForLoopHeader(Environment* environment); |
124 void MergeBackEdgesToLoopHeader(Environment* header, | 123 void MergeBackEdgesToLoopHeader(Environment* header, |
125 EnvironmentVector* environments); | 124 EnvironmentVector* environments); |
126 | 125 |
127 typedef std::vector<MachineType, zone_allocator<MachineType> > | |
128 RepresentationVector; | |
129 | |
130 Schedule* schedule_; | 126 Schedule* schedule_; |
131 MachineOperatorBuilder machine_; | 127 MachineOperatorBuilder machine_; |
132 CommonOperatorBuilder common_; | 128 CommonOperatorBuilder common_; |
133 MachineCallDescriptorBuilder* call_descriptor_builder_; | 129 MachineCallDescriptorBuilder* call_descriptor_builder_; |
134 Node** parameters_; | 130 Node** parameters_; |
135 Environment* current_environment_; | 131 Environment* current_environment_; |
136 int number_of_variables_; | 132 int number_of_variables_; |
137 | 133 |
138 friend class Variable; | 134 friend class Variable; |
139 // For testing only. | 135 // For testing only. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // next_ is the next link in the UnresolvedBranch chain, and will be | 203 // next_ is the next link in the UnresolvedBranch chain, and will be |
208 // either the true or false branch jumped to from environment_. | 204 // either the true or false branch jumped to from environment_. |
209 UnresolvedBranch* next_; | 205 UnresolvedBranch* next_; |
210 }; | 206 }; |
211 | 207 |
212 struct ExpressionState { | 208 struct ExpressionState { |
213 int pending_then_size_; | 209 int pending_then_size_; |
214 int pending_else_size_; | 210 int pending_else_size_; |
215 }; | 211 }; |
216 | 212 |
217 typedef std::vector<ExpressionState, zone_allocator<ExpressionState> > | 213 typedef ZoneVector<ExpressionState> ExpressionStates; |
218 ExpressionStates; | 214 typedef ZoneVector<UnresolvedBranch*> PendingMergeStack; |
219 typedef std::vector<UnresolvedBranch*, zone_allocator<UnresolvedBranch*> > | |
220 PendingMergeStack; | |
221 struct IfClause; | 215 struct IfClause; |
222 typedef std::vector<IfClause*, zone_allocator<IfClause*> > IfClauses; | 216 typedef ZoneVector<IfClause*> IfClauses; |
223 | 217 |
224 struct PendingMergeStackRange { | 218 struct PendingMergeStackRange { |
225 PendingMergeStack* merge_stack_; | 219 PendingMergeStack* merge_stack_; |
226 int start_; | 220 int start_; |
227 int size_; | 221 int size_; |
228 }; | 222 }; |
229 | 223 |
230 enum CombineType { kCombineThen, kCombineElse }; | 224 enum CombineType { kCombineThen, kCombineElse }; |
231 enum ResolutionType { kExpressionTerm, kExpressionDone }; | 225 enum ResolutionType { kExpressionTerm, kExpressionDone }; |
232 | 226 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 EnvironmentVector pending_header_merges_; | 296 EnvironmentVector pending_header_merges_; |
303 EnvironmentVector pending_exit_merges_; | 297 EnvironmentVector pending_exit_merges_; |
304 DISALLOW_COPY_AND_ASSIGN(LoopBuilder); | 298 DISALLOW_COPY_AND_ASSIGN(LoopBuilder); |
305 }; | 299 }; |
306 | 300 |
307 } // namespace compiler | 301 } // namespace compiler |
308 } // namespace internal | 302 } // namespace internal |
309 } // namespace v8 | 303 } // namespace v8 |
310 | 304 |
311 #endif // V8_COMPILER_STRUCTURED_MACHINE_ASSEMBLER_H_ | 305 #endif // V8_COMPILER_STRUCTURED_MACHINE_ASSEMBLER_H_ |
OLD | NEW |