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.h" | 8 #include "src/compiler.h" |
9 #include "src/compiler/bytecode-branch-analysis.h" | 9 #include "src/compiler/bytecode-branch-analysis.h" |
10 #include "src/compiler/bytecode-loop-analysis.h" | |
10 #include "src/compiler/js-graph.h" | 11 #include "src/compiler/js-graph.h" |
11 #include "src/interpreter/bytecode-array-iterator.h" | 12 #include "src/interpreter/bytecode-array-iterator.h" |
12 #include "src/interpreter/bytecode-flags.h" | 13 #include "src/interpreter/bytecode-flags.h" |
13 #include "src/interpreter/bytecodes.h" | 14 #include "src/interpreter/bytecodes.h" |
14 | 15 |
15 namespace v8 { | 16 namespace v8 { |
16 namespace internal { | 17 namespace internal { |
17 namespace compiler { | 18 namespace compiler { |
18 | 19 |
19 // The BytecodeGraphBuilder produces a high-level IR graph based on | 20 // The BytecodeGraphBuilder produces a high-level IR graph based on |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 void BuildJumpIfNotHole(); | 141 void BuildJumpIfNotHole(); |
141 | 142 |
142 // Simulates control flow by forward-propagating environments. | 143 // Simulates control flow by forward-propagating environments. |
143 void MergeIntoSuccessorEnvironment(int target_offset); | 144 void MergeIntoSuccessorEnvironment(int target_offset); |
144 void BuildLoopHeaderEnvironment(int current_offset); | 145 void BuildLoopHeaderEnvironment(int current_offset); |
145 void SwitchToMergeEnvironment(int current_offset); | 146 void SwitchToMergeEnvironment(int current_offset); |
146 | 147 |
147 // Simulates control flow that exits the function body. | 148 // Simulates control flow that exits the function body. |
148 void MergeControlToLeaveFunction(Node* exit); | 149 void MergeControlToLeaveFunction(Node* exit); |
149 | 150 |
151 // Builds loop exit nodes for every exited loop between {origin_offset} and | |
152 // {target_offset}. | |
Michael Starzinger
2016/07/29 08:54:46
nit: s/{origin_offset}/the current bytecode offset
Jarin
2016/07/29 11:36:46
Done.
| |
153 void BuildLoopExitsForBranch(int target_offset); | |
154 void BuildLoopExitsForFunctionExit(); | |
155 void BuildLoopExitsUntilLoop(int loop_offset); | |
156 | |
150 // Simulates entry and exit of exception handlers. | 157 // Simulates entry and exit of exception handlers. |
151 void EnterAndExitExceptionHandlers(int current_offset); | 158 void EnterAndExitExceptionHandlers(int current_offset); |
152 | 159 |
153 // Growth increment for the temporary buffer used to construct input lists to | 160 // Growth increment for the temporary buffer used to construct input lists to |
154 // new nodes. | 161 // new nodes. |
155 static const int kInputBufferSizeIncrement = 64; | 162 static const int kInputBufferSizeIncrement = 64; |
156 | 163 |
157 // The catch prediction from the handler table is reused. | 164 // The catch prediction from the handler table is reused. |
158 typedef HandlerTable::CatchPrediction CatchPrediction; | 165 typedef HandlerTable::CatchPrediction CatchPrediction; |
159 | 166 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 } | 206 } |
200 | 207 |
201 const BytecodeBranchAnalysis* branch_analysis() const { | 208 const BytecodeBranchAnalysis* branch_analysis() const { |
202 return branch_analysis_; | 209 return branch_analysis_; |
203 } | 210 } |
204 | 211 |
205 void set_branch_analysis(const BytecodeBranchAnalysis* branch_analysis) { | 212 void set_branch_analysis(const BytecodeBranchAnalysis* branch_analysis) { |
206 branch_analysis_ = branch_analysis; | 213 branch_analysis_ = branch_analysis; |
207 } | 214 } |
208 | 215 |
216 const BytecodeLoopAnalysis* loop_analysis() const { return loop_analysis_; } | |
217 | |
218 void set_loop_analysis(const BytecodeLoopAnalysis* loop_analysis) { | |
219 loop_analysis_ = loop_analysis; | |
220 } | |
221 | |
209 #define DECLARE_VISIT_BYTECODE(name, ...) void Visit##name(); | 222 #define DECLARE_VISIT_BYTECODE(name, ...) void Visit##name(); |
210 BYTECODE_LIST(DECLARE_VISIT_BYTECODE) | 223 BYTECODE_LIST(DECLARE_VISIT_BYTECODE) |
211 #undef DECLARE_VISIT_BYTECODE | 224 #undef DECLARE_VISIT_BYTECODE |
212 | 225 |
213 Zone* local_zone_; | 226 Zone* local_zone_; |
214 JSGraph* jsgraph_; | 227 JSGraph* jsgraph_; |
215 Handle<BytecodeArray> bytecode_array_; | 228 Handle<BytecodeArray> bytecode_array_; |
216 Handle<HandlerTable> exception_handler_table_; | 229 Handle<HandlerTable> exception_handler_table_; |
217 Handle<TypeFeedbackVector> feedback_vector_; | 230 Handle<TypeFeedbackVector> feedback_vector_; |
218 const FrameStateFunctionInfo* frame_state_function_info_; | 231 const FrameStateFunctionInfo* frame_state_function_info_; |
219 const interpreter::BytecodeArrayIterator* bytecode_iterator_; | 232 const interpreter::BytecodeArrayIterator* bytecode_iterator_; |
220 const BytecodeBranchAnalysis* branch_analysis_; | 233 const BytecodeBranchAnalysis* branch_analysis_; |
234 const BytecodeLoopAnalysis* loop_analysis_; | |
221 Environment* environment_; | 235 Environment* environment_; |
222 BailoutId osr_ast_id_; | 236 BailoutId osr_ast_id_; |
223 | 237 |
224 // Merge environments are snapshots of the environment at points where the | 238 // Merge environments are snapshots of the environment at points where the |
225 // control flow merges. This models a forward data flow propagation of all | 239 // control flow merges. This models a forward data flow propagation of all |
226 // values from all predecessors of the merge in question. | 240 // values from all predecessors of the merge in question. |
227 ZoneMap<int, Environment*> merge_environments_; | 241 ZoneMap<int, Environment*> merge_environments_; |
228 | 242 |
229 // Exception handlers currently entered by the iteration. | 243 // Exception handlers currently entered by the iteration. |
230 ZoneStack<ExceptionHandler> exception_handlers_; | 244 ZoneStack<ExceptionHandler> exception_handlers_; |
(...skipping 12 matching lines...) Expand all Loading... | |
243 ZoneVector<Node*> exit_controls_; | 257 ZoneVector<Node*> exit_controls_; |
244 | 258 |
245 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder); | 259 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder); |
246 }; | 260 }; |
247 | 261 |
248 } // namespace compiler | 262 } // namespace compiler |
249 } // namespace internal | 263 } // namespace internal |
250 } // namespace v8 | 264 } // namespace v8 |
251 | 265 |
252 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ | 266 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ |
OLD | NEW |