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

Side by Side Diff: vm/intermediate_language.cc

Issue 10692107: Add forward iterator to iterate instructions inside a basic block. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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 | « 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/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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 successor()->IsBlockEntry()); 511 successor()->IsBlockEntry());
512 return successor() != NULL ? 1 : 0; 512 return successor() != NULL ? 1 : 0;
513 } 513 }
514 514
515 515
516 BlockEntryInstr* Instruction::SuccessorAt(intptr_t index) const { 516 BlockEntryInstr* Instruction::SuccessorAt(intptr_t index) const {
517 return successor()->AsBlockEntry(); 517 return successor()->AsBlockEntry();
518 } 518 }
519 519
520 520
521 Instruction* Instruction::RemoveFromGraph() {
522 ASSERT(!IsBlockEntry());
523 ASSERT(!IsBranch());
524 ASSERT(!IsThrow());
525 ASSERT(!IsReturn());
526 ASSERT(!IsReThrow());
527 ASSERT(previous() != NULL);
528 Instruction* next = successor();
529 previous()->set_successor(next);
530 if (next != NULL) {
531 if (!next->IsBlockEntry()) {
532 next->set_previous(previous());
533 } else {
534 // Removing the last instruction of a block.
535 // Update last_instruction of the current basic block.
536 Instruction* current = this;
537 while (!current->IsBlockEntry()) {
538 current = current->previous();
539 }
540 ASSERT(current->AsBlockEntry()->last_instruction() == this);
541 current->AsBlockEntry()->set_last_instruction(previous());
542 }
543 }
544 // Reset successor and previous instruction to indicate
545 // that the instruction is removed from the graph.
546 set_successor(NULL);
547 set_previous(NULL);
548 return next;
549 }
550
551
552 intptr_t GraphEntryInstr::SuccessorCount() const { 521 intptr_t GraphEntryInstr::SuccessorCount() const {
553 return 1 + catch_entries_.length(); 522 return 1 + catch_entries_.length();
554 } 523 }
555 524
556 525
557 BlockEntryInstr* GraphEntryInstr::SuccessorAt(intptr_t index) const { 526 BlockEntryInstr* GraphEntryInstr::SuccessorAt(intptr_t index) const {
558 if (index == 0) return normal_entry_; 527 if (index == 0) return normal_entry_;
559 return catch_entries_[index - 1]; 528 return catch_entries_[index - 1];
560 } 529 }
561 530
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); 1292 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint());
1324 compiler->GenerateCall(token_pos(), try_index(), &label, 1293 compiler->GenerateCall(token_pos(), try_index(), &label,
1325 PcDescriptors::kOther); 1294 PcDescriptors::kOther);
1326 __ Drop(2); // Discard type arguments and receiver. 1295 __ Drop(2); // Discard type arguments and receiver.
1327 } 1296 }
1328 1297
1329 1298
1330 #undef __ 1299 #undef __
1331 1300
1332 } // namespace dart 1301 } // namespace dart
OLDNEW
« no previous file with comments | « vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698