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

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

Issue 787603003: Generative constructors in the new dart backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 6 years 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/constant_propagation.dart
diff --git a/pkg/compiler/lib/src/cps_ir/constant_propagation.dart b/pkg/compiler/lib/src/cps_ir/constant_propagation.dart
index c9adf089d055cb93124b59faaef4fa3db00dd64e..1bab9ddb2c575101df64fc502ee9ebe360b2924c 100644
--- a/pkg/compiler/lib/src/cps_ir/constant_propagation.dart
+++ b/pkg/compiler/lib/src/cps_ir/constant_propagation.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-part of dart2js.optimizers;
+part of dart2js.cps_ir.optimizers;
/**
* Propagates constants throughout the IR, and replaces branches with fixed
@@ -12,7 +12,7 @@ part of dart2js.optimizers;
* Implemented according to 'Constant Propagation with Conditional Branches'
* by Wegman, Zadeck.
*/
-class ConstantPropagator extends Pass {
+class ConstantPropagator extends PassMixin {
// Required for type determination in analysis of TypeOperator expressions.
final dart2js.Compiler _compiler;
@@ -23,7 +23,8 @@ class ConstantPropagator extends Pass {
ConstantPropagator(this._compiler, this._constantSystem);
- void _rewriteExecutableDefinition(ExecutableDefinition root) {
+ @override
+ void rewriteExecutableDefinition(ExecutableDefinition root) {
// Set all parent pointers.
new ParentVisitor().visit(root);
@@ -43,16 +44,6 @@ class ConstantPropagator extends Pass {
transformer.transform(root);
}
- void rewriteFunctionDefinition(FunctionDefinition root) {
- if (root.isAbstract) return;
- _rewriteExecutableDefinition(root);
- }
-
- void rewriteFieldDefinition(FieldDefinition root) {
- if (!root.hasInitializer) return;
- _rewriteExecutableDefinition(root);
- }
-
}
/**
@@ -307,6 +298,10 @@ class _ConstPropagationVisitor extends Visitor {
"_ConstPropagationVisitor is stale, add missing visit overrides");
}
+ void visitRunnableBody(RunnableBody node) {
+ setReachable(node.body);
+ }
+
void visitFunctionDefinition(FunctionDefinition node) {
node.parameters.forEach(visit);
setReachable(node.body);
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart » ('j') | pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698