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

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
« vm/intermediate_language.h ('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/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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 successor()->IsBlockEntry()); 520 successor()->IsBlockEntry());
521 return successor() != NULL ? 1 : 0; 521 return successor() != NULL ? 1 : 0;
522 } 522 }
523 523
524 524
525 BlockEntryInstr* Instruction::SuccessorAt(intptr_t index) const { 525 BlockEntryInstr* Instruction::SuccessorAt(intptr_t index) const {
526 return successor()->AsBlockEntry(); 526 return successor()->AsBlockEntry();
527 } 527 }
528 528
529 529
530 Instruction* Instruction::RemoveFromGraph() {
531 ASSERT(!IsBlockEntry());
532 ASSERT(!IsBranch());
533 ASSERT(!IsThrow());
534 ASSERT(!IsReturn());
535 ASSERT(!IsReThrow());
536 ASSERT(previous() != NULL);
537 Instruction* next = successor();
538 previous()->set_successor(next);
539 if (next != NULL) {
540 if (!next->IsBlockEntry()) {
541 next->set_previous(previous());
542 } else {
543 // Removing the last instruction of a block.
544 // Update last_instruction of the current basic block.
545 Instruction* current = this;
546 while (!current->IsBlockEntry()) {
547 current = current->previous();
548 }
549 ASSERT(current->AsBlockEntry()->last_instruction() == this);
550 current->AsBlockEntry()->set_last_instruction(previous());
551 }
552 }
553 // Reset successor and previous instruction to indicate
554 // that the instruction is removed from the graph.
555 set_successor(NULL);
556 set_previous(NULL);
557 return next;
558 }
559
560
561 intptr_t GraphEntryInstr::SuccessorCount() const { 530 intptr_t GraphEntryInstr::SuccessorCount() const {
562 return 1 + catch_entries_.length(); 531 return 1 + catch_entries_.length();
563 } 532 }
564 533
565 534
566 BlockEntryInstr* GraphEntryInstr::SuccessorAt(intptr_t index) const { 535 BlockEntryInstr* GraphEntryInstr::SuccessorAt(intptr_t index) const {
567 if (index == 0) return normal_entry_; 536 if (index == 0) return normal_entry_;
568 return catch_entries_[index - 1]; 537 return catch_entries_[index - 1];
569 } 538 }
570 539
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); 1301 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint());
1333 compiler->GenerateCall(token_pos(), try_index(), &label, 1302 compiler->GenerateCall(token_pos(), try_index(), &label,
1334 PcDescriptors::kOther); 1303 PcDescriptors::kOther);
1335 __ Drop(2); // Discard type arguments and receiver. 1304 __ Drop(2); // Discard type arguments and receiver.
1336 } 1305 }
1337 1306
1338 1307
1339 #undef __ 1308 #undef __
1340 1309
1341 } // namespace dart 1310 } // namespace dart
OLDNEW
« vm/intermediate_language.h ('K') | « vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698