| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 R visitLocalSet(HLocalSet node); | 47 R visitLocalSet(HLocalSet node); |
| 48 R visitLocalValue(HLocalValue node); | 48 R visitLocalValue(HLocalValue node); |
| 49 R visitLoopBranch(HLoopBranch node); | 49 R visitLoopBranch(HLoopBranch node); |
| 50 R visitMultiply(HMultiply node); | 50 R visitMultiply(HMultiply node); |
| 51 R visitNegate(HNegate node); | 51 R visitNegate(HNegate node); |
| 52 R visitNot(HNot node); | 52 R visitNot(HNot node); |
| 53 R visitOneShotInterceptor(HOneShotInterceptor node); | 53 R visitOneShotInterceptor(HOneShotInterceptor node); |
| 54 R visitParameterValue(HParameterValue node); | 54 R visitParameterValue(HParameterValue node); |
| 55 R visitPhi(HPhi node); | 55 R visitPhi(HPhi node); |
| 56 R visitRangeConversion(HRangeConversion node); | 56 R visitRangeConversion(HRangeConversion node); |
| 57 R visitReadModifyWrite(HReadModifyWrite node); |
| 57 R visitReturn(HReturn node); | 58 R visitReturn(HReturn node); |
| 58 R visitShiftLeft(HShiftLeft node); | 59 R visitShiftLeft(HShiftLeft node); |
| 59 R visitShiftRight(HShiftRight node); | 60 R visitShiftRight(HShiftRight node); |
| 60 R visitStatic(HStatic node); | 61 R visitStatic(HStatic node); |
| 61 R visitStaticStore(HStaticStore node); | 62 R visitStaticStore(HStaticStore node); |
| 62 R visitStringConcat(HStringConcat node); | 63 R visitStringConcat(HStringConcat node); |
| 63 R visitStringify(HStringify node); | 64 R visitStringify(HStringify node); |
| 64 R visitSubtract(HSubtract node); | 65 R visitSubtract(HSubtract node); |
| 65 R visitSwitch(HSwitch node); | 66 R visitSwitch(HSwitch node); |
| 66 R visitThis(HThis node); | 67 R visitThis(HThis node); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 visitLocalValue(HLocalValue node) => visitInstruction(node); | 315 visitLocalValue(HLocalValue node) => visitInstruction(node); |
| 315 visitLoopBranch(HLoopBranch node) => visitConditionalBranch(node); | 316 visitLoopBranch(HLoopBranch node) => visitConditionalBranch(node); |
| 316 visitNegate(HNegate node) => visitInvokeUnary(node); | 317 visitNegate(HNegate node) => visitInvokeUnary(node); |
| 317 visitNot(HNot node) => visitInstruction(node); | 318 visitNot(HNot node) => visitInstruction(node); |
| 318 visitOneShotInterceptor(HOneShotInterceptor node) | 319 visitOneShotInterceptor(HOneShotInterceptor node) |
| 319 => visitInvokeDynamic(node); | 320 => visitInvokeDynamic(node); |
| 320 visitPhi(HPhi node) => visitInstruction(node); | 321 visitPhi(HPhi node) => visitInstruction(node); |
| 321 visitMultiply(HMultiply node) => visitBinaryArithmetic(node); | 322 visitMultiply(HMultiply node) => visitBinaryArithmetic(node); |
| 322 visitParameterValue(HParameterValue node) => visitLocalValue(node); | 323 visitParameterValue(HParameterValue node) => visitLocalValue(node); |
| 323 visitRangeConversion(HRangeConversion node) => visitCheck(node); | 324 visitRangeConversion(HRangeConversion node) => visitCheck(node); |
| 325 visitReadModifyWrite(HReadModifyWrite node) => visitInstruction(node); |
| 324 visitReturn(HReturn node) => visitControlFlow(node); | 326 visitReturn(HReturn node) => visitControlFlow(node); |
| 325 visitShiftLeft(HShiftLeft node) => visitBinaryBitOp(node); | 327 visitShiftLeft(HShiftLeft node) => visitBinaryBitOp(node); |
| 326 visitShiftRight(HShiftRight node) => visitBinaryBitOp(node); | 328 visitShiftRight(HShiftRight node) => visitBinaryBitOp(node); |
| 327 visitSubtract(HSubtract node) => visitBinaryArithmetic(node); | 329 visitSubtract(HSubtract node) => visitBinaryArithmetic(node); |
| 328 visitSwitch(HSwitch node) => visitControlFlow(node); | 330 visitSwitch(HSwitch node) => visitControlFlow(node); |
| 329 visitStatic(HStatic node) => visitInstruction(node); | 331 visitStatic(HStatic node) => visitInstruction(node); |
| 330 visitStaticStore(HStaticStore node) => visitInstruction(node); | 332 visitStaticStore(HStaticStore node) => visitInstruction(node); |
| 331 visitStringConcat(HStringConcat node) => visitInstruction(node); | 333 visitStringConcat(HStringConcat node) => visitInstruction(node); |
| 332 visitStringify(HStringify node) => visitInstruction(node); | 334 visitStringify(HStringify node) => visitInstruction(node); |
| 333 visitThis(HThis node) => visitParameterValue(node); | 335 visitThis(HThis node) => visitParameterValue(node); |
| (...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1555 HInstruction getDartReceiver(Compiler compiler) => receiver; | 1557 HInstruction getDartReceiver(Compiler compiler) => receiver; |
| 1556 bool onlyThrowsNSM() => true; | 1558 bool onlyThrowsNSM() => true; |
| 1557 | 1559 |
| 1558 HInstruction get value => inputs[1]; | 1560 HInstruction get value => inputs[1]; |
| 1559 accept(HVisitor visitor) => visitor.visitFieldSet(this); | 1561 accept(HVisitor visitor) => visitor.visitFieldSet(this); |
| 1560 | 1562 |
| 1561 bool isJsStatement() => true; | 1563 bool isJsStatement() => true; |
| 1562 String toString() => "FieldSet $element"; | 1564 String toString() => "FieldSet $element"; |
| 1563 } | 1565 } |
| 1564 | 1566 |
| 1567 /** |
| 1568 * HReadModifyWrite is a late stage instruction for a field (property) update |
| 1569 * via an assignment operation or pre- or post-increment. |
| 1570 */ |
| 1571 class HReadModifyWrite extends HLateInstruction { |
| 1572 static const ASSIGN_OP = 0; |
| 1573 static const PRE_OP = 1; |
| 1574 static const POST_OP = 2; |
| 1575 final Element element; |
| 1576 final String jsOp; |
| 1577 final int opKind; |
| 1578 |
| 1579 HReadModifyWrite._(Element this.element, this.jsOp, this.opKind, |
| 1580 List<HInstruction> inputs, TypeMask type) |
| 1581 : super(inputs, type) { |
| 1582 sideEffects.clearAllSideEffects(); |
| 1583 sideEffects.clearAllDependencies(); |
| 1584 sideEffects.setChangesInstanceProperty(); |
| 1585 sideEffects.setDependsOnInstancePropertyStore(); |
| 1586 } |
| 1587 |
| 1588 HReadModifyWrite.assignOp(Element element, String jsOp, |
| 1589 HInstruction receiver, HInstruction operand, TypeMask type) |
| 1590 : this._(element, jsOp, ASSIGN_OP, |
| 1591 <HInstruction>[receiver, operand], type); |
| 1592 |
| 1593 HReadModifyWrite.preOp(Element element, String jsOp, |
| 1594 HInstruction receiver, TypeMask type) |
| 1595 : this._(element, jsOp, PRE_OP, <HInstruction>[receiver], type); |
| 1596 |
| 1597 HReadModifyWrite.postOp(Element element, String jsOp, |
| 1598 HInstruction receiver, TypeMask type) |
| 1599 : this._(element, jsOp, POST_OP, <HInstruction>[receiver], type); |
| 1600 |
| 1601 HInstruction get receiver => inputs[0]; |
| 1602 |
| 1603 bool get isPreOp => opKind == PRE_OP; |
| 1604 bool get isPostOp => opKind == POST_OP; |
| 1605 bool get isAssignOp => opKind == ASSIGN_OP; |
| 1606 |
| 1607 bool canThrow() => receiver.canBeNull(); |
| 1608 |
| 1609 HInstruction getDartReceiver(Compiler compiler) => receiver; |
| 1610 bool onlyThrowsNSM() => true; |
| 1611 |
| 1612 HInstruction get value => inputs[1]; |
| 1613 accept(HVisitor visitor) => visitor.visitReadModifyWrite(this); |
| 1614 |
| 1615 bool isJsStatement() => isAssignOp; |
| 1616 String toString() => "ReadModifyWrite $jsOp $opKind $element"; |
| 1617 } |
| 1618 |
| 1565 class HLocalGet extends HFieldAccess { | 1619 class HLocalGet extends HFieldAccess { |
| 1566 // No need to use GVN for a [HLocalGet], it is just a local | 1620 // No need to use GVN for a [HLocalGet], it is just a local |
| 1567 // access. | 1621 // access. |
| 1568 HLocalGet(Element element, HLocalValue local, TypeMask type) | 1622 HLocalGet(Element element, HLocalValue local, TypeMask type) |
| 1569 : super(element, <HInstruction>[local], type); | 1623 : super(element, <HInstruction>[local], type); |
| 1570 | 1624 |
| 1571 accept(HVisitor visitor) => visitor.visitLocalGet(this); | 1625 accept(HVisitor visitor) => visitor.visitLocalGet(this); |
| 1572 | 1626 |
| 1573 HLocalValue get local => inputs[0]; | 1627 HLocalValue get local => inputs[0]; |
| 1574 } | 1628 } |
| (...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2971 class HDynamicType extends HRuntimeType { | 3025 class HDynamicType extends HRuntimeType { |
| 2972 HDynamicType(DynamicType dartType, TypeMask instructionType) | 3026 HDynamicType(DynamicType dartType, TypeMask instructionType) |
| 2973 : super(const <HInstruction>[], dartType, instructionType); | 3027 : super(const <HInstruction>[], dartType, instructionType); |
| 2974 | 3028 |
| 2975 accept(HVisitor visitor) => visitor.visitDynamicType(this); | 3029 accept(HVisitor visitor) => visitor.visitDynamicType(this); |
| 2976 | 3030 |
| 2977 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; | 3031 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; |
| 2978 | 3032 |
| 2979 bool typeEquals(HInstruction other) => other is HDynamicType; | 3033 bool typeEquals(HInstruction other) => other is HDynamicType; |
| 2980 } | 3034 } |
| OLD | NEW |