Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(584)

Unified Diff: lib/compiler/implementation/ssa/nodes.dart

Issue 10855174: Lazy implementation of final variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase and merge. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | lib/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/nodes.dart
diff --git a/lib/compiler/implementation/ssa/nodes.dart b/lib/compiler/implementation/ssa/nodes.dart
index b49abfefcb4fd0444fecc8cfb4611bc6c5ad9830..938d4c3732f9e7f73d899547331c8d537aec2876 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);
@@ -300,6 +301,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);
@@ -2310,6 +2312,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(4931): The first access has side-effects, but we afterwards we
+ // should be able to GVN.
+ setAllSideEffects();
+ }
+
+ toString() => 'lazy static ${element.name}';
+ accept(HVisitor visitor) => visitor.visitLazyStatic(this);
+
+ int typeCode() => 30;
+ // TODO(4931): can we do better here?
+ bool isCodeMotionInvariant() => false;
+}
+
class HStaticStore extends HInstruction {
Element element;
HStaticStore(this.element, HInstruction value) : super(<HInstruction>[value]);
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | lib/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698