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" |
11 #include "src/compiler/state-values-utils.h" | 11 #include "src/compiler/state-values-utils.h" |
12 #include "src/interpreter/bytecode-array-iterator.h" | 12 #include "src/interpreter/bytecode-array-iterator.h" |
13 #include "src/interpreter/bytecode-flags.h" | 13 #include "src/interpreter/bytecode-flags.h" |
14 #include "src/interpreter/bytecodes.h" | 14 #include "src/interpreter/bytecodes.h" |
15 #include "src/source-position-table.h" | 15 #include "src/source-position-table.h" |
16 | 16 |
17 namespace v8 { | 17 namespace v8 { |
18 namespace internal { | 18 namespace internal { |
| 19 |
| 20 class CompilationDependencies; |
| 21 |
19 namespace compiler { | 22 namespace compiler { |
20 | 23 |
21 class Reduction; | 24 class Reduction; |
22 class SourcePositionTable; | 25 class SourcePositionTable; |
23 | 26 |
24 // The BytecodeGraphBuilder produces a high-level IR graph based on | 27 // The BytecodeGraphBuilder produces a high-level IR graph based on |
25 // interpreter bytecodes. | 28 // interpreter bytecodes. |
26 class BytecodeGraphBuilder { | 29 class BytecodeGraphBuilder { |
27 public: | 30 public: |
28 BytecodeGraphBuilder( | 31 BytecodeGraphBuilder( |
29 Zone* local_zone, Handle<SharedFunctionInfo> shared, | 32 Zone* local_zone, Handle<SharedFunctionInfo> shared, |
30 Handle<FeedbackVector> feedback_vector, BailoutId osr_ast_id, | 33 Handle<FeedbackVector> feedback_vector, BailoutId osr_ast_id, |
31 JSGraph* jsgraph, CallFrequency invocation_frequency, | 34 JSGraph* jsgraph, CallFrequency invocation_frequency, |
32 SourcePositionTable* source_positions, | 35 SourcePositionTable* source_positions, Handle<Context> native_context, |
| 36 CompilationDependencies* dependencies, |
33 int inlining_id = SourcePosition::kNotInlined, | 37 int inlining_id = SourcePosition::kNotInlined, |
34 JSTypeHintLowering::Flags flags = JSTypeHintLowering::kNoFlags); | 38 JSTypeHintLowering::Flags flags = JSTypeHintLowering::kNoFlags); |
35 | 39 |
36 // Creates a graph by visiting bytecodes. | 40 // Creates a graph by visiting bytecodes. |
37 void CreateGraph(bool stack_check = true); | 41 void CreateGraph(bool stack_check = true); |
38 | 42 |
39 private: | 43 private: |
40 class Environment; | 44 class Environment; |
41 struct SubEnvironment; | 45 struct SubEnvironment; |
42 | 46 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 Node* name = nullptr); | 186 Node* name = nullptr); |
183 | 187 |
184 // Optional early lowering to the simplified operator level. Returns the node | 188 // Optional early lowering to the simplified operator level. Returns the node |
185 // representing the lowered operation or {nullptr} if no lowering available. | 189 // representing the lowered operation or {nullptr} if no lowering available. |
186 // Note that the result has already been wired into the environment just like | 190 // Note that the result has already been wired into the environment just like |
187 // any other invocation of {NewNode} would do. | 191 // any other invocation of {NewNode} would do. |
188 Node* TryBuildSimplifiedBinaryOp(const Operator* op, Node* left, Node* right, | 192 Node* TryBuildSimplifiedBinaryOp(const Operator* op, Node* left, Node* right, |
189 FeedbackSlot slot); | 193 FeedbackSlot slot); |
190 Node* TryBuildSimplifiedToNumber(Node* input, FeedbackSlot slot); | 194 Node* TryBuildSimplifiedToNumber(Node* input, FeedbackSlot slot); |
191 Node* TryBuildSimplifiedToPrimitiveToString(Node* input, FeedbackSlot slot); | 195 Node* TryBuildSimplifiedToPrimitiveToString(Node* input, FeedbackSlot slot); |
192 Node* TryBuildSimplifiedLoadNamed(const Operator* op, Node* receiver, | 196 JSTypeHintLowering::LoweringResult TryBuildSimplifiedLoadNamed( |
193 FeedbackSlot slot); | 197 const Operator* op, Node* receiver, FeedbackSlot slot); |
194 Node* TryBuildSimplifiedLoadKeyed(const Operator* op, Node* receiver, | 198 Node* TryBuildSimplifiedLoadKeyed(const Operator* op, Node* receiver, |
195 Node* key, FeedbackSlot slot); | 199 Node* key, FeedbackSlot slot); |
196 Node* TryBuildSimplifiedStoreNamed(const Operator* op, Node* receiver, | 200 Node* TryBuildSimplifiedStoreNamed(const Operator* op, Node* receiver, |
197 Node* value, FeedbackSlot slot); | 201 Node* value, FeedbackSlot slot); |
198 Node* TryBuildSimplifiedStoreKeyed(const Operator* op, Node* receiver, | 202 Node* TryBuildSimplifiedStoreKeyed(const Operator* op, Node* receiver, |
199 Node* key, Node* value, FeedbackSlot slot); | 203 Node* key, Node* value, FeedbackSlot slot); |
200 | 204 |
201 // Applies the given early reduction onto the current environment. | 205 // Applies the given early reduction onto the current environment. |
202 void ApplyEarlyReduction(Reduction reduction); | 206 void ApplyEarlyReduction(Reduction reduction); |
| 207 void ApplyEarlyReduction(JSTypeHintLowering::LoweringResult reduction); |
203 | 208 |
204 // Check the context chain for extensions, for lookup fast paths. | 209 // Check the context chain for extensions, for lookup fast paths. |
205 Environment* CheckContextExtensions(uint32_t depth); | 210 Environment* CheckContextExtensions(uint32_t depth); |
206 | 211 |
207 // Helper function to create binary operation hint from the recorded | 212 // Helper function to create binary operation hint from the recorded |
208 // type feedback. | 213 // type feedback. |
209 BinaryOperationHint GetBinaryOperationHint(int operand_index); | 214 BinaryOperationHint GetBinaryOperationHint(int operand_index); |
210 | 215 |
211 // Helper function to create compare operation hint from the recorded | 216 // Helper function to create compare operation hint from the recorded |
212 // type feedback. | 217 // type feedback. |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 static int const kBinaryOperationSmiHintIndex = 1; | 379 static int const kBinaryOperationSmiHintIndex = 1; |
375 | 380 |
376 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder); | 381 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder); |
377 }; | 382 }; |
378 | 383 |
379 } // namespace compiler | 384 } // namespace compiler |
380 } // namespace internal | 385 } // namespace internal |
381 } // namespace v8 | 386 } // namespace v8 |
382 | 387 |
383 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ | 388 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ |
OLD | NEW |