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 abstract class HVisitor<R> { | 5 abstract class 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 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1399 } | 1399 } |
1400 | 1400 |
1401 HType computeDesiredTypeForNonTargetInput(HInstruction input, | 1401 HType computeDesiredTypeForNonTargetInput(HInstruction input, |
1402 HTypeMap types) { | 1402 HTypeMap types) { |
1403 return HType.UNKNOWN; | 1403 return HType.UNKNOWN; |
1404 } | 1404 } |
1405 } | 1405 } |
1406 | 1406 |
1407 class HInvokeSuper extends HInvokeStatic { | 1407 class HInvokeSuper extends HInvokeStatic { |
1408 final bool isSetter; | 1408 final bool isSetter; |
1409 HInvokeSuper(inputs, [this.isSetter = false]) : super(inputs); | 1409 HInvokeSuper(inputs, {this.isSetter: false}) : super(inputs); |
1410 toString() => 'invoke super: ${element.name}'; | 1410 toString() => 'invoke super: ${element.name}'; |
1411 accept(HVisitor visitor) => visitor.visitInvokeSuper(this); | 1411 accept(HVisitor visitor) => visitor.visitInvokeSuper(this); |
1412 | 1412 |
1413 HInstruction get value { | 1413 HInstruction get value { |
1414 assert(isSetter); | 1414 assert(isSetter); |
1415 // Index 0: the element, index 1: 'this'. | 1415 // Index 0: the element, index 1: 'this'. |
1416 return inputs[2]; | 1416 return inputs[2]; |
1417 } | 1417 } |
1418 } | 1418 } |
1419 | 1419 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 final Element element; | 1497 final Element element; |
1498 | 1498 |
1499 HFieldAccess(Element element, List<HInstruction> inputs) | 1499 HFieldAccess(Element element, List<HInstruction> inputs) |
1500 : this.element = element, | 1500 : this.element = element, |
1501 super(inputs); | 1501 super(inputs); |
1502 } | 1502 } |
1503 | 1503 |
1504 class HFieldGet extends HFieldAccess { | 1504 class HFieldGet extends HFieldAccess { |
1505 final bool isAssignable; | 1505 final bool isAssignable; |
1506 | 1506 |
1507 HFieldGet(Element element, HInstruction receiver, [bool isAssignable]) | 1507 HFieldGet(Element element, HInstruction receiver, {bool isAssignable}) |
1508 : this.isAssignable = (isAssignable !== null) | 1508 : this.isAssignable = (isAssignable !== null) |
1509 ? isAssignable | 1509 ? isAssignable |
1510 : element.isAssignable(), | 1510 : element.isAssignable(), |
1511 super(element, <HInstruction>[receiver]); | 1511 super(element, <HInstruction>[receiver]); |
1512 | 1512 |
1513 HInstruction get receiver => inputs[0]; | 1513 HInstruction get receiver => inputs[0]; |
1514 | 1514 |
1515 accept(HVisitor visitor) => visitor.visitFieldGet(this); | 1515 accept(HVisitor visitor) => visitor.visitFieldGet(this); |
1516 | 1516 |
1517 void prepareGvn(HTypeMap types) { | 1517 void prepareGvn(HTypeMap types) { |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2392 } | 2392 } |
2393 | 2393 |
2394 class HReturn extends HControlFlow { | 2394 class HReturn extends HControlFlow { |
2395 HReturn(value) : super(<HInstruction>[value]); | 2395 HReturn(value) : super(<HInstruction>[value]); |
2396 toString() => 'return'; | 2396 toString() => 'return'; |
2397 accept(HVisitor visitor) => visitor.visitReturn(this); | 2397 accept(HVisitor visitor) => visitor.visitReturn(this); |
2398 } | 2398 } |
2399 | 2399 |
2400 class HThrow extends HControlFlow { | 2400 class HThrow extends HControlFlow { |
2401 final bool isRethrow; | 2401 final bool isRethrow; |
2402 HThrow(value, [this.isRethrow = false]) : super(<HInstruction>[value]); | 2402 HThrow(value, {this.isRethrow: false}) : super(<HInstruction>[value]); |
2403 toString() => 'throw'; | 2403 toString() => 'throw'; |
2404 accept(HVisitor visitor) => visitor.visitThrow(this); | 2404 accept(HVisitor visitor) => visitor.visitThrow(this); |
2405 } | 2405 } |
2406 | 2406 |
2407 class HStatic extends HInstruction { | 2407 class HStatic extends HInstruction { |
2408 final Element element; | 2408 final Element element; |
2409 HStatic(this.element) : super(<HInstruction>[]) { | 2409 HStatic(this.element) : super(<HInstruction>[]) { |
2410 assert(element !== null); | 2410 assert(element !== null); |
2411 assert(invariant(this, element.isDeclaration)); | 2411 assert(invariant(this, element.isDeclaration)); |
2412 } | 2412 } |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2814 | 2814 |
2815 | 2815 |
2816 class HLabeledBlockInformation implements HStatementInformation { | 2816 class HLabeledBlockInformation implements HStatementInformation { |
2817 final HStatementInformation body; | 2817 final HStatementInformation body; |
2818 final List<LabelElement> labels; | 2818 final List<LabelElement> labels; |
2819 final TargetElement target; | 2819 final TargetElement target; |
2820 final bool isContinue; | 2820 final bool isContinue; |
2821 | 2821 |
2822 HLabeledBlockInformation(this.body, | 2822 HLabeledBlockInformation(this.body, |
2823 List<LabelElement> labels, | 2823 List<LabelElement> labels, |
2824 [this.isContinue = false]) : | 2824 {this.isContinue: false}) : |
2825 this.labels = labels, this.target = labels[0].target; | 2825 this.labels = labels, this.target = labels[0].target; |
2826 | 2826 |
2827 HLabeledBlockInformation.implicit(this.body, | 2827 HLabeledBlockInformation.implicit(this.body, |
2828 this.target, | 2828 this.target, |
2829 [this.isContinue = false]) | 2829 {this.isContinue: false}) |
2830 : this.labels = const<LabelElement>[]; | 2830 : this.labels = const<LabelElement>[]; |
2831 | 2831 |
2832 HBasicBlock get start => body.start; | 2832 HBasicBlock get start => body.start; |
2833 HBasicBlock get end => body.end; | 2833 HBasicBlock get end => body.end; |
2834 | 2834 |
2835 bool accept(HStatementInformationVisitor visitor) => | 2835 bool accept(HStatementInformationVisitor visitor) => |
2836 visitor.visitLabeledBlockInfo(this); | 2836 visitor.visitLabeledBlockInfo(this); |
2837 } | 2837 } |
2838 | 2838 |
2839 class LoopTypeVisitor extends Visitor { | 2839 class LoopTypeVisitor extends Visitor { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2974 HBasicBlock get start => expression.start; | 2974 HBasicBlock get start => expression.start; |
2975 HBasicBlock get end { | 2975 HBasicBlock get end { |
2976 // We don't create a switch block if there are no cases. | 2976 // We don't create a switch block if there are no cases. |
2977 assert(!statements.isEmpty()); | 2977 assert(!statements.isEmpty()); |
2978 return statements.last().end; | 2978 return statements.last().end; |
2979 } | 2979 } |
2980 | 2980 |
2981 bool accept(HStatementInformationVisitor visitor) => | 2981 bool accept(HStatementInformationVisitor visitor) => |
2982 visitor.visitSwitchInfo(this); | 2982 visitor.visitSwitchInfo(this); |
2983 } | 2983 } |
OLD | NEW |