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

Side by Side 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 wrt CL 10832351. Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 interface HVisitor<R> { 5 interface HVisitor<R> {
6 R visitAdd(HAdd node); 6 R visitAdd(HAdd node);
7 R visitBailoutTarget(HBailoutTarget node); 7 R visitBailoutTarget(HBailoutTarget node);
8 R visitBitAnd(HBitAnd node); 8 R visitBitAnd(HBitAnd node);
9 R visitBitNot(HBitNot node); 9 R visitBitNot(HBitNot node);
10 R visitBitOr(HBitOr node); 10 R visitBitOr(HBitOr node);
(...skipping 19 matching lines...) Expand all
30 R visitIndexAssign(HIndexAssign node); 30 R visitIndexAssign(HIndexAssign node);
31 R visitIntegerCheck(HIntegerCheck node); 31 R visitIntegerCheck(HIntegerCheck node);
32 R visitInvokeClosure(HInvokeClosure node); 32 R visitInvokeClosure(HInvokeClosure node);
33 R visitInvokeDynamicGetter(HInvokeDynamicGetter node); 33 R visitInvokeDynamicGetter(HInvokeDynamicGetter node);
34 R visitInvokeDynamicMethod(HInvokeDynamicMethod node); 34 R visitInvokeDynamicMethod(HInvokeDynamicMethod node);
35 R visitInvokeDynamicSetter(HInvokeDynamicSetter node); 35 R visitInvokeDynamicSetter(HInvokeDynamicSetter node);
36 R visitInvokeInterceptor(HInvokeInterceptor node); 36 R visitInvokeInterceptor(HInvokeInterceptor node);
37 R visitInvokeStatic(HInvokeStatic node); 37 R visitInvokeStatic(HInvokeStatic node);
38 R visitInvokeSuper(HInvokeSuper node); 38 R visitInvokeSuper(HInvokeSuper node);
39 R visitIs(HIs node); 39 R visitIs(HIs node);
40 R visitLazyStatic(HLazyStatic node);
40 R visitLess(HLess node); 41 R visitLess(HLess node);
41 R visitLessEqual(HLessEqual node); 42 R visitLessEqual(HLessEqual node);
42 R visitLiteralList(HLiteralList node); 43 R visitLiteralList(HLiteralList node);
43 R visitLocalGet(HLocalGet node); 44 R visitLocalGet(HLocalGet node);
44 R visitLocalSet(HLocalSet node); 45 R visitLocalSet(HLocalSet node);
45 R visitLocalValue(HLocalValue node); 46 R visitLocalValue(HLocalValue node);
46 R visitLoopBranch(HLoopBranch node); 47 R visitLoopBranch(HLoopBranch node);
47 R visitModulo(HModulo node); 48 R visitModulo(HModulo node);
48 R visitMultiply(HMultiply node); 49 R visitMultiply(HMultiply node);
49 R visitNegate(HNegate node); 50 R visitNegate(HNegate node);
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 => visitInvokeDynamic(node); 290 => visitInvokeDynamic(node);
290 visitInvokeDynamicGetter(HInvokeDynamicGetter node) 291 visitInvokeDynamicGetter(HInvokeDynamicGetter node)
291 => visitInvokeDynamicField(node); 292 => visitInvokeDynamicField(node);
292 visitInvokeDynamicSetter(HInvokeDynamicSetter node) 293 visitInvokeDynamicSetter(HInvokeDynamicSetter node)
293 => visitInvokeDynamicField(node); 294 => visitInvokeDynamicField(node);
294 visitInvokeInterceptor(HInvokeInterceptor node) 295 visitInvokeInterceptor(HInvokeInterceptor node)
295 => visitInvokeStatic(node); 296 => visitInvokeStatic(node);
296 visitInvokeStatic(HInvokeStatic node) => visitInvoke(node); 297 visitInvokeStatic(HInvokeStatic node) => visitInvoke(node);
297 visitInvokeSuper(HInvokeSuper node) => visitInvoke(node); 298 visitInvokeSuper(HInvokeSuper node) => visitInvoke(node);
298 visitJump(HJump node) => visitControlFlow(node); 299 visitJump(HJump node) => visitControlFlow(node);
300 visitLazyStatic(HLazyStatic node) => visitStatic(node);
299 visitLess(HLess node) => visitRelational(node); 301 visitLess(HLess node) => visitRelational(node);
300 visitLessEqual(HLessEqual node) => visitRelational(node); 302 visitLessEqual(HLessEqual node) => visitRelational(node);
301 visitLiteralList(HLiteralList node) => visitInstruction(node); 303 visitLiteralList(HLiteralList node) => visitInstruction(node);
302 visitLocalGet(HLocalGet node) => visitFieldGet(node); 304 visitLocalGet(HLocalGet node) => visitFieldGet(node);
303 visitLocalSet(HLocalSet node) => visitFieldSet(node); 305 visitLocalSet(HLocalSet node) => visitFieldSet(node);
304 visitLocalValue(HLocalValue node) => visitInstruction(node); 306 visitLocalValue(HLocalValue node) => visitInstruction(node);
305 visitLoopBranch(HLoopBranch node) => visitConditionalBranch(node); 307 visitLoopBranch(HLoopBranch node) => visitConditionalBranch(node);
306 visitModulo(HModulo node) => visitBinaryArithmetic(node); 308 visitModulo(HModulo node) => visitBinaryArithmetic(node);
307 visitNegate(HNegate node) => visitInvokeUnary(node); 309 visitNegate(HNegate node) => visitInvokeUnary(node);
308 visitNot(HNot node) => visitInstruction(node); 310 visitNot(HNot node) => visitInstruction(node);
(...skipping 1936 matching lines...) Expand 10 before | Expand all | Expand 10 after
2245 toString() => 'static ${element.name}'; 2247 toString() => 'static ${element.name}';
2246 accept(HVisitor visitor) => visitor.visitStatic(this); 2248 accept(HVisitor visitor) => visitor.visitStatic(this);
2247 2249
2248 int gvnHashCode() => super.gvnHashCode() ^ element.hashCode(); 2250 int gvnHashCode() => super.gvnHashCode() ^ element.hashCode();
2249 int typeCode() => 25; 2251 int typeCode() => 25;
2250 bool typeEquals(other) => other is HStatic; 2252 bool typeEquals(other) => other is HStatic;
2251 bool dataEquals(HStatic other) => element == other.element; 2253 bool dataEquals(HStatic other) => element == other.element;
2252 bool isCodeMotionInvariant() => !element.isAssignable(); 2254 bool isCodeMotionInvariant() => !element.isAssignable();
2253 } 2255 }
2254 2256
2257 /** An [HLazyStatic] is a static that is initialized lazily at first read. */
2258 class HLazyStatic extends HStatic {
2259 HLazyStatic(Element element) : super(element);
2260
2261 void prepareGvn(HTypeMap types) {
2262 // TODO: The first access has side-effects, but we afterwards we should be
2263 // able to GVN.
2264 setAllSideEffects();
kasperl 2012/08/17 09:30:04 Can't you just enable GVN for the lazy-static and
floitsch 2012/09/04 17:32:21 I tried, but iirc there are some assumptions and a
2265 }
2266
2267 toString() => 'lazy static ${element.name}';
2268 accept(HVisitor visitor) => visitor.visitLazyStatic(this);
2269
2270 int typeCode() => 30;
2271 // TODO(floitsch): can we do better here?
2272 bool isCodeMotionInvariant() => false;
2273 }
2274
2255 class HStaticStore extends HInstruction { 2275 class HStaticStore extends HInstruction {
2256 Element element; 2276 Element element;
2257 HStaticStore(this.element, HInstruction value) : super(<HInstruction>[value]); 2277 HStaticStore(this.element, HInstruction value) : super(<HInstruction>[value]);
2258 toString() => 'static store ${element.name}'; 2278 toString() => 'static store ${element.name}';
2259 accept(HVisitor visitor) => visitor.visitStaticStore(this); 2279 accept(HVisitor visitor) => visitor.visitStaticStore(this);
2260 2280
2261 int typeCode() => 26; 2281 int typeCode() => 26;
2262 bool typeEquals(other) => other is HStaticStore; 2282 bool typeEquals(other) => other is HStaticStore;
2263 bool dataEquals(HStaticStore other) => element == other.element; 2283 bool dataEquals(HStaticStore other) => element == other.element;
2264 bool isStatement(HTypeMap types) => true; 2284 bool isStatement(HTypeMap types) => true;
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
2742 HBasicBlock get start() => expression.start; 2762 HBasicBlock get start() => expression.start;
2743 HBasicBlock get end() { 2763 HBasicBlock get end() {
2744 // We don't create a switch block if there are no cases. 2764 // We don't create a switch block if there are no cases.
2745 assert(!statements.isEmpty()); 2765 assert(!statements.isEmpty());
2746 return statements.last().end; 2766 return statements.last().end;
2747 } 2767 }
2748 2768
2749 bool accept(HStatementInformationVisitor visitor) => 2769 bool accept(HStatementInformationVisitor visitor) =>
2750 visitor.visitSwitchInfo(this); 2770 visitor.visitSwitchInfo(this);
2751 } 2771 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698