| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library dart2js.cps_ir.scalar_replacement; | 4 library dart2js.cps_ir.scalar_replacement; |
| 5 | 5 |
| 6 import 'optimizers.dart'; | 6 import 'optimizers.dart'; |
| 7 | 7 |
| 8 import 'dart:collection' show Queue; | 8 import 'dart:collection' show Queue; |
| 9 | 9 |
| 10 import '../closure.dart' show | 10 import '../closure.dart' show |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 * Replaces aggregates with a set of local values. Performs inlining of | 36 * Replaces aggregates with a set of local values. Performs inlining of |
| 37 * single-use closures to generate more replacable aggregates. | 37 * single-use closures to generate more replacable aggregates. |
| 38 */ | 38 */ |
| 39 class ScalarReplacer extends Pass { | 39 class ScalarReplacer extends Pass { |
| 40 String get passName => 'Scalar replacement'; | 40 String get passName => 'Scalar replacement'; |
| 41 | 41 |
| 42 final dart2js.InternalErrorFunction _internalError; | 42 final dart2js.InternalErrorFunction _internalError; |
| 43 final World _classWorld; | 43 final World _classWorld; |
| 44 | 44 |
| 45 ScalarReplacer(dart2js.Compiler compiler) | 45 ScalarReplacer(dart2js.Compiler compiler) |
| 46 : _internalError = compiler.internalError, | 46 : _internalError = compiler.reporter.internalError, |
| 47 _classWorld = compiler.world; | 47 _classWorld = compiler.world; |
| 48 | 48 |
| 49 @override | 49 @override |
| 50 void rewrite(FunctionDefinition root) { | 50 void rewrite(FunctionDefinition root) { |
| 51 // Set all parent pointers. | 51 // Set all parent pointers. |
| 52 new ParentVisitor().visit(root); | 52 new ParentVisitor().visit(root); |
| 53 ScalarReplacementVisitor analyzer = | 53 ScalarReplacementVisitor analyzer = |
| 54 new ScalarReplacementVisitor(_internalError, _classWorld); | 54 new ScalarReplacementVisitor(_internalError, _classWorld); |
| 55 analyzer.analyze(root); | 55 analyzer.analyze(root); |
| 56 analyzer.process(); | 56 analyzer.process(); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 class ScalarReplacementRemovalVisitor extends RecursiveVisitor { | 236 class ScalarReplacementRemovalVisitor extends RecursiveVisitor { |
| 237 ScalarReplacementVisitor process; | 237 ScalarReplacementVisitor process; |
| 238 | 238 |
| 239 ScalarReplacementRemovalVisitor(this.process); | 239 ScalarReplacementRemovalVisitor(this.process); |
| 240 | 240 |
| 241 processReference(Reference reference) { | 241 processReference(Reference reference) { |
| 242 process.reconsider(reference.definition); | 242 process.reconsider(reference.definition); |
| 243 reference.unlink(); | 243 reference.unlink(); |
| 244 } | 244 } |
| 245 } | 245 } |
| OLD | NEW |