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 library ssa; | 5 library ssa; |
6 | 6 |
7 import '../common/codegen.dart' show CodegenWorkItem, CodegenRegistry; | 7 import '../common/codegen.dart' show CodegenWorkItem, CodegenRegistry; |
8 import '../common/tasks.dart' show CompilerTask, Measurer; | 8 import '../common/tasks.dart' show CompilerTask, Measurer; |
9 import '../constants/values.dart'; | 9 import '../constants/values.dart'; |
10 import '../elements/elements.dart' show MethodElement; | 10 import '../elements/elements.dart' show MethodElement; |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 /// Generates JavaScript code for `work.element`. | 40 /// Generates JavaScript code for `work.element`. |
41 /// Using the ssa builder, optimizer and codegenerator. | 41 /// Using the ssa builder, optimizer and codegenerator. |
42 js.Fun compile(CodegenWorkItem work, ClosedWorld closedWorld) { | 42 js.Fun compile(CodegenWorkItem work, ClosedWorld closedWorld) { |
43 HGraph graph = _builder.build(work, closedWorld); | 43 HGraph graph = _builder.build(work, closedWorld); |
44 if (graph == null) return null; | 44 if (graph == null) return null; |
45 optimizer.optimize(work, graph, closedWorld); | 45 optimizer.optimize(work, graph, closedWorld); |
46 MemberEntity element = work.element; | 46 MemberEntity element = work.element; |
47 js.Expression result = generator.generateCode(work, graph, closedWorld); | 47 js.Expression result = generator.generateCode(work, graph, closedWorld); |
48 if (element is MethodElement) { | 48 if (element is MethodElement) { |
49 // TODO(sigmund): replace by kernel transformer when `useKernel` is true. | 49 // TODO(sigmund): replace by kernel transformer when `useKernelInSsa` is |
| 50 // true. |
50 result = | 51 result = |
51 backend.rewriteAsync(closedWorld.commonElements, element, result); | 52 backend.rewriteAsync(closedWorld.commonElements, element, result); |
52 } | 53 } |
53 return result; | 54 return result; |
54 } | 55 } |
55 | 56 |
56 Iterable<CompilerTask> get tasks { | 57 Iterable<CompilerTask> get tasks { |
57 return <CompilerTask>[_builder, optimizer, generator]; | 58 return <CompilerTask>[_builder, optimizer, generator]; |
58 } | 59 } |
59 } | 60 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // the static variable. | 118 // the static variable. |
118 // We also need to register the use of the cyclic-error helper. | 119 // We also need to register the use of the cyclic-error helper. |
119 registry.worldImpact.registerStaticUse(new StaticUse.staticInvoke( | 120 registry.worldImpact.registerStaticUse(new StaticUse.staticInvoke( |
120 closedWorld.commonElements.cyclicThrowHelper, | 121 closedWorld.commonElements.cyclicThrowHelper, |
121 CallStructure.ONE_ARG)); | 122 CallStructure.ONE_ARG)); |
122 } | 123 } |
123 } | 124 } |
124 return false; | 125 return false; |
125 } | 126 } |
126 } | 127 } |
OLD | NEW |