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/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 void BuildCallRuntimeForPair(); | 140 void BuildCallRuntimeForPair(); |
141 void BuildCallConstruct(); | 141 void BuildCallConstruct(); |
142 void BuildBinaryOp(const Operator* op); | 142 void BuildBinaryOp(const Operator* op); |
143 void BuildCompareOp(const Operator* op); | 143 void BuildCompareOp(const Operator* op); |
144 void BuildDelete(); | 144 void BuildDelete(); |
145 void BuildCastOperator(const Operator* js_op); | 145 void BuildCastOperator(const Operator* js_op); |
146 void BuildForInPrepare(); | 146 void BuildForInPrepare(); |
147 void BuildForInNext(); | 147 void BuildForInNext(); |
148 | 148 |
149 // Control flow plumbing. | 149 // Control flow plumbing. |
150 void BuildJump(int source_offset, int target_offset); | |
151 void BuildJump(); | 150 void BuildJump(); |
152 void BuildConditionalJump(Node* condition); | 151 void BuildConditionalJump(Node* condition); |
153 void BuildJumpIfEqual(Node* comperand); | 152 void BuildJumpIfEqual(Node* comperand); |
154 void BuildJumpIfToBooleanEqual(Node* boolean_comperand); | 153 void BuildJumpIfToBooleanEqual(Node* boolean_comperand); |
155 | 154 |
156 // Constructing merge and loop headers. | 155 // Simulates control flow by forward-propagating environments. |
157 void MergeEnvironmentsOfBackwardBranches(int source_offset, | 156 void MergeIntoSuccessorEnvironment(int target_offset); |
158 int target_offset); | 157 void BuildLoopHeaderEnvironment(int current_offset); |
159 void MergeEnvironmentsOfForwardBranches(int source_offset); | 158 void SwitchToMergeEnvironment(int current_offset); |
160 void BuildLoopHeaderForBackwardBranches(int source_offset); | |
161 | 159 |
162 // Simulates entry and exit of exception handlers. | 160 // Simulates entry and exit of exception handlers. |
163 void EnterAndExitExceptionHandlers(int current_offset); | 161 void EnterAndExitExceptionHandlers(int current_offset); |
164 | 162 |
165 // Attaches a frame state to |node| for the entry to the function. | 163 // Attaches a frame state to |node| for the entry to the function. |
166 void PrepareEntryFrameState(Node* node); | 164 void PrepareEntryFrameState(Node* node); |
167 | 165 |
168 // Growth increment for the temporary buffer used to construct input lists to | 166 // Growth increment for the temporary buffer used to construct input lists to |
169 // new nodes. | 167 // new nodes. |
170 static const int kInputBufferSizeIncrement = 64; | 168 static const int kInputBufferSizeIncrement = 64; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 Zone* local_zone_; | 224 Zone* local_zone_; |
227 CompilationInfo* info_; | 225 CompilationInfo* info_; |
228 JSGraph* jsgraph_; | 226 JSGraph* jsgraph_; |
229 Handle<BytecodeArray> bytecode_array_; | 227 Handle<BytecodeArray> bytecode_array_; |
230 Handle<HandlerTable> exception_handler_table_; | 228 Handle<HandlerTable> exception_handler_table_; |
231 const FrameStateFunctionInfo* frame_state_function_info_; | 229 const FrameStateFunctionInfo* frame_state_function_info_; |
232 const interpreter::BytecodeArrayIterator* bytecode_iterator_; | 230 const interpreter::BytecodeArrayIterator* bytecode_iterator_; |
233 BytecodeBranchAnalysis* branch_analysis_; // TODO(mstarzinger): Make const. | 231 BytecodeBranchAnalysis* branch_analysis_; // TODO(mstarzinger): Make const. |
234 Environment* environment_; | 232 Environment* environment_; |
235 | 233 |
236 // Merge environments are snapshots of the environment at a particular | 234 // Merge environments are snapshots of the environment at points where the |
237 // bytecode offset to be merged into a later environment. | 235 // control flow merges. This models a forward data flow propagation of all |
| 236 // values from all predecessors of the merge in question. |
238 ZoneMap<int, Environment*> merge_environments_; | 237 ZoneMap<int, Environment*> merge_environments_; |
239 | 238 |
240 // Loop header environments are environments created for bytecodes | |
241 // where it is known there are back branches, ie a loop header. | |
242 ZoneMap<int, Environment*> loop_header_environments_; | |
243 | |
244 // Exception handlers currently entered by the iteration. | 239 // Exception handlers currently entered by the iteration. |
245 ZoneStack<ExceptionHandler> exception_handlers_; | 240 ZoneStack<ExceptionHandler> exception_handlers_; |
246 int current_exception_handler_; | 241 int current_exception_handler_; |
247 | 242 |
248 // Temporary storage for building node input lists. | 243 // Temporary storage for building node input lists. |
249 int input_buffer_size_; | 244 int input_buffer_size_; |
250 Node** input_buffer_; | 245 Node** input_buffer_; |
251 | 246 |
252 // Nodes representing values in the activation record. | 247 // Nodes representing values in the activation record. |
253 SetOncePointer<Node> function_context_; | 248 SetOncePointer<Node> function_context_; |
254 SetOncePointer<Node> function_closure_; | 249 SetOncePointer<Node> function_closure_; |
255 SetOncePointer<Node> new_target_; | 250 SetOncePointer<Node> new_target_; |
256 | 251 |
257 // Optimization to cache loaded feedback vector. | 252 // Optimization to cache loaded feedback vector. |
258 SetOncePointer<Node> feedback_vector_; | 253 SetOncePointer<Node> feedback_vector_; |
259 | 254 |
260 // Control nodes that exit the function body. | 255 // Control nodes that exit the function body. |
261 ZoneVector<Node*> exit_controls_; | 256 ZoneVector<Node*> exit_controls_; |
262 | 257 |
263 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder); | 258 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder); |
264 }; | 259 }; |
265 | 260 |
266 } // namespace compiler | 261 } // namespace compiler |
267 } // namespace internal | 262 } // namespace internal |
268 } // namespace v8 | 263 } // namespace v8 |
269 | 264 |
270 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ | 265 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ |
OLD | NEW |