| 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" |
| 11 #include "src/compiler/liveness-analyzer.h" | 11 #include "src/compiler/liveness-analyzer.h" |
| 12 #include "src/compiler/source-position.h" |
| 12 #include "src/compiler/state-values-utils.h" | 13 #include "src/compiler/state-values-utils.h" |
| 13 #include "src/compiler/type-hint-analyzer.h" | 14 #include "src/compiler/type-hint-analyzer.h" |
| 14 #include "src/interpreter/bytecode-array-iterator.h" | 15 #include "src/interpreter/bytecode-array-iterator.h" |
| 15 #include "src/interpreter/bytecode-flags.h" | 16 #include "src/interpreter/bytecode-flags.h" |
| 16 #include "src/interpreter/bytecodes.h" | 17 #include "src/interpreter/bytecodes.h" |
| 18 #include "src/source-position-table.h" |
| 17 | 19 |
| 18 namespace v8 { | 20 namespace v8 { |
| 19 namespace internal { | 21 namespace internal { |
| 20 | 22 |
| 21 class CompilationInfo; | 23 class CompilationInfo; |
| 22 | 24 |
| 23 namespace compiler { | 25 namespace compiler { |
| 24 | 26 |
| 25 // The BytecodeGraphBuilder produces a high-level IR graph based on | 27 // The BytecodeGraphBuilder produces a high-level IR graph based on |
| 26 // interpreter bytecodes. | 28 // interpreter bytecodes. |
| 27 class BytecodeGraphBuilder { | 29 class BytecodeGraphBuilder { |
| 28 public: | 30 public: |
| 29 BytecodeGraphBuilder(Zone* local_zone, CompilationInfo* info, | 31 BytecodeGraphBuilder(Zone* local_zone, CompilationInfo* info, |
| 30 JSGraph* jsgraph, float invocation_frequency); | 32 JSGraph* jsgraph, float invocation_frequency, |
| 33 SourcePositionTable* source_positions); |
| 31 | 34 |
| 32 // Creates a graph by visiting bytecodes. | 35 // Creates a graph by visiting bytecodes. |
| 33 bool CreateGraph(); | 36 bool CreateGraph(); |
| 34 | 37 |
| 35 private: | 38 private: |
| 36 class Environment; | 39 class Environment; |
| 37 class FrameStateBeforeAndAfter; | 40 class FrameStateBeforeAndAfter; |
| 38 | 41 |
| 39 void VisitBytecodes(); | 42 void VisitBytecodes(); |
| 40 | 43 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 // Control nodes that exit the function body. | 297 // Control nodes that exit the function body. |
| 295 ZoneVector<Node*> exit_controls_; | 298 ZoneVector<Node*> exit_controls_; |
| 296 | 299 |
| 297 bool const is_liveness_analysis_enabled_; | 300 bool const is_liveness_analysis_enabled_; |
| 298 | 301 |
| 299 StateValuesCache state_values_cache_; | 302 StateValuesCache state_values_cache_; |
| 300 | 303 |
| 301 // Analyzer of register liveness. | 304 // Analyzer of register liveness. |
| 302 LivenessAnalyzer liveness_analyzer_; | 305 LivenessAnalyzer liveness_analyzer_; |
| 303 | 306 |
| 307 // The Turbofan source position table, to be populated. |
| 308 SourcePositionTable* source_positions_; |
| 309 |
| 310 // Update [source_positions_]'s current position to that of the bytecode at |
| 311 // [offset], if any. |
| 312 void UpdateCurrentSourcePosition(SourcePositionTableIterator* it, int offset); |
| 313 |
| 304 static int const kBinaryOperationHintIndex = 1; | 314 static int const kBinaryOperationHintIndex = 1; |
| 305 static int const kCountOperationHintIndex = 0; | 315 static int const kCountOperationHintIndex = 0; |
| 306 static int const kBinaryOperationSmiHintIndex = 2; | 316 static int const kBinaryOperationSmiHintIndex = 2; |
| 307 | 317 |
| 308 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder); | 318 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder); |
| 309 }; | 319 }; |
| 310 | 320 |
| 311 } // namespace compiler | 321 } // namespace compiler |
| 312 } // namespace internal | 322 } // namespace internal |
| 313 } // namespace v8 | 323 } // namespace v8 |
| 314 | 324 |
| 315 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ | 325 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ |
| OLD | NEW |