| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import '../common/codegen.dart' show CodegenWorkItem; | 5 import '../common/codegen.dart' show CodegenWorkItem; |
| 6 import '../common/tasks.dart' show CompilerTask; | 6 import '../common/tasks.dart' show CompilerTask; |
| 7 import '../compiler.dart' show Compiler; | 7 import '../compiler.dart' show Compiler; |
| 8 import '../constants/constant_system.dart'; | 8 import '../constants/constant_system.dart'; |
| 9 import '../constants/values.dart'; | 9 import '../constants/values.dart'; |
| 10 import '../core_types.dart' show CoreClasses; | 10 import '../core_types.dart' show CoreClasses; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 abstract class OptimizationPhase { | 30 abstract class OptimizationPhase { |
| 31 String get name; | 31 String get name; |
| 32 void visitGraph(HGraph graph); | 32 void visitGraph(HGraph graph); |
| 33 } | 33 } |
| 34 | 34 |
| 35 class SsaOptimizerTask extends CompilerTask { | 35 class SsaOptimizerTask extends CompilerTask { |
| 36 final JavaScriptBackend backend; | 36 final JavaScriptBackend backend; |
| 37 SsaOptimizerTask(JavaScriptBackend backend) | 37 SsaOptimizerTask(JavaScriptBackend backend) |
| 38 : this.backend = backend, | 38 : this.backend = backend, |
| 39 super(backend.compiler); | 39 super(backend.compiler.measurer); |
| 40 String get name => 'SSA optimizer'; | 40 String get name => 'SSA optimizer'; |
| 41 Compiler get compiler => backend.compiler; | 41 Compiler get compiler => backend.compiler; |
| 42 Map<HInstruction, Range> ranges = <HInstruction, Range>{}; | 42 Map<HInstruction, Range> ranges = <HInstruction, Range>{}; |
| 43 | 43 |
| 44 void optimize(CodegenWorkItem work, HGraph graph) { | 44 void optimize(CodegenWorkItem work, HGraph graph) { |
| 45 void runPhase(OptimizationPhase phase) { | 45 void runPhase(OptimizationPhase phase) { |
| 46 measureSubtask(phase.name, () => phase.visitGraph(graph)); | 46 measureSubtask(phase.name, () => phase.visitGraph(graph)); |
| 47 compiler.tracer.traceGraph(phase.name, graph); | 47 compiler.tracer.traceGraph(phase.name, graph); |
| 48 assert(graph.isValid()); | 48 assert(graph.isValid()); |
| 49 } | 49 } |
| (...skipping 2331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2381 | 2381 |
| 2382 keyedValues.forEach((receiver, values) { | 2382 keyedValues.forEach((receiver, values) { |
| 2383 result.keyedValues[receiver] = | 2383 result.keyedValues[receiver] = |
| 2384 new Map<HInstruction, HInstruction>.from(values); | 2384 new Map<HInstruction, HInstruction>.from(values); |
| 2385 }); | 2385 }); |
| 2386 | 2386 |
| 2387 result.nonEscapingReceivers.addAll(nonEscapingReceivers); | 2387 result.nonEscapingReceivers.addAll(nonEscapingReceivers); |
| 2388 return result; | 2388 return result; |
| 2389 } | 2389 } |
| 2390 } | 2390 } |
| OLD | NEW |