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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 27038006: Don't inline in a throw expression (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | tests/compiler/dart2js/mirrors_used_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/ssa/builder.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
index c77c730db9709c78b09173aa2b93889cfee5ec5e..d0f2f48610764b7140fea47f01d1e98f818a5709 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
@@ -913,6 +913,11 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
*/
bool isReachable = true;
+ /**
+ * True if we are visiting the expression of a throw expression.
+ */
+ bool inThrowExpression = false;
+
final List<Element> sourceElementStack;
Element get currentElement => sourceElementStack.last.declaration;
@@ -1313,6 +1318,8 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
if (cachedCanBeInlined == true) return cachedCanBeInlined;
+ if (inThrowExpression) return false;
+
int numParameters = function.functionSignature.parameterCount;
int maxInliningNodes;
if (insideLoop) {
@@ -2060,11 +2067,21 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
compiler.internalError('visitClassNode should not be called', node: node);
}
+ visitThrowExpression(Expression expression) {
+ bool old = inThrowExpression;
+ try {
+ inThrowExpression = true;
+ visit(expression);
+ } finally {
+ inThrowExpression = old;
+ }
+ }
+
visitExpressionStatement(ExpressionStatement node) {
if (!isReachable) return;
Throw throwExpression = node.expression.asThrow();
if (throwExpression != null && inliningStack.isEmpty) {
- visit(throwExpression.expression);
+ visitThrowExpression(throwExpression.expression);
handleInTryStatement();
closeAndGotoExit(new HThrow(pop()));
} else {
@@ -4319,7 +4336,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
}
visitThrow(Throw node) {
- visit(node.expression);
+ visitThrowExpression(node.expression);
if (isReachable) {
handleInTryStatement();
push(new HThrowExpression(pop()));
« no previous file with comments | « no previous file | tests/compiler/dart2js/mirrors_used_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698