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/js-type-hint-lowering.h" | 10 #include "src/compiler/js-type-hint-lowering.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class Reduction; | 22 class Reduction; |
23 class SourcePositionTable; | 23 class SourcePositionTable; |
24 | 24 |
25 // The BytecodeGraphBuilder produces a high-level IR graph based on | 25 // The BytecodeGraphBuilder produces a high-level IR graph based on |
26 // interpreter bytecodes. | 26 // interpreter bytecodes. |
27 class BytecodeGraphBuilder { | 27 class BytecodeGraphBuilder { |
28 public: | 28 public: |
29 BytecodeGraphBuilder( | 29 BytecodeGraphBuilder( |
30 Zone* local_zone, Handle<SharedFunctionInfo> shared, | 30 Zone* local_zone, Handle<SharedFunctionInfo> shared, |
31 Handle<FeedbackVector> feedback_vector, BailoutId osr_ast_id, | 31 Handle<FeedbackVector> feedback_vector, BailoutId osr_ast_id, |
32 JSGraph* jsgraph, float invocation_frequency, | 32 JSGraph* jsgraph, CallFrequency invocation_frequency, |
33 SourcePositionTable* source_positions, | 33 SourcePositionTable* source_positions, |
34 int inlining_id = SourcePosition::kNotInlined, | 34 int inlining_id = SourcePosition::kNotInlined, |
35 JSTypeHintLowering::Flags flags = JSTypeHintLowering::kNoFlags); | 35 JSTypeHintLowering::Flags flags = JSTypeHintLowering::kNoFlags); |
36 | 36 |
37 // Creates a graph by visiting bytecodes. | 37 // Creates a graph by visiting bytecodes. |
38 bool CreateGraph(bool stack_check = true); | 38 bool CreateGraph(bool stack_check = true); |
39 | 39 |
40 private: | 40 private: |
41 class Environment; | 41 class Environment; |
42 | 42 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // Helper function to create binary operation hint from the recorded | 199 // Helper function to create binary operation hint from the recorded |
200 // type feedback. | 200 // type feedback. |
201 BinaryOperationHint GetBinaryOperationHint(int operand_index); | 201 BinaryOperationHint GetBinaryOperationHint(int operand_index); |
202 | 202 |
203 // Helper function to create compare operation hint from the recorded | 203 // Helper function to create compare operation hint from the recorded |
204 // type feedback. | 204 // type feedback. |
205 CompareOperationHint GetCompareOperationHint(); | 205 CompareOperationHint GetCompareOperationHint(); |
206 | 206 |
207 // Helper function to compute call frequency from the recorded type | 207 // Helper function to compute call frequency from the recorded type |
208 // feedback. | 208 // feedback. |
209 float ComputeCallFrequency(int slot_id) const; | 209 CallFrequency ComputeCallFrequency(int slot_id) const; |
210 | 210 |
211 // Control flow plumbing. | 211 // Control flow plumbing. |
212 void BuildJump(); | 212 void BuildJump(); |
213 void BuildJumpIf(Node* condition); | 213 void BuildJumpIf(Node* condition); |
214 void BuildJumpIfNot(Node* condition); | 214 void BuildJumpIfNot(Node* condition); |
215 void BuildJumpIfEqual(Node* comperand); | 215 void BuildJumpIfEqual(Node* comperand); |
216 void BuildJumpIfNotEqual(Node* comperand); | 216 void BuildJumpIfNotEqual(Node* comperand); |
217 void BuildJumpIfTrue(); | 217 void BuildJumpIfTrue(); |
218 void BuildJumpIfFalse(); | 218 void BuildJumpIfFalse(); |
219 void BuildJumpIfToBooleanTrue(); | 219 void BuildJumpIfToBooleanTrue(); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 void mark_as_needing_eager_checkpoint(bool value) { | 308 void mark_as_needing_eager_checkpoint(bool value) { |
309 needs_eager_checkpoint_ = value; | 309 needs_eager_checkpoint_ = value; |
310 } | 310 } |
311 | 311 |
312 #define DECLARE_VISIT_BYTECODE(name, ...) void Visit##name(); | 312 #define DECLARE_VISIT_BYTECODE(name, ...) void Visit##name(); |
313 BYTECODE_LIST(DECLARE_VISIT_BYTECODE) | 313 BYTECODE_LIST(DECLARE_VISIT_BYTECODE) |
314 #undef DECLARE_VISIT_BYTECODE | 314 #undef DECLARE_VISIT_BYTECODE |
315 | 315 |
316 Zone* local_zone_; | 316 Zone* local_zone_; |
317 JSGraph* jsgraph_; | 317 JSGraph* jsgraph_; |
318 float const invocation_frequency_; | 318 CallFrequency const invocation_frequency_; |
319 Handle<BytecodeArray> bytecode_array_; | 319 Handle<BytecodeArray> bytecode_array_; |
320 Handle<HandlerTable> exception_handler_table_; | 320 Handle<HandlerTable> exception_handler_table_; |
321 Handle<FeedbackVector> feedback_vector_; | 321 Handle<FeedbackVector> feedback_vector_; |
322 const JSTypeHintLowering type_hint_lowering_; | 322 const JSTypeHintLowering type_hint_lowering_; |
323 const FrameStateFunctionInfo* frame_state_function_info_; | 323 const FrameStateFunctionInfo* frame_state_function_info_; |
324 const interpreter::BytecodeArrayIterator* bytecode_iterator_; | 324 const interpreter::BytecodeArrayIterator* bytecode_iterator_; |
325 const BytecodeAnalysis* bytecode_analysis_; | 325 const BytecodeAnalysis* bytecode_analysis_; |
326 Environment* environment_; | 326 Environment* environment_; |
327 BailoutId osr_ast_id_; | 327 BailoutId osr_ast_id_; |
328 | 328 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 static int const kBinaryOperationSmiHintIndex = 1; | 364 static int const kBinaryOperationSmiHintIndex = 1; |
365 | 365 |
366 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder); | 366 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder); |
367 }; | 367 }; |
368 | 368 |
369 } // namespace compiler | 369 } // namespace compiler |
370 } // namespace internal | 370 } // namespace internal |
371 } // namespace v8 | 371 } // namespace v8 |
372 | 372 |
373 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ | 373 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ |
OLD | NEW |