Chromium Code Reviews| Index: lib/compiler/implementation/ssa/nodes.dart |
| diff --git a/lib/compiler/implementation/ssa/nodes.dart b/lib/compiler/implementation/ssa/nodes.dart |
| index 1e0db24303e6a169451afcc091a5342f1cf540e6..c65bf0819b546fe2857742cbcc235fc04b1e7122 100644 |
| --- a/lib/compiler/implementation/ssa/nodes.dart |
| +++ b/lib/compiler/implementation/ssa/nodes.dart |
| @@ -37,6 +37,7 @@ interface HVisitor<R> { |
| R visitInvokeStatic(HInvokeStatic node); |
| R visitInvokeSuper(HInvokeSuper node); |
| R visitIs(HIs node); |
| + R visitLazyStatic(HLazyStatic node); |
| R visitLess(HLess node); |
| R visitLessEqual(HLessEqual node); |
| R visitLiteralList(HLiteralList node); |
| @@ -297,6 +298,7 @@ class HBaseVisitor extends HGraphVisitor implements HVisitor { |
| visitInvokeStatic(HInvokeStatic node) => visitInvoke(node); |
| visitInvokeSuper(HInvokeSuper node) => visitInvoke(node); |
| visitJump(HJump node) => visitControlFlow(node); |
| + visitLazyStatic(HLazyStatic node) => visitStatic(node); |
| visitLess(HLess node) => visitRelational(node); |
| visitLessEqual(HLessEqual node) => visitRelational(node); |
| visitLiteralList(HLiteralList node) => visitInstruction(node); |
| @@ -2307,6 +2309,24 @@ class HStatic extends HInstruction { |
| bool isCodeMotionInvariant() => !element.isAssignable(); |
| } |
| +/** An [HLazyStatic] is a static that is initialized lazily at first read. */ |
| +class HLazyStatic extends HStatic { |
| + HLazyStatic(Element element) : super(element); |
| + |
| + void prepareGvn(HTypeMap types) { |
| + // TODO: The first access has side-effects, but we afterwards we should be |
|
kasperl
2012/09/05 08:25:24
File a bug for this? Milestone-Later.
floitsch
2012/09/05 09:31:07
done (issue 4931).
|
| + // able to GVN. |
| + setAllSideEffects(); |
| + } |
| + |
| + toString() => 'lazy static ${element.name}'; |
| + accept(HVisitor visitor) => visitor.visitLazyStatic(this); |
| + |
| + int typeCode() => 30; |
| + // TODO(floitsch): can we do better here? |
|
kasperl
2012/09/05 08:25:24
Maybe track this with the same bug.
floitsch
2012/09/05 09:31:07
ditto.
|
| + bool isCodeMotionInvariant() => false; |
| +} |
| + |
| class HStaticStore extends HInstruction { |
| Element element; |
| HStaticStore(this.element, HInstruction value) : super(<HInstruction>[value]); |