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

Unified Diff: pkg/compiler/lib/src/js_backend/codegen/codegen.dart

Issue 1476293003: dart2js cps: Emit 'return' after throwing call to assist VM analysis. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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: pkg/compiler/lib/src/js_backend/codegen/codegen.dart
diff --git a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
index bcf09683b88188eb9cd796c250bc132d3264e51d..a244edab913613caab31e8e6968ae3bc084ac137 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
@@ -533,9 +533,14 @@ class CodeGenerator extends tree_ir.StatementVisitor
@override
void visitExpressionStatement(tree_ir.ExpressionStatement node) {
- accumulator.add(new js.ExpressionStatement(
- visitExpression(node.expression)));
- visitStatement(node.next);
+ js.Expression exp = visitExpression(node.expression);
+ if (node.next is tree_ir.Unreachable) {
sra1 2015/11/30 18:59:40 Can we tell if the unreachable code is not conditi
asgerf 2015/12/01 12:40:20 The easy fix was to look at the fallthrough stack,
+ // Emit as 'return exp' to assist local analysis in the VM.
+ accumulator.add(new js.Return(exp));
+ } else {
+ accumulator.add(new js.ExpressionStatement(exp));
+ visitStatement(node.next);
+ }
}
@override
@@ -682,8 +687,8 @@ class CodeGenerator extends tree_ir.StatementVisitor
@override
void visitUnreachable(tree_ir.Unreachable node) {
- // Output nothing.
- // TODO(asgerf): Emit a throw/return to assist local analysis in the VM?
+ // Emit a return to assist local analysis in the VM.
+ accumulator.add(new js.Return());
}
@override
« 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