Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/compiler/bytecode-graph-builder.h

Issue 2188533002: [turbofan] Generate loop exits in the bytecode graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix 64-bit Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « BUILD.gn ('k') | src/compiler/bytecode-graph-builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 void BuildJumpIfNotHole(); 142 void BuildJumpIfNotHole();
142 143
143 // Simulates control flow by forward-propagating environments. 144 // Simulates control flow by forward-propagating environments.
144 void MergeIntoSuccessorEnvironment(int target_offset); 145 void MergeIntoSuccessorEnvironment(int target_offset);
145 void BuildLoopHeaderEnvironment(int current_offset); 146 void BuildLoopHeaderEnvironment(int current_offset);
146 void SwitchToMergeEnvironment(int current_offset); 147 void SwitchToMergeEnvironment(int current_offset);
147 148
148 // Simulates control flow that exits the function body. 149 // Simulates control flow that exits the function body.
149 void MergeControlToLeaveFunction(Node* exit); 150 void MergeControlToLeaveFunction(Node* exit);
150 151
152 // Builds loop exit nodes for every exited loop between the current bytecode
153 // offset and {target_offset}.
154 void BuildLoopExitsForBranch(int target_offset);
155 void BuildLoopExitsForFunctionExit();
156 void BuildLoopExitsUntilLoop(int loop_offset);
157
151 // Simulates entry and exit of exception handlers. 158 // Simulates entry and exit of exception handlers.
152 void EnterAndExitExceptionHandlers(int current_offset); 159 void EnterAndExitExceptionHandlers(int current_offset);
153 160
154 // Growth increment for the temporary buffer used to construct input lists to 161 // Growth increment for the temporary buffer used to construct input lists to
155 // new nodes. 162 // new nodes.
156 static const int kInputBufferSizeIncrement = 64; 163 static const int kInputBufferSizeIncrement = 64;
157 164
158 // An abstract representation for an exception handler that is being 165 // An abstract representation for an exception handler that is being
159 // entered and exited while the graph builder is iterating over the 166 // entered and exited while the graph builder is iterating over the
160 // underlying bytecode. The exception handlers within the bytecode are 167 // underlying bytecode. The exception handlers within the bytecode are
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 203 }
197 204
198 const BytecodeBranchAnalysis* branch_analysis() const { 205 const BytecodeBranchAnalysis* branch_analysis() const {
199 return branch_analysis_; 206 return branch_analysis_;
200 } 207 }
201 208
202 void set_branch_analysis(const BytecodeBranchAnalysis* branch_analysis) { 209 void set_branch_analysis(const BytecodeBranchAnalysis* branch_analysis) {
203 branch_analysis_ = branch_analysis; 210 branch_analysis_ = branch_analysis;
204 } 211 }
205 212
213 const BytecodeLoopAnalysis* loop_analysis() const { return loop_analysis_; }
214
215 void set_loop_analysis(const BytecodeLoopAnalysis* loop_analysis) {
216 loop_analysis_ = loop_analysis;
217 }
218
206 #define DECLARE_VISIT_BYTECODE(name, ...) void Visit##name(); 219 #define DECLARE_VISIT_BYTECODE(name, ...) void Visit##name();
207 BYTECODE_LIST(DECLARE_VISIT_BYTECODE) 220 BYTECODE_LIST(DECLARE_VISIT_BYTECODE)
208 #undef DECLARE_VISIT_BYTECODE 221 #undef DECLARE_VISIT_BYTECODE
209 222
210 Zone* local_zone_; 223 Zone* local_zone_;
211 JSGraph* jsgraph_; 224 JSGraph* jsgraph_;
212 Handle<BytecodeArray> bytecode_array_; 225 Handle<BytecodeArray> bytecode_array_;
213 Handle<HandlerTable> exception_handler_table_; 226 Handle<HandlerTable> exception_handler_table_;
214 Handle<TypeFeedbackVector> feedback_vector_; 227 Handle<TypeFeedbackVector> feedback_vector_;
215 const FrameStateFunctionInfo* frame_state_function_info_; 228 const FrameStateFunctionInfo* frame_state_function_info_;
216 const interpreter::BytecodeArrayIterator* bytecode_iterator_; 229 const interpreter::BytecodeArrayIterator* bytecode_iterator_;
217 const BytecodeBranchAnalysis* branch_analysis_; 230 const BytecodeBranchAnalysis* branch_analysis_;
231 const BytecodeLoopAnalysis* loop_analysis_;
218 Environment* environment_; 232 Environment* environment_;
219 BailoutId osr_ast_id_; 233 BailoutId osr_ast_id_;
220 234
221 // Merge environments are snapshots of the environment at points where the 235 // Merge environments are snapshots of the environment at points where the
222 // control flow merges. This models a forward data flow propagation of all 236 // control flow merges. This models a forward data flow propagation of all
223 // values from all predecessors of the merge in question. 237 // values from all predecessors of the merge in question.
224 ZoneMap<int, Environment*> merge_environments_; 238 ZoneMap<int, Environment*> merge_environments_;
225 239
226 // Exception handlers currently entered by the iteration. 240 // Exception handlers currently entered by the iteration.
227 ZoneStack<ExceptionHandler> exception_handlers_; 241 ZoneStack<ExceptionHandler> exception_handlers_;
(...skipping 12 matching lines...) Expand all
240 ZoneVector<Node*> exit_controls_; 254 ZoneVector<Node*> exit_controls_;
241 255
242 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder); 256 DISALLOW_COPY_AND_ASSIGN(BytecodeGraphBuilder);
243 }; 257 };
244 258
245 } // namespace compiler 259 } // namespace compiler
246 } // namespace internal 260 } // namespace internal
247 } // namespace v8 261 } // namespace v8
248 262
249 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_ 263 #endif // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/compiler/bytecode-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698