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

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: Fix tests. 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 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after
2224 toString() => 'static ${element.name}'; 2226 toString() => 'static ${element.name}';
2225 accept(HVisitor visitor) => visitor.visitStatic(this); 2227 accept(HVisitor visitor) => visitor.visitStatic(this);
2226 2228
2227 int gvnHashCode() => super.gvnHashCode() ^ element.hashCode(); 2229 int gvnHashCode() => super.gvnHashCode() ^ element.hashCode();
2228 int typeCode() => 25; 2230 int typeCode() => 25;
2229 bool typeEquals(other) => other is HStatic; 2231 bool typeEquals(other) => other is HStatic;
2230 bool dataEquals(HStatic other) => element == other.element; 2232 bool dataEquals(HStatic other) => element == other.element;
2231 bool isCodeMotionInvariant() => !element.isAssignable(); 2233 bool isCodeMotionInvariant() => !element.isAssignable();
2232 } 2234 }
2233 2235
2236 /** An [HLazyStatic] is a static that is initialized lazily at first read. */
2237 class HLazyStatic extends HStatic {
2238 HLazyStatic(Element element) : super(element);
2239
2240 void prepareGvn() {
2241 // TODO: The first access has side-effects, but we afterwards we should be
2242 // able to GVN.
2243 setAllSideEffects();
2244 }
2245
2246 toString() => 'lazy static ${element.name}';
2247 accept(HVisitor visitor) => visitor.visitLazyStatic(this);
2248
2249 int typeCode() => 30;
2250 // TODO(floitsch): can we do better here?
2251 bool isCodeMotionInvariant() => false;
2252 }
2253
2234 class HStaticStore extends HInstruction { 2254 class HStaticStore extends HInstruction {
2235 Element element; 2255 Element element;
2236 HStaticStore(this.element, HInstruction value) : super(<HInstruction>[value]); 2256 HStaticStore(this.element, HInstruction value) : super(<HInstruction>[value]);
2237 toString() => 'static store ${element.name}'; 2257 toString() => 'static store ${element.name}';
2238 accept(HVisitor visitor) => visitor.visitStaticStore(this); 2258 accept(HVisitor visitor) => visitor.visitStaticStore(this);
2239 2259
2240 int typeCode() => 26; 2260 int typeCode() => 26;
2241 bool typeEquals(other) => other is HStaticStore; 2261 bool typeEquals(other) => other is HStaticStore;
2242 bool dataEquals(HStaticStore other) => element == other.element; 2262 bool dataEquals(HStaticStore other) => element == other.element;
2243 final bool isStatement = true; 2263 final bool isStatement = true;
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
2716 HBasicBlock get start() => expression.start; 2736 HBasicBlock get start() => expression.start;
2717 HBasicBlock get end() { 2737 HBasicBlock get end() {
2718 // We don't create a switch block if there are no cases. 2738 // We don't create a switch block if there are no cases.
2719 assert(!statements.isEmpty()); 2739 assert(!statements.isEmpty());
2720 return statements.last().end; 2740 return statements.last().end;
2721 } 2741 }
2722 2742
2723 bool accept(HStatementInformationVisitor visitor) => 2743 bool accept(HStatementInformationVisitor visitor) =>
2724 visitor.visitSwitchInfo(this); 2744 visitor.visitSwitchInfo(this);
2725 } 2745 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698