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

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

Issue 759193005: Add support for fields to the new dart backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase Created 6 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 | « pkg/compiler/lib/src/cps_ir/redundant_phi.dart ('k') | pkg/compiler/lib/src/dart_backend/backend.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart
diff --git a/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart b/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart
index f7f4bc11f85c3efc266f176252819e12c26571e0..46b64375a718b5d976f74e66cc012164ad02b423 100644
--- a/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart
+++ b/pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart
@@ -8,16 +8,13 @@ part of dart2js.optimizers;
* [[ShrinkingReducer]] applies shrinking reductions to CPS terms as described
* in 'Compiling with Continuations, Continued' by Andrew Kennedy.
*/
-class ShrinkingReducer implements Pass {
+class ShrinkingReducer extends Pass {
_RedexVisitor _redexVisitor;
Set<_ReductionTask> _worklist;
static final _DeletedNode _DELETED = new _DeletedNode();
- /// Applies shrinking reductions to root, mutating root in the process.
- void rewrite(FunctionDefinition root) {
- if (root.isAbstract) return;
-
+ void rewriteExecutableDefinition(ExecutableDefinition root) {
_worklist = new Set<_ReductionTask>();
_redexVisitor = new _RedexVisitor(_worklist);
@@ -25,7 +22,7 @@ class ShrinkingReducer implements Pass {
new ParentVisitor().visit(root);
// Sweep over the term, collecting redexes into the worklist.
- _redexVisitor.visitFunctionDefinition(root);
+ _redexVisitor.visit(root);
// Process the worklist.
while (_worklist.isNotEmpty) {
@@ -35,6 +32,17 @@ class ShrinkingReducer implements Pass {
}
}
+ /// Applies shrinking reductions to root, mutating root in the process.
+ void rewriteFieldDefinition(FieldDefinition root) {
+ rewriteExecutableDefinition(root);
+ }
+
+ /// Applies shrinking reductions to root, mutating root in the process.
+ void rewriteFunctionDefinition(FunctionDefinition root) {
+ if (root.isAbstract) return;
+ rewriteExecutableDefinition(root);
+ }
+
/// Removes the given node from the CPS graph, replacing it with its body
/// and marking it as deleted. The node's parent must be a [[InteriorNode]].
void _removeNode(InteriorNode node) {
@@ -295,6 +303,10 @@ class _RemovalRedexVisitor extends _RedexVisitor {
/// Traverses the CPS term and sets node.parent for each visited node.
class ParentVisitor extends RecursiveVisitor {
+ processFieldDefinition(FieldDefinition node) {
+ node.body.parent = node;
+ }
+
processFunctionDefinition(FunctionDefinition node) {
node.body.parent = node;
node.parameters.forEach((Parameter p) => p.parent = node);
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/redundant_phi.dart ('k') | pkg/compiler/lib/src/dart_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698