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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 9999045: Implement finally in new compiler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
===================================================================
--- runtime/vm/flow_graph_builder.cc (revision 6389)
+++ runtime/vm/flow_graph_builder.cc (working copy)
@@ -1948,8 +1948,11 @@
}
}
- if (node->finally_block() != NULL) {
- Bailout("EffectGraphVisitor::VisitTryCatchNode finally");
+ // Generate code for the finally block if one exists.
+ if ((node->finally_block() != NULL) && is_open()) {
+ EffectGraphVisitor for_finally_block(owner(), temp_index());
+ node->finally_block()->Visit(&for_finally_block);
+ Append(for_finally_block);
}
}
@@ -1994,7 +1997,21 @@
void EffectGraphVisitor::VisitInlinedFinallyNode(InlinedFinallyNode* node) {
- Bailout("EffectGraphVisitor::VisitInlinedFinallyNode");
+ const intptr_t try_index = owner()->try_index();
+ if (try_index >= 0) {
+ // We are about to generate code for an inlined finally block. Exceptions
+ // thrown in this block of code should be treated as though they are
+ // thrown not from the current try block but the outer try block if any.
+ // the code generator state.
regis 2012/04/11 00:39:16 Leftover comment.
srdjan 2012/04/11 17:12:43 Removed
+ owner()->set_try_index((try_index - 1));
+ }
+ BuildLoadContext(node->context_var(), temp_index());
+ EffectGraphVisitor for_finally_block(owner(), temp_index());
+ node->finally_block()->Visit(&for_finally_block);
+ Append(for_finally_block);
+ if (try_index >= 0) {
+ owner()->set_try_index(try_index);
+ }
}
« 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