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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/optimizers.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.optimizers; 5 library dart2js.cps_ir.optimizers;
6 6
7 import '../constants/expressions.dart' show 7 import '../constants/expressions.dart' show
8 ConstantExpression, 8 ConstantExpression,
9 PrimitiveConstantExpression; 9 PrimitiveConstantExpression;
10 import '../constants/values.dart'; 10 import '../constants/values.dart';
11 import '../dart_types.dart' as types; 11 import '../dart_types.dart' as types;
12 import '../dart2jslib.dart' as dart2js; 12 import '../dart2jslib.dart' as dart2js;
13 import '../tree/tree.dart' show LiteralDartString; 13 import '../tree/tree.dart' show LiteralDartString;
14 import '../util/util.dart'; 14 import '../util/util.dart';
15 import 'cps_ir_nodes.dart'; 15 import 'cps_ir_nodes.dart';
16 16
17 part 'constant_propagation.dart'; 17 part 'constant_propagation.dart';
18 part 'redundant_phi.dart'; 18 part 'redundant_phi.dart';
19 part 'shrinking_reductions.dart'; 19 part 'shrinking_reductions.dart';
20 20
21 /// An optimization pass over the CPS IR. 21 /// An optimization pass over the CPS IR.
22 abstract class Pass { 22 abstract class Pass {
23 /// Applies optimizations to root, rewriting it in the process. 23 /// Applies optimizations to root, rewriting it in the process.
24 void rewrite(ExecutableDefinition root) => root.applyPass(this); 24 void rewrite(ExecutableDefinition root) => root.applyPass(this);
25
26 void rewriteConstructorDefinition(ConstructorDefinition root);
27 void rewriteFunctionDefinition(FunctionDefinition root);
28 void rewriteFieldDefinition(FieldDefinition root);
29 }
30
31 abstract class PassMixin implements Pass {
32 void rewrite(ExecutableDefinition root) => root.applyPass(this);
33
34 void rewriteExecutableDefinition(ExecutableDefinition root);
35
25 void rewriteFunctionDefinition(FunctionDefinition root) { 36 void rewriteFunctionDefinition(FunctionDefinition root) {
26 return root.applyPass(this); 37 if (root.isAbstract) return;
38 rewriteExecutableDefinition(root);
39 }
40
41 void rewriteConstructorDefinition(ConstructorDefinition root) {
42 if (root.isAbstract) return;
43 rewriteExecutableDefinition(root);
27 } 44 }
28 void rewriteFieldDefinition(FieldDefinition root) { 45 void rewriteFieldDefinition(FieldDefinition root) {
29 return root.applyPass(this); 46 if (!root.hasInitializer) return;
47 rewriteExecutableDefinition(root);
30 } 48 }
31 } 49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698