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

Side by Side Diff: vm/intermediate_language.cc

Issue 10825198: Simplify BlockEntryInstr::DiscoverBlocks a bit. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/flow_graph_builder.h" 9 #include "vm/flow_graph_builder.h"
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 (variable_count == 0) ? NULL : new BitVector(variable_count); 554 (variable_count == 0) ? NULL : new BitVector(variable_count);
555 assigned_vars->Add(vars); 555 assigned_vars->Add(vars);
556 // The preorder, parent, and assigned_vars arrays are all indexed by 556 // The preorder, parent, and assigned_vars arrays are all indexed by
557 // preorder block number, so they should stay in lockstep. 557 // preorder block number, so they should stay in lockstep.
558 ASSERT(preorder->length() == parent->length()); 558 ASSERT(preorder->length() == parent->length());
559 ASSERT(preorder->length() == assigned_vars->length()); 559 ASSERT(preorder->length() == assigned_vars->length());
560 560
561 // 5. Iterate straight-line successors until a branch instruction or 561 // 5. Iterate straight-line successors until a branch instruction or
562 // another basic block entry instruction, and visit that instruction. 562 // another basic block entry instruction, and visit that instruction.
563 ASSERT(next() != NULL); 563 ASSERT(next() != NULL);
564 ASSERT(!next()->IsBlockEntry());
564 Instruction* next_instr = next(); 565 Instruction* next_instr = next();
565 if (next_instr->IsBlockEntry()) { 566 while ((next_instr != NULL) &&
566 set_last_instruction(this); 567 !next_instr->IsBlockEntry() &&
567 } else { 568 !next_instr->IsBranch()) {
568 while ((next_instr != NULL) && 569 if (vars != NULL) {
569 !next_instr->IsBlockEntry() && 570 next_instr->RecordAssignedVars(vars, fixed_parameter_count);
570 !next_instr->IsBranch()) {
571 if (vars != NULL) {
572 next_instr->RecordAssignedVars(vars, fixed_parameter_count);
573 }
574 set_last_instruction(next_instr);
575 GotoInstr* goto_instr = next_instr->AsGoto();
576 next_instr =
577 (goto_instr != NULL) ? goto_instr->successor() : next_instr->next();
578 } 571 }
572 set_last_instruction(next_instr);
573 GotoInstr* goto_instr = next_instr->AsGoto();
574 next_instr =
575 (goto_instr != NULL) ? goto_instr->successor() : next_instr->next();
579 } 576 }
580 if (next_instr != NULL) { 577 if (next_instr != NULL) {
581 next_instr->DiscoverBlocks(this, preorder, postorder, 578 next_instr->DiscoverBlocks(this, preorder, postorder,
582 parent, assigned_vars, 579 parent, assigned_vars,
583 variable_count, fixed_parameter_count); 580 variable_count, fixed_parameter_count);
584 } 581 }
585 582
586 // 6. Assign postorder number and add the block entry to the list. 583 // 6. Assign postorder number and add the block entry to the list.
587 set_postorder_number(postorder->length()); 584 set_postorder_number(postorder->length());
588 postorder->Add(this); 585 postorder->Add(this);
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 if (compiler->is_ssa()) { 1385 if (compiler->is_ssa()) {
1389 ASSERT(locs()->in(0).IsRegister()); 1386 ASSERT(locs()->in(0).IsRegister());
1390 __ PushRegister(locs()->in(0).reg()); 1387 __ PushRegister(locs()->in(0).reg());
1391 } 1388 }
1392 } 1389 }
1393 1390
1394 1391
1395 #undef __ 1392 #undef __
1396 1393
1397 } // namespace dart 1394 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698