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