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 part of ssa; | 5 part of ssa; |
6 | 6 |
7 abstract class HVisitor<R> { | 7 abstract class HVisitor<R> { |
8 R visitAdd(HAdd node); | 8 R visitAdd(HAdd node); |
9 R visitBailoutTarget(HBailoutTarget node); | 9 R visitBailoutTarget(HBailoutTarget node); |
10 R visitBitAnd(HBitAnd node); | 10 R visitBitAnd(HBitAnd node); |
(...skipping 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2364 accept(HVisitor visitor) => visitor.visitStatic(this); | 2364 accept(HVisitor visitor) => visitor.visitStatic(this); |
2365 | 2365 |
2366 int gvnHashCode() => super.gvnHashCode() ^ element.hashCode; | 2366 int gvnHashCode() => super.gvnHashCode() ^ element.hashCode; |
2367 int typeCode() => HInstruction.STATIC_TYPECODE; | 2367 int typeCode() => HInstruction.STATIC_TYPECODE; |
2368 bool typeEquals(other) => other is HStatic; | 2368 bool typeEquals(other) => other is HStatic; |
2369 bool dataEquals(HStatic other) => element == other.element; | 2369 bool dataEquals(HStatic other) => element == other.element; |
2370 bool isCodeMotionInvariant() => !element.isAssignable(); | 2370 bool isCodeMotionInvariant() => !element.isAssignable(); |
2371 } | 2371 } |
2372 | 2372 |
2373 class HInterceptor extends HInstruction { | 2373 class HInterceptor extends HInstruction { |
2374 final Set<ClassElement> interceptedClasses; | 2374 Set<ClassElement> interceptedClasses; |
2375 HInterceptor(this.interceptedClasses, HInstruction receiver) | 2375 HInterceptor(this.interceptedClasses, HInstruction receiver) |
2376 : super(<HInstruction>[receiver]); | 2376 : super(<HInstruction>[receiver]); |
2377 String toString() => 'interceptor on $interceptedClasses'; | 2377 String toString() => 'interceptor on $interceptedClasses'; |
2378 accept(HVisitor visitor) => visitor.visitInterceptor(this); | 2378 accept(HVisitor visitor) => visitor.visitInterceptor(this); |
2379 HInstruction get receiver => inputs[0]; | 2379 HInstruction get receiver => inputs[0]; |
2380 | 2380 |
2381 void prepareGvn(HTypeMap types) { | 2381 void prepareGvn(HTypeMap types) { |
2382 clearAllSideEffects(); | 2382 clearAllSideEffects(); |
2383 setUseGvn(); | 2383 setUseGvn(); |
2384 } | 2384 } |
2385 | 2385 |
2386 int typeCode() => HInstruction.INTERCEPTOR_TYPECODE; | 2386 int typeCode() => HInstruction.INTERCEPTOR_TYPECODE; |
2387 bool typeEquals(other) => other is HInterceptor; | 2387 bool typeEquals(other) => other is HInterceptor; |
| 2388 bool dataEquals(HInterceptor other) { |
| 2389 return interceptedClasses == other.interceptedClasses |
| 2390 || (interceptedClasses.length == other.interceptedClasses.length |
| 2391 && interceptedClasses.containsAll(other.interceptedClasses)); |
| 2392 } |
2388 } | 2393 } |
2389 | 2394 |
2390 /** An [HLazyStatic] is a static that is initialized lazily at first read. */ | 2395 /** An [HLazyStatic] is a static that is initialized lazily at first read. */ |
2391 class HLazyStatic extends HStatic { | 2396 class HLazyStatic extends HStatic { |
2392 HLazyStatic(Element element) : super(element); | 2397 HLazyStatic(Element element) : super(element); |
2393 | 2398 |
2394 void prepareGvn(HTypeMap types) { | 2399 void prepareGvn(HTypeMap types) { |
2395 // TODO(4931): The first access has side-effects, but we afterwards we | 2400 // TODO(4931): The first access has side-effects, but we afterwards we |
2396 // should be able to GVN. | 2401 // should be able to GVN. |
2397 setAllSideEffects(); | 2402 setAllSideEffects(); |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2935 HBasicBlock get start => expression.start; | 2940 HBasicBlock get start => expression.start; |
2936 HBasicBlock get end { | 2941 HBasicBlock get end { |
2937 // We don't create a switch block if there are no cases. | 2942 // We don't create a switch block if there are no cases. |
2938 assert(!statements.isEmpty); | 2943 assert(!statements.isEmpty); |
2939 return statements.last.end; | 2944 return statements.last.end; |
2940 } | 2945 } |
2941 | 2946 |
2942 bool accept(HStatementInformationVisitor visitor) => | 2947 bool accept(HStatementInformationVisitor visitor) => |
2943 visitor.visitSwitchInfo(this); | 2948 visitor.visitSwitchInfo(this); |
2944 } | 2949 } |
OLD | NEW |