| 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 visitBitAnd(HBitAnd node); | 9 R visitBitAnd(HBitAnd node); |
| 10 R visitBitNot(HBitNot node); | 10 R visitBitNot(HBitNot node); |
| (...skipping 2403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2414 class HIs extends HInstruction { | 2414 class HIs extends HInstruction { |
| 2415 /// A check against a raw type: 'o is int', 'o is A'. | 2415 /// A check against a raw type: 'o is int', 'o is A'. |
| 2416 static const int RAW_CHECK = 0; | 2416 static const int RAW_CHECK = 0; |
| 2417 /// A check against a type with type arguments: 'o is List<int>', 'o is C<T>'. | 2417 /// A check against a type with type arguments: 'o is List<int>', 'o is C<T>'. |
| 2418 static const int COMPOUND_CHECK = 1; | 2418 static const int COMPOUND_CHECK = 1; |
| 2419 /// A check against a single type variable: 'o is T'. | 2419 /// A check against a single type variable: 'o is T'. |
| 2420 static const int VARIABLE_CHECK = 2; | 2420 static const int VARIABLE_CHECK = 2; |
| 2421 | 2421 |
| 2422 final DartType typeExpression; | 2422 final DartType typeExpression; |
| 2423 final int kind; | 2423 final int kind; |
| 2424 final bool useInstanceOf; |
| 2424 | 2425 |
| 2425 HIs.direct(DartType typeExpression, | 2426 HIs.direct(DartType typeExpression, |
| 2426 HInstruction expression, | 2427 HInstruction expression, |
| 2427 TypeMask type) | 2428 TypeMask type) |
| 2428 : this.internal(typeExpression, [expression], RAW_CHECK, type); | 2429 : this.internal(typeExpression, [expression], RAW_CHECK, type); |
| 2429 | 2430 |
| 2431 // Pre-verified that the check can be done using 'instanceof'. |
| 2432 HIs.instanceOf(DartType typeExpression, |
| 2433 HInstruction expression, |
| 2434 TypeMask type) |
| 2435 : this.internal(typeExpression, [expression], RAW_CHECK, type, |
| 2436 useInstanceOf: true); |
| 2437 |
| 2430 HIs.raw(DartType typeExpression, | 2438 HIs.raw(DartType typeExpression, |
| 2431 HInstruction expression, | 2439 HInstruction expression, |
| 2432 HInterceptor interceptor, | 2440 HInterceptor interceptor, |
| 2433 TypeMask type) | 2441 TypeMask type) |
| 2434 : this.internal( | 2442 : this.internal( |
| 2435 typeExpression, [expression, interceptor], RAW_CHECK, type); | 2443 typeExpression, [expression, interceptor], RAW_CHECK, type); |
| 2436 | 2444 |
| 2437 HIs.compound(DartType typeExpression, | 2445 HIs.compound(DartType typeExpression, |
| 2438 HInstruction expression, | 2446 HInstruction expression, |
| 2439 HInstruction call, | 2447 HInstruction call, |
| 2440 TypeMask type) | 2448 TypeMask type) |
| 2441 : this.internal(typeExpression, [expression, call], COMPOUND_CHECK, type); | 2449 : this.internal(typeExpression, [expression, call], COMPOUND_CHECK, type); |
| 2442 | 2450 |
| 2443 HIs.variable(DartType typeExpression, | 2451 HIs.variable(DartType typeExpression, |
| 2444 HInstruction expression, | 2452 HInstruction expression, |
| 2445 HInstruction call, | 2453 HInstruction call, |
| 2446 TypeMask type) | 2454 TypeMask type) |
| 2447 : this.internal(typeExpression, [expression, call], VARIABLE_CHECK, type); | 2455 : this.internal(typeExpression, [expression, call], VARIABLE_CHECK, type); |
| 2448 | 2456 |
| 2449 HIs.internal(this.typeExpression, List<HInstruction> inputs, this.kind, type) | 2457 HIs.internal(this.typeExpression, List<HInstruction> inputs, this.kind, |
| 2458 TypeMask type, {bool this.useInstanceOf: false}) |
| 2450 : super(inputs, type) { | 2459 : super(inputs, type) { |
| 2451 assert(kind >= RAW_CHECK && kind <= VARIABLE_CHECK); | 2460 assert(kind >= RAW_CHECK && kind <= VARIABLE_CHECK); |
| 2452 setUseGvn(); | 2461 setUseGvn(); |
| 2453 } | 2462 } |
| 2454 | 2463 |
| 2455 HInstruction get expression => inputs[0]; | 2464 HInstruction get expression => inputs[0]; |
| 2456 | 2465 |
| 2457 HInstruction get interceptor { | 2466 HInstruction get interceptor { |
| 2458 assert(kind == RAW_CHECK); | 2467 assert(kind == RAW_CHECK); |
| 2459 return inputs.length > 1 ? inputs[1] : null; | 2468 return inputs.length > 1 ? inputs[1] : null; |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3091 class HDynamicType extends HRuntimeType { | 3100 class HDynamicType extends HRuntimeType { |
| 3092 HDynamicType(DynamicType dartType, TypeMask instructionType) | 3101 HDynamicType(DynamicType dartType, TypeMask instructionType) |
| 3093 : super(const <HInstruction>[], dartType, instructionType); | 3102 : super(const <HInstruction>[], dartType, instructionType); |
| 3094 | 3103 |
| 3095 accept(HVisitor visitor) => visitor.visitDynamicType(this); | 3104 accept(HVisitor visitor) => visitor.visitDynamicType(this); |
| 3096 | 3105 |
| 3097 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; | 3106 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; |
| 3098 | 3107 |
| 3099 bool typeEquals(HInstruction other) => other is HDynamicType; | 3108 bool typeEquals(HInstruction other) => other is HDynamicType; |
| 3100 } | 3109 } |
| OLD | NEW |