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

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 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 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 => visitInvokeDynamic(node); 294 => visitInvokeDynamic(node);
294 visitInvokeDynamicGetter(HInvokeDynamicGetter node) 295 visitInvokeDynamicGetter(HInvokeDynamicGetter node)
295 => visitInvokeDynamicField(node); 296 => visitInvokeDynamicField(node);
296 visitInvokeDynamicSetter(HInvokeDynamicSetter node) 297 visitInvokeDynamicSetter(HInvokeDynamicSetter node)
297 => visitInvokeDynamicField(node); 298 => visitInvokeDynamicField(node);
298 visitInvokeInterceptor(HInvokeInterceptor node) 299 visitInvokeInterceptor(HInvokeInterceptor node)
299 => visitInvokeStatic(node); 300 => visitInvokeStatic(node);
300 visitInvokeStatic(HInvokeStatic node) => visitInvoke(node); 301 visitInvokeStatic(HInvokeStatic node) => visitInvoke(node);
301 visitInvokeSuper(HInvokeSuper node) => visitInvoke(node); 302 visitInvokeSuper(HInvokeSuper node) => visitInvoke(node);
302 visitJump(HJump node) => visitControlFlow(node); 303 visitJump(HJump node) => visitControlFlow(node);
304 visitLazyStatic(HLazyStatic node) => visitStatic(node);
303 visitLess(HLess node) => visitRelational(node); 305 visitLess(HLess node) => visitRelational(node);
304 visitLessEqual(HLessEqual node) => visitRelational(node); 306 visitLessEqual(HLessEqual node) => visitRelational(node);
305 visitLiteralList(HLiteralList node) => visitInstruction(node); 307 visitLiteralList(HLiteralList node) => visitInstruction(node);
306 visitLocalGet(HLocalGet node) => visitFieldGet(node); 308 visitLocalGet(HLocalGet node) => visitFieldGet(node);
307 visitLocalSet(HLocalSet node) => visitFieldSet(node); 309 visitLocalSet(HLocalSet node) => visitFieldSet(node);
308 visitLocalValue(HLocalValue node) => visitInstruction(node); 310 visitLocalValue(HLocalValue node) => visitInstruction(node);
309 visitLoopBranch(HLoopBranch node) => visitConditionalBranch(node); 311 visitLoopBranch(HLoopBranch node) => visitConditionalBranch(node);
310 visitModulo(HModulo node) => visitBinaryArithmetic(node); 312 visitModulo(HModulo node) => visitBinaryArithmetic(node);
311 visitNegate(HNegate node) => visitInvokeUnary(node); 313 visitNegate(HNegate node) => visitInvokeUnary(node);
312 visitNot(HNot node) => visitInstruction(node); 314 visitNot(HNot node) => visitInstruction(node);
(...skipping 1990 matching lines...) Expand 10 before | Expand all | Expand 10 after
2303 toString() => 'static ${element.name}'; 2305 toString() => 'static ${element.name}';
2304 accept(HVisitor visitor) => visitor.visitStatic(this); 2306 accept(HVisitor visitor) => visitor.visitStatic(this);
2305 2307
2306 int gvnHashCode() => super.gvnHashCode() ^ element.hashCode(); 2308 int gvnHashCode() => super.gvnHashCode() ^ element.hashCode();
2307 int typeCode() => HInstruction.STATIC_TYPECODE; 2309 int typeCode() => HInstruction.STATIC_TYPECODE;
2308 bool typeEquals(other) => other is HStatic; 2310 bool typeEquals(other) => other is HStatic;
2309 bool dataEquals(HStatic other) => element == other.element; 2311 bool dataEquals(HStatic other) => element == other.element;
2310 bool isCodeMotionInvariant() => !element.isAssignable(); 2312 bool isCodeMotionInvariant() => !element.isAssignable();
2311 } 2313 }
2312 2314
2315 /** An [HLazyStatic] is a static that is initialized lazily at first read. */
2316 class HLazyStatic extends HStatic {
2317 HLazyStatic(Element element) : super(element);
2318
2319 void prepareGvn(HTypeMap types) {
2320 // TODO(4931): The first access has side-effects, but we afterwards we
2321 // should be able to GVN.
2322 setAllSideEffects();
2323 }
2324
2325 toString() => 'lazy static ${element.name}';
2326 accept(HVisitor visitor) => visitor.visitLazyStatic(this);
2327
2328 int typeCode() => 30;
2329 // TODO(4931): can we do better here?
2330 bool isCodeMotionInvariant() => false;
2331 }
2332
2313 class HStaticStore extends HInstruction { 2333 class HStaticStore extends HInstruction {
2314 Element element; 2334 Element element;
2315 HStaticStore(this.element, HInstruction value) : super(<HInstruction>[value]); 2335 HStaticStore(this.element, HInstruction value) : super(<HInstruction>[value]);
2316 toString() => 'static store ${element.name}'; 2336 toString() => 'static store ${element.name}';
2317 accept(HVisitor visitor) => visitor.visitStaticStore(this); 2337 accept(HVisitor visitor) => visitor.visitStaticStore(this);
2318 2338
2319 int typeCode() => HInstruction.STATIC_STORE_TYPECODE; 2339 int typeCode() => HInstruction.STATIC_STORE_TYPECODE;
2320 bool typeEquals(other) => other is HStaticStore; 2340 bool typeEquals(other) => other is HStaticStore;
2321 bool dataEquals(HStaticStore other) => element == other.element; 2341 bool dataEquals(HStaticStore other) => element == other.element;
2322 bool isJsStatement(HTypeMap types) => true; 2342 bool isJsStatement(HTypeMap types) => true;
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
2802 HBasicBlock get start => expression.start; 2822 HBasicBlock get start => expression.start;
2803 HBasicBlock get end { 2823 HBasicBlock get end {
2804 // We don't create a switch block if there are no cases. 2824 // We don't create a switch block if there are no cases.
2805 assert(!statements.isEmpty()); 2825 assert(!statements.isEmpty());
2806 return statements.last().end; 2826 return statements.last().end;
2807 } 2827 }
2808 2828
2809 bool accept(HStatementInformationVisitor visitor) => 2829 bool accept(HStatementInformationVisitor visitor) =>
2810 visitor.visitSwitchInfo(this); 2830 visitor.visitSwitchInfo(this);
2811 } 2831 }
OLDNEW
« 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