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

Unified Diff: runtime/vm/kernel_to_il.cc

Issue 2528673002: VM: [Kernel] Don't emit ReturnInstr that are not connected to the graph. (Closed)
Patch Set: Created 4 years, 1 month 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/kernel_to_il.cc
diff --git a/runtime/vm/kernel_to_il.cc b/runtime/vm/kernel_to_il.cc
index ff7c1cde292c282a4af6a08576dd4a3990a73205..dedb3fd533b564ece324959071bae95ba21bde9c 100644
--- a/runtime/vm/kernel_to_il.cc
+++ b/runtime/vm/kernel_to_il.cc
@@ -4916,7 +4916,8 @@ void FlowGraphBuilder::VisitBlock(Block* node) {
instructions += EnterScope(node);
List<Statement>& statements = node->statements();
- for (intptr_t i = 0; i < statements.length(); ++i) {
+ for (intptr_t i = 0; (i < statements.length()) && instructions.is_open();
+ ++i) {
instructions += TranslateStatement(statements[i]);
}
instructions += ExitScope(node);
@@ -4931,17 +4932,19 @@ void FlowGraphBuilder::VisitReturnStatement(ReturnStatement* node) {
Fragment instructions = node->expression() == NULL
? NullConstant()
: TranslateExpression(node->expression());
- if (inside_try_finally) {
- ASSERT(scopes_->finally_return_variable != NULL);
- instructions += StoreLocal(scopes_->finally_return_variable);
- instructions += Drop();
- instructions += TranslateFinallyFinalizers(NULL, -1);
- if (instructions.is_open()) {
- instructions += LoadLocal(scopes_->finally_return_variable);
+ if (instructions.is_open()) {
+ if (inside_try_finally) {
+ ASSERT(scopes_->finally_return_variable != NULL);
+ instructions += StoreLocal(scopes_->finally_return_variable);
+ instructions += Drop();
+ instructions += TranslateFinallyFinalizers(NULL, -1);
+ if (instructions.is_open()) {
+ instructions += LoadLocal(scopes_->finally_return_variable);
+ instructions += Return();
+ }
+ } else {
instructions += Return();
}
- } else {
- instructions += Return();
}
fragment_ = instructions;
}
« 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