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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart

Issue 864293004: Add a shrinking reduction for dead continuation parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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
Index: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
index c9b9133343ab4e1f1fd6d4c94b38f1303ace2a74..770a90906cf5b3486e3b5431951a2acae05813ed 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
@@ -630,6 +630,12 @@ class Parameter extends Primitive {
super.hint = hint;
}
+ // In addition to a parent pointer to the containing Continuation or
+ // FunctionDefinition, parameters have an index into the list of parameters
+ // bound by the parent. This gives constant-time access to the continuation from
asgerf 2015/01/22 16:02:07 long line
Kevin Millikin (Google) 2015/01/22 16:16:28 You are right. Fixed.
+ // the parent.
+ int parent_index;
+
accept(Visitor visitor) => visitor.visitParameter(this);
}
@@ -680,7 +686,7 @@ class FieldDefinition extends Node implements ExecutableDefinition {
/// `true` if this field has no initializer.
///
- /// If `true` [body] and [returnContinuation] are `null`.
+ /// If `true` [body] is `null`.
///
/// This is different from a initializer that is `null`. Consider this class:
///
@@ -717,7 +723,7 @@ class RunnableBody extends InteriorNode {
}
/// A function definition, consisting of parameters and a body. The parameters
-/// include a distinguished continuation parameter.
+/// include a distinguished continuation parameter (held by the body).
class FunctionDefinition extends Node
implements ExecutableDefinition {
final FunctionElement element;
@@ -751,8 +757,7 @@ class FunctionDefinition extends Node
/// Returns `true` if this function is abstract or external.
///
- /// If `true`, [body] and [returnContinuation] are `null` and [localConstants]
- /// is empty.
+ /// If `true`, [body] is `null` and [localConstants] is empty.
bool get isAbstract => body == null;
}
@@ -884,6 +889,7 @@ abstract class RecursiveVisitor extends Visitor {
processRunnableBody(RunnableBody node) {}
visitRunnableBody(RunnableBody node) {
processRunnableBody(node);
+ visit(node.returnContinuation);
visit(node.body);
}
@@ -1063,7 +1069,7 @@ abstract class RecursiveVisitor extends Visitor {
visitContinuation(Continuation node) {
processContinuation(node);
node.parameters.forEach(visitParameter);
- visit(node.body);
+ if (node.body != null) visit(node.body);
}
// Conditions.

Powered by Google App Engine
This is Rietveld 408576698