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