OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_BYTECODE_GRAPH_BUILDER_H_ | 5 #ifndef V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ |
6 #define V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ | 6 #define V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ |
7 | 7 |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/compiler/bytecode-branch-analysis.h" | 9 #include "src/compiler/bytecode-branch-analysis.h" |
10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 int end_offset_; // End offset of the handled area in the bytecode. | 170 int end_offset_; // End offset of the handled area in the bytecode. |
171 int handler_offset_; // Handler entry offset within the bytecode. | 171 int handler_offset_; // Handler entry offset within the bytecode. |
172 int context_register_; // Index of register holding handler context. | 172 int context_register_; // Index of register holding handler context. |
173 CatchPrediction pred_; // Prediction of whether handler is catching. | 173 CatchPrediction pred_; // Prediction of whether handler is catching. |
174 }; | 174 }; |
175 | 175 |
176 // Field accessors | 176 // Field accessors |
177 Graph* graph() const { return jsgraph_->graph(); } | 177 Graph* graph() const { return jsgraph_->graph(); } |
178 CommonOperatorBuilder* common() const { return jsgraph_->common(); } | 178 CommonOperatorBuilder* common() const { return jsgraph_->common(); } |
179 Zone* graph_zone() const { return graph()->zone(); } | 179 Zone* graph_zone() const { return graph()->zone(); } |
180 CompilationInfo* info() const { return info_; } | |
181 JSGraph* jsgraph() const { return jsgraph_; } | 180 JSGraph* jsgraph() const { return jsgraph_; } |
182 JSOperatorBuilder* javascript() const { return jsgraph_->javascript(); } | 181 JSOperatorBuilder* javascript() const { return jsgraph_->javascript(); } |
183 Zone* local_zone() const { return local_zone_; } | 182 Zone* local_zone() const { return local_zone_; } |
184 const Handle<BytecodeArray>& bytecode_array() const { | 183 const Handle<BytecodeArray>& bytecode_array() const { |
185 return bytecode_array_; | 184 return bytecode_array_; |
186 } | 185 } |
187 const Handle<HandlerTable>& exception_handler_table() const { | 186 const Handle<HandlerTable>& exception_handler_table() const { |
188 return exception_handler_table_; | 187 return exception_handler_table_; |
189 } | 188 } |
| 189 const Handle<TypeFeedbackVector>& feedback_vector() const { |
| 190 return feedback_vector_; |
| 191 } |
190 const FrameStateFunctionInfo* frame_state_function_info() const { | 192 const FrameStateFunctionInfo* frame_state_function_info() const { |
191 return frame_state_function_info_; | 193 return frame_state_function_info_; |
192 } | 194 } |
193 | 195 |
194 LanguageMode language_mode() const { | |
195 // TODO(mythria): Don't rely on parse information to get language mode. | |
196 return info()->language_mode(); | |
197 } | |
198 | |
199 const interpreter::BytecodeArrayIterator& bytecode_iterator() const { | 196 const interpreter::BytecodeArrayIterator& bytecode_iterator() const { |
200 return *bytecode_iterator_; | 197 return *bytecode_iterator_; |
201 } | 198 } |
202 | 199 |
203 void set_bytecode_iterator( | 200 void set_bytecode_iterator( |
204 const interpreter::BytecodeArrayIterator* bytecode_iterator) { | 201 const interpreter::BytecodeArrayIterator* bytecode_iterator) { |
205 bytecode_iterator_ = bytecode_iterator; | 202 bytecode_iterator_ = bytecode_iterator; |
206 } | 203 } |
207 | 204 |
208 const BytecodeBranchAnalysis* branch_analysis() const { | 205 const BytecodeBranchAnalysis* branch_analysis() const { |
209 return branch_analysis_; | 206 return branch_analysis_; |
210 } | 207 } |
211 | 208 |
212 void set_branch_analysis(const BytecodeBranchAnalysis* branch_analysis) { | 209 void set_branch_analysis(const BytecodeBranchAnalysis* branch_analysis) { |
213 branch_analysis_ = branch_analysis; | 210 branch_analysis_ = branch_analysis; |
214 } | 211 } |
215 | 212 |
216 #define DECLARE_VISIT_BYTECODE(name, ...) void Visit##name(); | 213 #define DECLARE_VISIT_BYTECODE(name, ...) void Visit##name(); |
217 BYTECODE_LIST(DECLARE_VISIT_BYTECODE) | 214 BYTECODE_LIST(DECLARE_VISIT_BYTECODE) |
218 #undef DECLARE_VISIT_BYTECODE | 215 #undef DECLARE_VISIT_BYTECODE |
219 | 216 |
220 Zone* local_zone_; | 217 Zone* local_zone_; |
221 CompilationInfo* info_; | |
222 JSGraph* jsgraph_; | 218 JSGraph* jsgraph_; |
223 Handle<BytecodeArray> bytecode_array_; | 219 Handle<BytecodeArray> bytecode_array_; |
224 Handle<HandlerTable> exception_handler_table_; | 220 Handle<HandlerTable> exception_handler_table_; |
| 221 Handle<TypeFeedbackVector> feedback_vector_; |
225 const FrameStateFunctionInfo* frame_state_function_info_; | 222 const FrameStateFunctionInfo* frame_state_function_info_; |
226 const interpreter::BytecodeArrayIterator* bytecode_iterator_; | 223 const interpreter::BytecodeArrayIterator* bytecode_iterator_; |
227 const BytecodeBranchAnalysis* branch_analysis_; | 224 const BytecodeBranchAnalysis* branch_analysis_; |
228 Environment* environment_; | 225 Environment* environment_; |
229 | 226 |
| 227 // Indicates whether deoptimization support is enabled for this compilation |
| 228 // and whether valid frame states need to be attached to deoptimizing nodes. |
| 229 bool deoptimization_enabled_; |
| 230 |
230 // Merge environments are snapshots of the environment at points where the | 231 // Merge environments are snapshots of the environment at points where the |
231 // control flow merges. This models a forward data flow propagation of all | 232 // control flow merges. This models a forward data flow propagation of all |
232 // values from all predecessors of the merge in question. | 233 // values from all predecessors of the merge in question. |
233 ZoneMap<int, Environment*> merge_environments_; | 234 ZoneMap<int, Environment*> merge_environments_; |
234 | 235 |
235 // Exception handlers currently entered by the iteration. | 236 // Exception handlers currently entered by the iteration. |
236 ZoneStack<ExceptionHandler> exception_handlers_; | 237 ZoneStack<ExceptionHandler> exception_handlers_; |
237 int current_exception_handler_; | 238 int current_exception_handler_; |
238 | 239 |
239 // Temporary storage for building node input lists. | 240 // Temporary storage for building node input lists. |
240 int input_buffer_size_; | 241 int input_buffer_size_; |
241 Node** input_buffer_; | 242 Node** input_buffer_; |
242 | 243 |
243 // Nodes representing values in the activation record. | 244 // Nodes representing values in the activation record. |
244 SetOncePointer<Node> function_context_; | 245 SetOncePointer<Node> function_context_; |
245 SetOncePointer<Node> function_closure_; | 246 SetOncePointer<Node> function_closure_; |
246 SetOncePointer<Node> new_target_; | 247 SetOncePointer<Node> new_target_; |
247 | 248 |
248 // Optimization to cache loaded feedback vector. | |
249 SetOncePointer<Node> feedback_vector_; | |
250 | |
251 // Control nodes that exit the function body. | 249 // Control nodes that exit the function body. |
252 ZoneVector<Node*> exit_controls_; | 250 ZoneVector<Node*> exit_controls_; |
253 | 251 |
254 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder); | 252 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder); |
255 }; | 253 }; |
256 | 254 |
257 } // namespace compiler | 255 } // namespace compiler |
258 } // namespace internal | 256 } // namespace internal |
259 } // namespace v8 | 257 } // namespace v8 |
260 | 258 |
261 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ | 259 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ |
OLD | NEW |