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

Side by Side Diff: vm/intermediate_language.cc

Issue 10446116: Add flow graph printing into a .cfg file with flag --print-flow-graph-file. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 6 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
« vm/flow_graph_builder.cc ('K') | « vm/intermediate_language.h ('k') | no next file » | 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 #include "vm/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/flow_graph_builder.h" 8 #include "vm/flow_graph_builder.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/os.h" 10 #include "vm/os.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 ASSERT(parent->is_empty()); 164 ASSERT(parent->is_empty());
165 165
166 // This node has no parent, indicated by -1. The preorder number is 0. 166 // This node has no parent, indicated by -1. The preorder number is 0.
167 parent->Add(-1); 167 parent->Add(-1);
168 set_preorder_number(0); 168 set_preorder_number(0);
169 preorder->Add(this); 169 preorder->Add(this);
170 BitVector* vars = 170 BitVector* vars =
171 (variable_count == 0) ? NULL : new BitVector(variable_count); 171 (variable_count == 0) ? NULL : new BitVector(variable_count);
172 assigned_vars->Add(vars); 172 assigned_vars->Add(vars);
173 173
174 // The graph entry consists of only one instruction.
175 set_last_instruction(this);
176
174 // Iteratively traverse all successors. In the unoptimized code, we will 177 // Iteratively traverse all successors. In the unoptimized code, we will
175 // enter the function at the first successor in reverse postorder, so we 178 // enter the function at the first successor in reverse postorder, so we
176 // must visit the normal entry last. 179 // must visit the normal entry last.
177 for (intptr_t i = catch_entries_.length() - 1; i >= 0; --i) { 180 for (intptr_t i = catch_entries_.length() - 1; i >= 0; --i) {
178 catch_entries_[i]->DiscoverBlocks(this, preorder, postorder, 181 catch_entries_[i]->DiscoverBlocks(this, preorder, postorder,
179 parent, assigned_vars, variable_count); 182 parent, assigned_vars, variable_count);
180 } 183 }
181 normal_entry_->DiscoverBlocks(this, preorder, postorder, 184 normal_entry_->DiscoverBlocks(this, preorder, postorder,
182 parent, assigned_vars, variable_count); 185 parent, assigned_vars, variable_count);
183 186
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 // nonoptimizing compiler. 265 // nonoptimizing compiler.
263 ASSERT(true_successor_ != NULL); 266 ASSERT(true_successor_ != NULL);
264 ASSERT(false_successor_ != NULL); 267 ASSERT(false_successor_ != NULL);
265 false_successor_->DiscoverBlocks(current_block, preorder, postorder, 268 false_successor_->DiscoverBlocks(current_block, preorder, postorder,
266 parent, assigned_vars, variable_count); 269 parent, assigned_vars, variable_count);
267 true_successor_->DiscoverBlocks(current_block, preorder, postorder, 270 true_successor_->DiscoverBlocks(current_block, preorder, postorder,
268 parent, assigned_vars, variable_count); 271 parent, assigned_vars, variable_count);
269 } 272 }
270 273
271 274
275 intptr_t Instruction::SuccessorCount() const {
276 ASSERT(!IsBranch());
277 ASSERT(!IsGraphEntry());
278 ASSERT(StraightLineSuccessor() == NULL ||
279 StraightLineSuccessor()->IsBlockEntry());
280 return StraightLineSuccessor() != NULL ? 1 : 0;
281 }
282
283
284 BlockEntryInstr* Instruction::SuccessorAt(intptr_t index) const {
285 return StraightLineSuccessor()->AsBlockEntry();
286 }
287
288
289 intptr_t GraphEntryInstr::SuccessorCount() const {
290 return 1 + catch_entries_.length();
291 }
292
293
294 BlockEntryInstr* GraphEntryInstr::SuccessorAt(intptr_t index) const {
295 if (index == 0) return normal_entry_;
296 return catch_entries_[index - 1];
297 }
298
299
300 intptr_t BranchInstr::SuccessorCount() const {
301 return 2;
302 }
303
304
305 BlockEntryInstr* BranchInstr::SuccessorAt(intptr_t index) const {
306 if (index == 0) return true_successor_;
307 if (index == 1) return false_successor_;
308 UNREACHABLE();
309 return NULL;
310 }
311
312
272 // ==== Support for propagating static type. 313 // ==== Support for propagating static type.
273 RawAbstractType* ConstantVal::StaticType() const { 314 RawAbstractType* ConstantVal::StaticType() const {
274 if (value().IsInstance()) { 315 if (value().IsInstance()) {
275 Instance& instance = Instance::Handle(); 316 Instance& instance = Instance::Handle();
276 instance ^= value().raw(); 317 instance ^= value().raw();
277 return instance.GetType(); 318 return instance.GetType();
278 } else { 319 } else {
279 UNREACHABLE(); 320 UNREACHABLE();
280 return AbstractType::null(); 321 return AbstractType::null();
281 } 322 }
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 } 570 }
530 571
531 572
532 RawAbstractType* BinaryOpComp::StaticType() const { 573 RawAbstractType* BinaryOpComp::StaticType() const {
533 // TODO(srdjan): Compute based on input types (ICData). 574 // TODO(srdjan): Compute based on input types (ICData).
534 return Type::DynamicType(); 575 return Type::DynamicType();
535 } 576 }
536 577
537 578
538 } // namespace dart 579 } // namespace dart
OLDNEW
« vm/flow_graph_builder.cc ('K') | « vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698