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" | |
13 #include "src/compiler/state-values-utils.h" | 12 #include "src/compiler/state-values-utils.h" |
14 #include "src/compiler/type-hint-analyzer.h" | 13 #include "src/compiler/type-hint-analyzer.h" |
15 #include "src/interpreter/bytecode-array-iterator.h" | 14 #include "src/interpreter/bytecode-array-iterator.h" |
16 #include "src/interpreter/bytecode-flags.h" | 15 #include "src/interpreter/bytecode-flags.h" |
17 #include "src/interpreter/bytecodes.h" | 16 #include "src/interpreter/bytecodes.h" |
18 #include "src/source-position-table.h" | 17 #include "src/source-position-table.h" |
19 | 18 |
20 namespace v8 { | 19 namespace v8 { |
21 namespace internal { | 20 namespace internal { |
22 | 21 |
23 class CompilationInfo; | 22 class CompilationInfo; |
24 | 23 |
25 namespace compiler { | 24 namespace compiler { |
26 | 25 |
| 26 class SourcePositionTable; |
| 27 |
27 // The BytecodeGraphBuilder produces a high-level IR graph based on | 28 // The BytecodeGraphBuilder produces a high-level IR graph based on |
28 // interpreter bytecodes. | 29 // interpreter bytecodes. |
29 class BytecodeGraphBuilder { | 30 class BytecodeGraphBuilder { |
30 public: | 31 public: |
31 BytecodeGraphBuilder(Zone* local_zone, CompilationInfo* info, | 32 BytecodeGraphBuilder(Zone* local_zone, CompilationInfo* info, |
32 JSGraph* jsgraph, float invocation_frequency, | 33 JSGraph* jsgraph, float invocation_frequency, |
33 SourcePositionTable* source_positions); | 34 SourcePositionTable* source_positions, |
| 35 int inlining_id = SourcePosition::kNotInlined); |
34 | 36 |
35 // Creates a graph by visiting bytecodes. | 37 // Creates a graph by visiting bytecodes. |
36 bool CreateGraph(bool stack_check = true); | 38 bool CreateGraph(bool stack_check = true); |
37 | 39 |
38 private: | 40 private: |
39 class Environment; | 41 class Environment; |
40 | 42 |
41 void VisitBytecodes(bool stack_check); | 43 void VisitBytecodes(bool stack_check); |
42 | 44 |
43 // Get or create the node that represents the outer function closure. | 45 // Get or create the node that represents the outer function closure. |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 bool const is_liveness_analysis_enabled_; | 312 bool const is_liveness_analysis_enabled_; |
311 | 313 |
312 StateValuesCache state_values_cache_; | 314 StateValuesCache state_values_cache_; |
313 | 315 |
314 // Analyzer of register liveness. | 316 // Analyzer of register liveness. |
315 LivenessAnalyzer liveness_analyzer_; | 317 LivenessAnalyzer liveness_analyzer_; |
316 | 318 |
317 // The Turbofan source position table, to be populated. | 319 // The Turbofan source position table, to be populated. |
318 SourcePositionTable* source_positions_; | 320 SourcePositionTable* source_positions_; |
319 | 321 |
| 322 SourcePosition const start_position_; |
| 323 |
320 // Update [source_positions_]'s current position to that of the bytecode at | 324 // Update [source_positions_]'s current position to that of the bytecode at |
321 // [offset], if any. | 325 // [offset], if any. |
322 void UpdateCurrentSourcePosition(SourcePositionTableIterator* it, int offset); | 326 void UpdateCurrentSourcePosition(SourcePositionTableIterator* it, int offset); |
323 | 327 |
324 static int const kBinaryOperationHintIndex = 1; | 328 static int const kBinaryOperationHintIndex = 1; |
325 static int const kCountOperationHintIndex = 0; | 329 static int const kCountOperationHintIndex = 0; |
326 static int const kBinaryOperationSmiHintIndex = 2; | 330 static int const kBinaryOperationSmiHintIndex = 2; |
327 | 331 |
328 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder); | 332 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder); |
329 }; | 333 }; |
330 | 334 |
331 } // namespace compiler | 335 } // namespace compiler |
332 } // namespace internal | 336 } // namespace internal |
333 } // namespace v8 | 337 } // namespace v8 |
334 | 338 |
335 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ | 339 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ |
OLD | NEW |