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

Side by Side Diff: runtime/vm/flow_graph_compiler.h

Issue 23766021: Fix a bug in block reordering/block compaction. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/flow_graph_compiler.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_FLOW_GRAPH_COMPILER_H_ 5 #ifndef VM_FLOW_GRAPH_COMPILER_H_
6 #define VM_FLOW_GRAPH_COMPILER_H_ 6 #define VM_FLOW_GRAPH_COMPILER_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/code_descriptors.h" 10 #include "vm/code_descriptors.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 intptr_t count_arg) 195 intptr_t count_arg)
196 : cid(cid_arg), target(target_arg), count(count_arg) {} 196 : cid(cid_arg), target(target_arg), count(count_arg) {}
197 }; 197 };
198 198
199 199
200 class FlowGraphCompiler : public ValueObject { 200 class FlowGraphCompiler : public ValueObject {
201 private: 201 private:
202 class BlockInfo : public ZoneAllocated { 202 class BlockInfo : public ZoneAllocated {
203 public: 203 public:
204 BlockInfo() 204 BlockInfo()
205 : jump_label_(&block_label_), 205 : block_label_(),
206 block_label_(), 206 jump_label_(&block_label_),
207 fallthrough_label_(NULL), 207 next_nonempty_label_(NULL),
208 is_marked_(false) {} 208 is_marked_(false) {}
209 209
210 // The label to jump to when control is transferred to this block. For
211 // nonempty blocks it is the label of the block itself. For empty
212 // blocks it is the label of the first nonempty successor block.
210 Label* jump_label() const { return jump_label_; } 213 Label* jump_label() const { return jump_label_; }
211 void set_jump_label(Label* label) { jump_label_ = label; } 214 void set_jump_label(Label* label) { jump_label_ = label; }
212 215
213 // Label of the block that will follow this block in the generated code. 216 // The label of the first nonempty block after this one in the block
214 // Can be NULL if the block is the last block. 217 // order, or NULL if there is no nonempty block following this one.
215 Label* fallthrough_label() const { return fallthrough_label_; } 218 Label* next_nonempty_label() const { return next_nonempty_label_; }
216 void set_fallthrough_label(Label* fallthrough_label) { 219 void set_next_nonempty_label(Label* label) { next_nonempty_label_ = label; }
217 fallthrough_label_ = fallthrough_label;
218 }
219 220
220 bool WasCompacted() const { 221 bool WasCompacted() const {
221 return jump_label_ != &block_label_; 222 return jump_label_ != &block_label_;
222 } 223 }
223 224
225 // Block compaction is recursive. Block info for already-compacted
226 // blocks is marked so as to avoid cycles in the graph.
224 bool is_marked() const { return is_marked_; } 227 bool is_marked() const { return is_marked_; }
225 void mark() { is_marked_ = true; } 228 void mark() { is_marked_ = true; }
226 229
227 private: 230 private:
228 Label* jump_label_;
229 Label block_label_; 231 Label block_label_;
230 232
231 Label* fallthrough_label_; 233 Label* jump_label_;
234 Label* next_nonempty_label_;
232 235
233 bool is_marked_; 236 bool is_marked_;
234 }; 237 };
235 238
236 public: 239 public:
237 FlowGraphCompiler(Assembler* assembler, 240 FlowGraphCompiler(Assembler* assembler,
238 FlowGraph* flow_graph, 241 FlowGraph* flow_graph,
239 bool is_optimizing); 242 bool is_optimizing);
240 243
241 ~FlowGraphCompiler(); 244 ~FlowGraphCompiler();
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 // that should be used when deoptimizing we store it in this variable. 603 // that should be used when deoptimizing we store it in this variable.
601 // In future AddDeoptStub should be moved out of the instruction template. 604 // In future AddDeoptStub should be moved out of the instruction template.
602 Environment* pending_deoptimization_env_; 605 Environment* pending_deoptimization_env_;
603 606
604 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); 607 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler);
605 }; 608 };
606 609
607 } // namespace dart 610 } // namespace dart
608 611
609 #endif // VM_FLOW_GRAPH_COMPILER_H_ 612 #endif // VM_FLOW_GRAPH_COMPILER_H_
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698