Index: vm/intermediate_language.cc |
=================================================================== |
--- vm/intermediate_language.cc (revision 9056) |
+++ vm/intermediate_language.cc (working copy) |
@@ -531,6 +531,36 @@ |
} |
+void Instruction::SetSuccessor(Instruction* instr) { |
srdjan
2012/06/25 15:57:16
The two methods are (at least now) very simple set
Florian Schneider
2012/07/02 09:20:42
Done.
|
+ ASSERT(!IsGraphEntry()); |
+ ASSERT(!IsReturn()); |
+ ASSERT(!IsBranch()); |
+ ASSERT(!IsPhi()); |
+ // TODO(fschneider): Also add Throw and ReThrow to the list of instructions |
+ // that do not have a successor. Currently, the graph builder will continue |
+ // to append instruction in case of a Throw inside an expression. This |
+ // condition should be handled in the graph builder |
+ successor_ = instr; |
+} |
+ |
+ |
+void Instruction::SetPrevious(Instruction* instr) { |
+ ASSERT(!IsBlockEntry()); |
+ previous_ = instr; |
+} |
+ |
+ |
+void Instruction::RemoveFromGraph() { |
+ ASSERT(!IsBlockEntry()); |
+ ASSERT(Previous() != NULL); |
+ Instruction* next = StraightLineSuccessor(); |
+ Previous()->SetSuccessor(next); |
+ if (next != NULL && !next->IsBlockEntry()) { |
srdjan
2012/06/25 15:57:16
Add parenthesis. Quick question: when is it possib
Florian Schneider
2012/07/02 09:20:42
It can happen. But this just made me realize that
|
+ next->SetPrevious(Previous()); |
+ } |
srdjan
2012/06/25 15:57:16
Set successor and previous of this instruction to
Florian Schneider
2012/07/02 09:20:42
Done.
|
+} |
+ |
+ |
intptr_t GraphEntryInstr::SuccessorCount() const { |
return 1 + catch_entries_.length(); |
} |