| 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 2510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2521 | 2521 |
| 2522 bool isBuiltin(HTypeMap types) | 2522 bool isBuiltin(HTypeMap types) |
| 2523 => receiver.isMutableArray(types) && index.isInteger(types); | 2523 => receiver.isMutableArray(types) && index.isInteger(types); |
| 2524 bool isJsStatement(HTypeMap types) => !isBuiltin(types); | 2524 bool isJsStatement(HTypeMap types) => !isBuiltin(types); |
| 2525 } | 2525 } |
| 2526 | 2526 |
| 2527 class HIs extends HInstruction { | 2527 class HIs extends HInstruction { |
| 2528 final DartType typeExpression; | 2528 final DartType typeExpression; |
| 2529 final bool nullOk; | 2529 final bool nullOk; |
| 2530 | 2530 |
| 2531 HIs.withTypeInfoCall(this.typeExpression, HInstruction expression, | 2531 HIs.withArgumentChecks(this.typeExpression, |
| 2532 HInstruction typeInfo, [this.nullOk = false]) | 2532 HInstruction expression, |
| 2533 : super(<HInstruction>[expression, typeInfo]); | 2533 List<HInstruction> checks, |
| 2534 [this.nullOk = false]) |
| 2535 : super(<HInstruction>[expression]..addAll(checks)); |
| 2534 | 2536 |
| 2535 HIs(this.typeExpression, HInstruction expression, {this.nullOk: false}) | 2537 HIs(this.typeExpression, HInstruction expression, {this.nullOk: false}) |
| 2536 : super(<HInstruction>[expression]); | 2538 : super(<HInstruction>[expression]); |
| 2537 | 2539 |
| 2538 HInstruction get expression => inputs[0]; | 2540 HInstruction get expression => inputs[0]; |
| 2541 HInstruction getCheck(int index) => inputs[index + 1]; |
| 2542 int get checkCount => inputs.length - 1; |
| 2539 | 2543 |
| 2540 HInstruction get typeInfoCall => inputs[1]; | 2544 bool hasArgumentChecks() => inputs.length >= 1; |
| 2541 | |
| 2542 bool hasTypeInfo() => inputs.length == 2; | |
| 2543 | 2545 |
| 2544 HType get guaranteedType => HType.BOOLEAN; | 2546 HType get guaranteedType => HType.BOOLEAN; |
| 2545 | 2547 |
| 2546 accept(HVisitor visitor) => visitor.visitIs(this); | 2548 accept(HVisitor visitor) => visitor.visitIs(this); |
| 2547 | 2549 |
| 2548 toString() => "$expression is $typeExpression"; | 2550 toString() => "$expression is $typeExpression"; |
| 2549 } | 2551 } |
| 2550 | 2552 |
| 2551 class HTypeConversion extends HCheck { | 2553 class HTypeConversion extends HCheck { |
| 2552 HType type; | 2554 HType type; |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2940 HBasicBlock get start => expression.start; | 2942 HBasicBlock get start => expression.start; |
| 2941 HBasicBlock get end { | 2943 HBasicBlock get end { |
| 2942 // We don't create a switch block if there are no cases. | 2944 // We don't create a switch block if there are no cases. |
| 2943 assert(!statements.isEmpty); | 2945 assert(!statements.isEmpty); |
| 2944 return statements.last.end; | 2946 return statements.last.end; |
| 2945 } | 2947 } |
| 2946 | 2948 |
| 2947 bool accept(HStatementInformationVisitor visitor) => | 2949 bool accept(HStatementInformationVisitor visitor) => |
| 2948 visitor.visitSwitchInfo(this); | 2950 visitor.visitSwitchInfo(this); |
| 2949 } | 2951 } |
| OLD | NEW |