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/bytecode-branch-analysis.h" | 8 #include "src/compiler/bytecode-branch-analysis.h" |
9 #include "src/compiler/bytecode-loop-analysis.h" | 9 #include "src/compiler/bytecode-loop-analysis.h" |
10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 | 198 |
199 // Builds loop exit nodes for every exited loop between the current bytecode | 199 // Builds loop exit nodes for every exited loop between the current bytecode |
200 // offset and {target_offset}. | 200 // offset and {target_offset}. |
201 void BuildLoopExitsForBranch(int target_offset); | 201 void BuildLoopExitsForBranch(int target_offset); |
202 void BuildLoopExitsForFunctionExit(); | 202 void BuildLoopExitsForFunctionExit(); |
203 void BuildLoopExitsUntilLoop(int loop_offset); | 203 void BuildLoopExitsUntilLoop(int loop_offset); |
204 | 204 |
205 // Simulates entry and exit of exception handlers. | 205 // Simulates entry and exit of exception handlers. |
206 void EnterAndExitExceptionHandlers(int current_offset); | 206 void EnterAndExitExceptionHandlers(int current_offset); |
207 | 207 |
208 // Update [source_positions_]'s current position to that of the bytecode at | |
209 // [offset], if any. | |
Jarin
2016/10/31 14:59:39
Nit: above we seem to be using "{offset}" to refer
| |
210 void UpdateCurrentSourcePosition(SourcePositionTableIterator* it, int offset); | |
211 | |
208 // Growth increment for the temporary buffer used to construct input lists to | 212 // Growth increment for the temporary buffer used to construct input lists to |
209 // new nodes. | 213 // new nodes. |
210 static const int kInputBufferSizeIncrement = 64; | 214 static const int kInputBufferSizeIncrement = 64; |
211 | 215 |
212 // An abstract representation for an exception handler that is being | 216 // An abstract representation for an exception handler that is being |
213 // entered and exited while the graph builder is iterating over the | 217 // entered and exited while the graph builder is iterating over the |
214 // underlying bytecode. The exception handlers within the bytecode are | 218 // underlying bytecode. The exception handlers within the bytecode are |
215 // well scoped, hence will form a stack during iteration. | 219 // well scoped, hence will form a stack during iteration. |
216 struct ExceptionHandler { | 220 struct ExceptionHandler { |
217 int start_offset_; // Start offset of the handled area in the bytecode. | 221 int start_offset_; // Start offset of the handled area in the bytecode. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
278 float const invocation_frequency_; | 282 float const invocation_frequency_; |
279 Handle<BytecodeArray> bytecode_array_; | 283 Handle<BytecodeArray> bytecode_array_; |
280 Handle<HandlerTable> exception_handler_table_; | 284 Handle<HandlerTable> exception_handler_table_; |
281 Handle<TypeFeedbackVector> feedback_vector_; | 285 Handle<TypeFeedbackVector> feedback_vector_; |
282 const FrameStateFunctionInfo* frame_state_function_info_; | 286 const FrameStateFunctionInfo* frame_state_function_info_; |
283 const interpreter::BytecodeArrayIterator* bytecode_iterator_; | 287 const interpreter::BytecodeArrayIterator* bytecode_iterator_; |
284 const BytecodeBranchAnalysis* branch_analysis_; | 288 const BytecodeBranchAnalysis* branch_analysis_; |
285 const BytecodeLoopAnalysis* loop_analysis_; | 289 const BytecodeLoopAnalysis* loop_analysis_; |
286 Environment* environment_; | 290 Environment* environment_; |
287 BailoutId osr_ast_id_; | 291 BailoutId osr_ast_id_; |
292 int osr_loop_offset_; | |
288 | 293 |
289 // Merge environments are snapshots of the environment at points where the | 294 // Merge environments are snapshots of the environment at points where the |
290 // control flow merges. This models a forward data flow propagation of all | 295 // control flow merges. This models a forward data flow propagation of all |
291 // values from all predecessors of the merge in question. | 296 // values from all predecessors of the merge in question. |
292 ZoneMap<int, Environment*> merge_environments_; | 297 ZoneMap<int, Environment*> merge_environments_; |
293 | 298 |
294 // Exception handlers currently entered by the iteration. | 299 // Exception handlers currently entered by the iteration. |
295 ZoneStack<ExceptionHandler> exception_handlers_; | 300 ZoneStack<ExceptionHandler> exception_handlers_; |
296 int current_exception_handler_; | 301 int current_exception_handler_; |
297 | 302 |
298 // Temporary storage for building node input lists. | 303 // Temporary storage for building node input lists. |
299 int input_buffer_size_; | 304 int input_buffer_size_; |
300 Node** input_buffer_; | 305 Node** input_buffer_; |
301 | 306 |
302 // Nodes representing values in the activation record. | 307 // Nodes representing values in the activation record. |
303 SetOncePointer<Node> function_context_; | 308 SetOncePointer<Node> function_context_; |
304 SetOncePointer<Node> function_closure_; | 309 SetOncePointer<Node> function_closure_; |
305 SetOncePointer<Node> new_target_; | 310 SetOncePointer<Node> new_target_; |
306 | 311 |
307 // Control nodes that exit the function body. | 312 // Control nodes that exit the function body. |
308 ZoneVector<Node*> exit_controls_; | 313 ZoneVector<Node*> exit_controls_; |
309 | 314 |
310 bool const is_liveness_analysis_enabled_; | 315 bool const is_liveness_analysis_enabled_; |
311 | 316 |
312 StateValuesCache state_values_cache_; | 317 StateValuesCache state_values_cache_; |
313 | 318 |
314 // Analyzer of register liveness. | 319 // Analyzer of register liveness. |
315 LivenessAnalyzer liveness_analyzer_; | 320 LivenessAnalyzer liveness_analyzer_; |
316 | 321 |
317 // The Turbofan source position table, to be populated. | 322 // The source position table, to be populated. |
318 SourcePositionTable* source_positions_; | 323 SourcePositionTable* source_positions_; |
319 | 324 |
320 // Update [source_positions_]'s current position to that of the bytecode at | |
321 // [offset], if any. | |
322 void UpdateCurrentSourcePosition(SourcePositionTableIterator* it, int offset); | |
323 | |
324 static int const kBinaryOperationHintIndex = 1; | 325 static int const kBinaryOperationHintIndex = 1; |
325 static int const kCountOperationHintIndex = 0; | 326 static int const kCountOperationHintIndex = 0; |
326 static int const kBinaryOperationSmiHintIndex = 2; | 327 static int const kBinaryOperationSmiHintIndex = 2; |
327 | 328 |
328 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder); | 329 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder); |
329 }; | 330 }; |
330 | 331 |
331 } // namespace compiler | 332 } // namespace compiler |
332 } // namespace internal | 333 } // namespace internal |
333 } // namespace v8 | 334 } // namespace v8 |
334 | 335 |
335 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ | 336 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ |
OLD | NEW |