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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 22184003: Fix a bug in compilation of try-finally. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph_builder.h ('k') | runtime/vm/il_printer.cc » ('j') | 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 25764)
+++ runtime/vm/flow_graph_builder.cc (working copy)
@@ -57,7 +57,6 @@
exit_collector_(exit_collector),
last_used_block_id_(0), // 0 is used for the graph entry.
context_level_(0),
- last_used_try_index_(CatchClauseNode::kInvalidTryIndex),
try_index_(CatchClauseNode::kInvalidTryIndex),
loop_depth_(0),
graph_entry_(NULL),
@@ -3315,7 +3314,8 @@
void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) {
InlineBailout("EffectGraphVisitor::VisitTryCatchNode (exception)");
intptr_t original_handler_index = owner()->try_index();
- intptr_t try_handler_index = owner()->AllocateTryIndex();
+ intptr_t try_handler_index = node->try_index();
+ ASSERT(try_handler_index != original_handler_index);
owner()->set_try_index(try_handler_index);
// Preserve CTX into local variable '%saved_context'.
@@ -3348,7 +3348,8 @@
// block.
intptr_t catch_handler_index = (finally_block == NULL)
? original_handler_index
- : owner()->AllocateTryIndex();
+ : catch_block->catch_handler_index();
+
owner()->set_try_index(catch_handler_index);
EffectGraphVisitor for_catch(owner(), temp_index());
catch_block->Visit(&for_catch);
@@ -3403,7 +3404,6 @@
AppendFragment(finally_entry, for_finally);
}
}
-
// Generate code for the finally block if one exists.
if ((finally_block != NULL) && is_open()) {
EffectGraphVisitor for_finally_block(owner(), temp_index());
@@ -3544,7 +3544,8 @@
// 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.
- owner()->set_try_index((try_index - 1));
+ intptr_t outer_try_index = node->try_index();
+ owner()->set_try_index(outer_try_index);
}
BuildRestoreContext(node->context_var());
« no previous file with comments | « runtime/vm/flow_graph_builder.h ('k') | runtime/vm/il_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698