Chromium Code Reviews| Index: pkg/compiler/lib/src/cps_ir/eagerly_load_statics.dart |
| diff --git a/pkg/compiler/lib/src/cps_ir/eagerly_load_statics.dart b/pkg/compiler/lib/src/cps_ir/eagerly_load_statics.dart |
| index 6f733e31f02e5df72ad70f907d39342804537361..42a33593e8552491db5ce9c31e9ead8cda5f4e73 100644 |
| --- a/pkg/compiler/lib/src/cps_ir/eagerly_load_statics.dart |
| +++ b/pkg/compiler/lib/src/cps_ir/eagerly_load_statics.dart |
| @@ -7,6 +7,7 @@ library dart2js.cps_ir.eagerly_load_statics; |
| import 'cps_ir_nodes.dart'; |
| import 'optimizers.dart' show Pass; |
| import '../elements/elements.dart'; |
| +import 'cps_fragment.dart'; |
| /// Replaces [GetLazyStatic] with [GetStatic] when the static field is known |
| /// to have been initialized. |
| @@ -30,6 +31,12 @@ class EagerlyLoadStatics extends TrampolineRecursiveVisitor implements Pass { |
| visit(node.body); |
| } |
| + Expression traverseLetPrim(LetPrim node) { |
|
Siggi Cherem (dart-lang)
2016/02/17 20:53:23
seems that this file change is unrelated to the re
asgerf
2016/02/29 12:48:17
It's not unrelated.
It is meant to copy over of t
|
| + Expression next = node.body; |
| + visit(node.primitive); |
| + return next; |
| + } |
| + |
| Expression traverseLetCont(LetCont node) { |
| for (Continuation cont in node.continuations) { |
| initializersAt[cont] = cloneFieldMap(initializerFor); |
| @@ -51,10 +58,13 @@ class EagerlyLoadStatics extends TrampolineRecursiveVisitor implements Pass { |
| void visitGetLazyStatic(GetLazyStatic node) { |
| Primitive initializer = initializerFor[node.element]; |
| - if (initializer != null) { |
| - GetStatic newNode = new GetStatic.witnessed(node.element, initializer, |
| - node.sourceInformation); |
| - newNode.type = node.type; |
| + if (initializer is GetLazyStatic && initializer.isFinal) { |
| + // No reason to create a GetStatic when the field is final. |
| + node.replaceWithFragment(new CpsFragment(), initializer); |
| + } else if (initializer != null) { |
| + GetStatic newNode = new GetStatic.witnessed(node.element, |
| + initializer, node.sourceInformation) |
| + ..type = node.type; |
| node.replaceWith(newNode); |
| } else { |
| initializerFor[node.element] = node; |