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 visitAwait(HAwait node); | 9 R visitAwait(HAwait node); |
10 R visitBitAnd(HBitAnd node); | 10 R visitBitAnd(HBitAnd node); |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 static const int ARGUMENTS_OFFSET = 1; | 1386 static const int ARGUMENTS_OFFSET = 1; |
1387 bool canThrow() => true; | 1387 bool canThrow() => true; |
1388 | 1388 |
1389 /** | 1389 /** |
1390 * Returns whether this call is on an intercepted method. | 1390 * Returns whether this call is on an intercepted method. |
1391 */ | 1391 */ |
1392 bool get isInterceptedCall { | 1392 bool get isInterceptedCall { |
1393 // We know it's a selector call if it follows the interceptor | 1393 // We know it's a selector call if it follows the interceptor |
1394 // calling convention, which adds the actual receiver as a | 1394 // calling convention, which adds the actual receiver as a |
1395 // parameter to the call. | 1395 // parameter to the call. |
1396 return (selector != null) && | 1396 return (selector != null) && (inputs.length - 2 == selector.argumentCount); |
1397 (inputs.length - 2 == selector.argumentCount); | |
1398 } | 1397 } |
1399 } | 1398 } |
1400 | 1399 |
1401 abstract class HInvokeDynamic extends HInvoke { | 1400 abstract class HInvokeDynamic extends HInvoke { |
1402 final InvokeDynamicSpecializer specializer; | 1401 final InvokeDynamicSpecializer specializer; |
1403 Selector selector; | 1402 Selector selector; |
1404 TypeMask mask; | |
1405 Element element; | 1403 Element element; |
1406 | 1404 |
1407 HInvokeDynamic(Selector selector, | 1405 HInvokeDynamic(Selector selector, |
1408 this.mask, | |
1409 this.element, | 1406 this.element, |
1410 List<HInstruction> inputs, | 1407 List<HInstruction> inputs, |
1411 TypeMask type, | 1408 TypeMask type, |
1412 [bool isIntercepted = false]) | 1409 [bool isIntercepted = false]) |
1413 : super(inputs, type), | 1410 : super(inputs, type), |
1414 this.selector = selector, | 1411 this.selector = selector, |
1415 specializer = isIntercepted | 1412 specializer = isIntercepted |
1416 ? InvokeDynamicSpecializer.lookupSpecializer(selector) | 1413 ? InvokeDynamicSpecializer.lookupSpecializer(selector) |
1417 : const InvokeDynamicSpecializer(); | 1414 : const InvokeDynamicSpecializer(); |
1418 toString() => 'invoke dynamic: selector=$selector, mask=$mask'; | 1415 toString() => 'invoke dynamic: $selector'; |
1419 HInstruction get receiver => inputs[0]; | 1416 HInstruction get receiver => inputs[0]; |
1420 HInstruction getDartReceiver(Compiler compiler) { | 1417 HInstruction getDartReceiver(Compiler compiler) { |
1421 return isCallOnInterceptor(compiler) ? inputs[1] : inputs[0]; | 1418 return isCallOnInterceptor(compiler) ? inputs[1] : inputs[0]; |
1422 } | 1419 } |
1423 | 1420 |
1424 /** | 1421 /** |
1425 * Returns whether this call is on an interceptor object. | 1422 * Returns whether this call is on an interceptor object. |
1426 */ | 1423 */ |
1427 bool isCallOnInterceptor(Compiler compiler) { | 1424 bool isCallOnInterceptor(Compiler compiler) { |
1428 return isInterceptedCall && receiver.isInterceptor(compiler); | 1425 return isInterceptedCall && receiver.isInterceptor(compiler); |
1429 } | 1426 } |
1430 | 1427 |
1431 int typeCode() => HInstruction.INVOKE_DYNAMIC_TYPECODE; | 1428 int typeCode() => HInstruction.INVOKE_DYNAMIC_TYPECODE; |
1432 bool typeEquals(other) => other is HInvokeDynamic; | 1429 bool typeEquals(other) => other is HInvokeDynamic; |
1433 bool dataEquals(HInvokeDynamic other) { | 1430 bool dataEquals(HInvokeDynamic other) { |
1434 // Use the name and the kind instead of [Selector.operator==] | 1431 // Use the name and the kind instead of [Selector.operator==] |
1435 // because we don't need to check the arity (already checked in | 1432 // because we don't need to check the arity (already checked in |
1436 // [gvnEquals]), and the receiver types may not be in sync. | 1433 // [gvnEquals]), and the receiver types may not be in sync. |
1437 return selector.name == other.selector.name | 1434 return selector.name == other.selector.name |
1438 && selector.kind == other.selector.kind; | 1435 && selector.kind == other.selector.kind; |
1439 } | 1436 } |
1440 } | 1437 } |
1441 | 1438 |
1442 class HInvokeClosure extends HInvokeDynamic { | 1439 class HInvokeClosure extends HInvokeDynamic { |
1443 HInvokeClosure(Selector selector, | 1440 HInvokeClosure(Selector selector, List<HInstruction> inputs, TypeMask type) |
1444 List<HInstruction> inputs, | 1441 : super(selector, null, inputs, type) { |
1445 TypeMask type) | |
1446 : super(selector, null, null, inputs, type) { | |
1447 assert(selector.isClosureCall); | 1442 assert(selector.isClosureCall); |
1448 } | 1443 } |
1449 accept(HVisitor visitor) => visitor.visitInvokeClosure(this); | 1444 accept(HVisitor visitor) => visitor.visitInvokeClosure(this); |
1450 } | 1445 } |
1451 | 1446 |
1452 class HInvokeDynamicMethod extends HInvokeDynamic { | 1447 class HInvokeDynamicMethod extends HInvokeDynamic { |
1453 HInvokeDynamicMethod(Selector selector, | 1448 HInvokeDynamicMethod(Selector selector, |
1454 TypeMask mask, | |
1455 List<HInstruction> inputs, | 1449 List<HInstruction> inputs, |
1456 TypeMask type, | 1450 TypeMask type, |
1457 [bool isIntercepted = false]) | 1451 [bool isIntercepted = false]) |
1458 : super(selector, mask, null, inputs, type, isIntercepted); | 1452 : super(selector, null, inputs, type, isIntercepted); |
1459 | 1453 |
1460 String toString() => 'invoke dynamic method: selector=$selector, mask=$mask'; | 1454 String toString() => 'invoke dynamic method: $selector'; |
1461 accept(HVisitor visitor) => visitor.visitInvokeDynamicMethod(this); | 1455 accept(HVisitor visitor) => visitor.visitInvokeDynamicMethod(this); |
1462 } | 1456 } |
1463 | 1457 |
1464 abstract class HInvokeDynamicField extends HInvokeDynamic { | 1458 abstract class HInvokeDynamicField extends HInvokeDynamic { |
1465 HInvokeDynamicField( | 1459 HInvokeDynamicField( |
1466 Selector selector, TypeMask mask, | 1460 Selector selector, Element element, List<HInstruction> inputs, |
1467 Element element, List<HInstruction> inputs, | |
1468 TypeMask type) | 1461 TypeMask type) |
1469 : super(selector, mask, element, inputs, type); | 1462 : super(selector, element, inputs, type); |
1470 toString() => 'invoke dynamic field: selector=$selector, mask=$mask'; | 1463 toString() => 'invoke dynamic field: $selector'; |
1471 } | 1464 } |
1472 | 1465 |
1473 class HInvokeDynamicGetter extends HInvokeDynamicField { | 1466 class HInvokeDynamicGetter extends HInvokeDynamicField { |
1474 HInvokeDynamicGetter(Selector selector, TypeMask mask, | 1467 HInvokeDynamicGetter(selector, element, inputs, type) |
1475 Element element, List<HInstruction> inputs, TypeMask type) | 1468 : super(selector, element, inputs, type); |
1476 : super(selector, mask, element, inputs, type); | 1469 toString() => 'invoke dynamic getter: $selector'; |
1477 toString() => 'invoke dynamic getter: selector=$selector, mask=$mask'; | |
1478 accept(HVisitor visitor) => visitor.visitInvokeDynamicGetter(this); | 1470 accept(HVisitor visitor) => visitor.visitInvokeDynamicGetter(this); |
1479 } | 1471 } |
1480 | 1472 |
1481 class HInvokeDynamicSetter extends HInvokeDynamicField { | 1473 class HInvokeDynamicSetter extends HInvokeDynamicField { |
1482 HInvokeDynamicSetter(Selector selector, TypeMask mask, | 1474 HInvokeDynamicSetter(selector, element, inputs, type) |
1483 Element element, List<HInstruction> inputs, TypeMask type) | 1475 : super(selector, element, inputs, type); |
1484 : super(selector, mask, element, inputs, type); | 1476 toString() => 'invoke dynamic setter: $selector'; |
1485 toString() => 'invoke dynamic setter: selector=$selector, mask=$mask'; | |
1486 accept(HVisitor visitor) => visitor.visitInvokeDynamicSetter(this); | 1477 accept(HVisitor visitor) => visitor.visitInvokeDynamicSetter(this); |
1487 } | 1478 } |
1488 | 1479 |
1489 class HInvokeStatic extends HInvoke { | 1480 class HInvokeStatic extends HInvoke { |
1490 final Element element; | 1481 final Element element; |
1491 | 1482 |
1492 final bool targetCanThrow; | 1483 final bool targetCanThrow; |
1493 | 1484 |
1494 bool canThrow() => targetCanThrow; | 1485 bool canThrow() => targetCanThrow; |
1495 | 1486 |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1794 [this.instantiatedTypes]) | 1785 [this.instantiatedTypes]) |
1795 : super(type, inputs); | 1786 : super(type, inputs); |
1796 | 1787 |
1797 accept(HVisitor visitor) => visitor.visitForeignNew(this); | 1788 accept(HVisitor visitor) => visitor.visitForeignNew(this); |
1798 | 1789 |
1799 bool get isAllocation => true; | 1790 bool get isAllocation => true; |
1800 } | 1791 } |
1801 | 1792 |
1802 abstract class HInvokeBinary extends HInstruction { | 1793 abstract class HInvokeBinary extends HInstruction { |
1803 final Selector selector; | 1794 final Selector selector; |
1804 HInvokeBinary( | 1795 HInvokeBinary(HInstruction left, HInstruction right, this.selector, type) |
1805 HInstruction left, HInstruction right, this.selector, TypeMask type) | |
1806 : super(<HInstruction>[left, right], type) { | 1796 : super(<HInstruction>[left, right], type) { |
1807 sideEffects.clearAllSideEffects(); | 1797 sideEffects.clearAllSideEffects(); |
1808 sideEffects.clearAllDependencies(); | 1798 sideEffects.clearAllDependencies(); |
1809 setUseGvn(); | 1799 setUseGvn(); |
1810 } | 1800 } |
1811 | 1801 |
1812 HInstruction get left => inputs[0]; | 1802 HInstruction get left => inputs[0]; |
1813 HInstruction get right => inputs[1]; | 1803 HInstruction get right => inputs[1]; |
1814 | 1804 |
1815 BinaryOperation operation(ConstantSystem constantSystem); | 1805 BinaryOperation operation(ConstantSystem constantSystem); |
1816 } | 1806 } |
1817 | 1807 |
1818 abstract class HBinaryArithmetic extends HInvokeBinary { | 1808 abstract class HBinaryArithmetic extends HInvokeBinary { |
1819 HBinaryArithmetic( | 1809 HBinaryArithmetic(left, right, selector, type) |
1820 HInstruction left, HInstruction right, Selector selector, TypeMask type) | |
1821 : super(left, right, selector, type); | 1810 : super(left, right, selector, type); |
1822 BinaryOperation operation(ConstantSystem constantSystem); | 1811 BinaryOperation operation(ConstantSystem constantSystem); |
1823 } | 1812 } |
1824 | 1813 |
1825 class HAdd extends HBinaryArithmetic { | 1814 class HAdd extends HBinaryArithmetic { |
1826 HAdd(HInstruction left, HInstruction right, Selector selector, TypeMask type) | 1815 HAdd(left, right, selector, type) : super(left, right, selector, type); |
1827 : super(left, right, selector, type); | |
1828 accept(HVisitor visitor) => visitor.visitAdd(this); | 1816 accept(HVisitor visitor) => visitor.visitAdd(this); |
1829 | 1817 |
1830 BinaryOperation operation(ConstantSystem constantSystem) | 1818 BinaryOperation operation(ConstantSystem constantSystem) |
1831 => constantSystem.add; | 1819 => constantSystem.add; |
1832 int typeCode() => HInstruction.ADD_TYPECODE; | 1820 int typeCode() => HInstruction.ADD_TYPECODE; |
1833 bool typeEquals(other) => other is HAdd; | 1821 bool typeEquals(other) => other is HAdd; |
1834 bool dataEquals(HInstruction other) => true; | 1822 bool dataEquals(HInstruction other) => true; |
1835 } | 1823 } |
1836 | 1824 |
1837 class HDivide extends HBinaryArithmetic { | 1825 class HDivide extends HBinaryArithmetic { |
1838 HDivide( | 1826 HDivide(left, right, selector, type) : super(left, right, selector, type); |
1839 HInstruction left, HInstruction right, Selector selector, TypeMask type) | |
1840 : super(left, right, selector, type); | |
1841 accept(HVisitor visitor) => visitor.visitDivide(this); | 1827 accept(HVisitor visitor) => visitor.visitDivide(this); |
1842 | 1828 |
1843 BinaryOperation operation(ConstantSystem constantSystem) | 1829 BinaryOperation operation(ConstantSystem constantSystem) |
1844 => constantSystem.divide; | 1830 => constantSystem.divide; |
1845 int typeCode() => HInstruction.DIVIDE_TYPECODE; | 1831 int typeCode() => HInstruction.DIVIDE_TYPECODE; |
1846 bool typeEquals(other) => other is HDivide; | 1832 bool typeEquals(other) => other is HDivide; |
1847 bool dataEquals(HInstruction other) => true; | 1833 bool dataEquals(HInstruction other) => true; |
1848 } | 1834 } |
1849 | 1835 |
1850 class HMultiply extends HBinaryArithmetic { | 1836 class HMultiply extends HBinaryArithmetic { |
1851 HMultiply( | 1837 HMultiply(left, right, selector, type) : super(left, right, selector, type); |
1852 HInstruction left, HInstruction right, Selector selector, TypeMask type) | |
1853 : super(left, right, selector, type); | |
1854 accept(HVisitor visitor) => visitor.visitMultiply(this); | 1838 accept(HVisitor visitor) => visitor.visitMultiply(this); |
1855 | 1839 |
1856 BinaryOperation operation(ConstantSystem operations) | 1840 BinaryOperation operation(ConstantSystem operations) |
1857 => operations.multiply; | 1841 => operations.multiply; |
1858 int typeCode() => HInstruction.MULTIPLY_TYPECODE; | 1842 int typeCode() => HInstruction.MULTIPLY_TYPECODE; |
1859 bool typeEquals(other) => other is HMultiply; | 1843 bool typeEquals(other) => other is HMultiply; |
1860 bool dataEquals(HInstruction other) => true; | 1844 bool dataEquals(HInstruction other) => true; |
1861 } | 1845 } |
1862 | 1846 |
1863 class HSubtract extends HBinaryArithmetic { | 1847 class HSubtract extends HBinaryArithmetic { |
1864 HSubtract( | 1848 HSubtract(left, right, selector, type) : super(left, right, selector, type); |
1865 HInstruction left, HInstruction right, Selector selector, TypeMask type) | |
1866 : super(left, right, selector, type); | |
1867 accept(HVisitor visitor) => visitor.visitSubtract(this); | 1849 accept(HVisitor visitor) => visitor.visitSubtract(this); |
1868 | 1850 |
1869 BinaryOperation operation(ConstantSystem constantSystem) | 1851 BinaryOperation operation(ConstantSystem constantSystem) |
1870 => constantSystem.subtract; | 1852 => constantSystem.subtract; |
1871 int typeCode() => HInstruction.SUBTRACT_TYPECODE; | 1853 int typeCode() => HInstruction.SUBTRACT_TYPECODE; |
1872 bool typeEquals(other) => other is HSubtract; | 1854 bool typeEquals(other) => other is HSubtract; |
1873 bool dataEquals(HInstruction other) => true; | 1855 bool dataEquals(HInstruction other) => true; |
1874 } | 1856 } |
1875 | 1857 |
1876 class HTruncatingDivide extends HBinaryArithmetic { | 1858 class HTruncatingDivide extends HBinaryArithmetic { |
1877 HTruncatingDivide( | 1859 HTruncatingDivide(left, right, selector, type) |
1878 HInstruction left, HInstruction right, Selector selector, TypeMask type) | |
1879 : super(left, right, selector, type); | 1860 : super(left, right, selector, type); |
1880 accept(HVisitor visitor) => visitor.visitTruncatingDivide(this); | 1861 accept(HVisitor visitor) => visitor.visitTruncatingDivide(this); |
1881 | 1862 |
1882 BinaryOperation operation(ConstantSystem constantSystem) | 1863 BinaryOperation operation(ConstantSystem constantSystem) |
1883 => constantSystem.truncatingDivide; | 1864 => constantSystem.truncatingDivide; |
1884 int typeCode() => HInstruction.TRUNCATING_DIVIDE_TYPECODE; | 1865 int typeCode() => HInstruction.TRUNCATING_DIVIDE_TYPECODE; |
1885 bool typeEquals(other) => other is HTruncatingDivide; | 1866 bool typeEquals(other) => other is HTruncatingDivide; |
1886 bool dataEquals(HInstruction other) => true; | 1867 bool dataEquals(HInstruction other) => true; |
1887 } | 1868 } |
1888 | 1869 |
(...skipping 14 matching lines...) Expand all Loading... |
1903 * following join-block. | 1884 * following join-block. |
1904 */ | 1885 */ |
1905 HBasicBlock get defaultTarget => block.successors.last; | 1886 HBasicBlock get defaultTarget => block.successors.last; |
1906 | 1887 |
1907 accept(HVisitor visitor) => visitor.visitSwitch(this); | 1888 accept(HVisitor visitor) => visitor.visitSwitch(this); |
1908 | 1889 |
1909 String toString() => "HSwitch cases = $inputs"; | 1890 String toString() => "HSwitch cases = $inputs"; |
1910 } | 1891 } |
1911 | 1892 |
1912 abstract class HBinaryBitOp extends HInvokeBinary { | 1893 abstract class HBinaryBitOp extends HInvokeBinary { |
1913 HBinaryBitOp( | 1894 HBinaryBitOp(left, right, selector, type) |
1914 HInstruction left, HInstruction right, Selector selector, TypeMask type) | |
1915 : super(left, right, selector, type); | 1895 : super(left, right, selector, type); |
1916 } | 1896 } |
1917 | 1897 |
1918 class HShiftLeft extends HBinaryBitOp { | 1898 class HShiftLeft extends HBinaryBitOp { |
1919 HShiftLeft( | 1899 HShiftLeft(left, right, selector, type) : super(left, right, selector, type); |
1920 HInstruction left, HInstruction right, Selector selector, TypeMask type) | |
1921 : super(left, right, selector, type); | |
1922 accept(HVisitor visitor) => visitor.visitShiftLeft(this); | 1900 accept(HVisitor visitor) => visitor.visitShiftLeft(this); |
1923 | 1901 |
1924 BinaryOperation operation(ConstantSystem constantSystem) | 1902 BinaryOperation operation(ConstantSystem constantSystem) |
1925 => constantSystem.shiftLeft; | 1903 => constantSystem.shiftLeft; |
1926 int typeCode() => HInstruction.SHIFT_LEFT_TYPECODE; | 1904 int typeCode() => HInstruction.SHIFT_LEFT_TYPECODE; |
1927 bool typeEquals(other) => other is HShiftLeft; | 1905 bool typeEquals(other) => other is HShiftLeft; |
1928 bool dataEquals(HInstruction other) => true; | 1906 bool dataEquals(HInstruction other) => true; |
1929 } | 1907 } |
1930 | 1908 |
1931 class HShiftRight extends HBinaryBitOp { | 1909 class HShiftRight extends HBinaryBitOp { |
1932 HShiftRight( | 1910 HShiftRight(left, right, selector, type) : super(left, right, selector, type); |
1933 HInstruction left, HInstruction right, Selector selector, TypeMask type) | |
1934 : super(left, right, selector, type); | |
1935 accept(HVisitor visitor) => visitor.visitShiftRight(this); | 1911 accept(HVisitor visitor) => visitor.visitShiftRight(this); |
1936 | 1912 |
1937 BinaryOperation operation(ConstantSystem constantSystem) | 1913 BinaryOperation operation(ConstantSystem constantSystem) |
1938 => constantSystem.shiftRight; | 1914 => constantSystem.shiftRight; |
1939 int typeCode() => HInstruction.SHIFT_RIGHT_TYPECODE; | 1915 int typeCode() => HInstruction.SHIFT_RIGHT_TYPECODE; |
1940 bool typeEquals(other) => other is HShiftRight; | 1916 bool typeEquals(other) => other is HShiftRight; |
1941 bool dataEquals(HInstruction other) => true; | 1917 bool dataEquals(HInstruction other) => true; |
1942 } | 1918 } |
1943 | 1919 |
1944 class HBitOr extends HBinaryBitOp { | 1920 class HBitOr extends HBinaryBitOp { |
1945 HBitOr( | 1921 HBitOr(left, right, selector, type) : super(left, right, selector, type); |
1946 HInstruction left, HInstruction right, Selector selector, TypeMask type) | |
1947 : super(left, right, selector, type); | |
1948 accept(HVisitor visitor) => visitor.visitBitOr(this); | 1922 accept(HVisitor visitor) => visitor.visitBitOr(this); |
1949 | 1923 |
1950 BinaryOperation operation(ConstantSystem constantSystem) | 1924 BinaryOperation operation(ConstantSystem constantSystem) |
1951 => constantSystem.bitOr; | 1925 => constantSystem.bitOr; |
1952 int typeCode() => HInstruction.BIT_OR_TYPECODE; | 1926 int typeCode() => HInstruction.BIT_OR_TYPECODE; |
1953 bool typeEquals(other) => other is HBitOr; | 1927 bool typeEquals(other) => other is HBitOr; |
1954 bool dataEquals(HInstruction other) => true; | 1928 bool dataEquals(HInstruction other) => true; |
1955 } | 1929 } |
1956 | 1930 |
1957 class HBitAnd extends HBinaryBitOp { | 1931 class HBitAnd extends HBinaryBitOp { |
1958 HBitAnd( | 1932 HBitAnd(left, right, selector, type) : super(left, right, selector, type); |
1959 HInstruction left, HInstruction right, Selector selector, TypeMask type) | |
1960 : super(left, right, selector, type); | |
1961 accept(HVisitor visitor) => visitor.visitBitAnd(this); | 1933 accept(HVisitor visitor) => visitor.visitBitAnd(this); |
1962 | 1934 |
1963 BinaryOperation operation(ConstantSystem constantSystem) | 1935 BinaryOperation operation(ConstantSystem constantSystem) |
1964 => constantSystem.bitAnd; | 1936 => constantSystem.bitAnd; |
1965 int typeCode() => HInstruction.BIT_AND_TYPECODE; | 1937 int typeCode() => HInstruction.BIT_AND_TYPECODE; |
1966 bool typeEquals(other) => other is HBitAnd; | 1938 bool typeEquals(other) => other is HBitAnd; |
1967 bool dataEquals(HInstruction other) => true; | 1939 bool dataEquals(HInstruction other) => true; |
1968 } | 1940 } |
1969 | 1941 |
1970 class HBitXor extends HBinaryBitOp { | 1942 class HBitXor extends HBinaryBitOp { |
1971 HBitXor( | 1943 HBitXor(left, right, selector, type) : super(left, right, selector, type); |
1972 HInstruction left, HInstruction right, Selector selector, TypeMask type) | |
1973 : super(left, right, selector, type); | |
1974 accept(HVisitor visitor) => visitor.visitBitXor(this); | 1944 accept(HVisitor visitor) => visitor.visitBitXor(this); |
1975 | 1945 |
1976 BinaryOperation operation(ConstantSystem constantSystem) | 1946 BinaryOperation operation(ConstantSystem constantSystem) |
1977 => constantSystem.bitXor; | 1947 => constantSystem.bitXor; |
1978 int typeCode() => HInstruction.BIT_XOR_TYPECODE; | 1948 int typeCode() => HInstruction.BIT_XOR_TYPECODE; |
1979 bool typeEquals(other) => other is HBitXor; | 1949 bool typeEquals(other) => other is HBitXor; |
1980 bool dataEquals(HInstruction other) => true; | 1950 bool dataEquals(HInstruction other) => true; |
1981 } | 1951 } |
1982 | 1952 |
1983 abstract class HInvokeUnary extends HInstruction { | 1953 abstract class HInvokeUnary extends HInstruction { |
1984 final Selector selector; | 1954 final Selector selector; |
1985 HInvokeUnary(HInstruction input, this.selector, type) | 1955 HInvokeUnary(HInstruction input, this.selector, type) |
1986 : super(<HInstruction>[input], type) { | 1956 : super(<HInstruction>[input], type) { |
1987 sideEffects.clearAllSideEffects(); | 1957 sideEffects.clearAllSideEffects(); |
1988 sideEffects.clearAllDependencies(); | 1958 sideEffects.clearAllDependencies(); |
1989 setUseGvn(); | 1959 setUseGvn(); |
1990 } | 1960 } |
1991 | 1961 |
1992 HInstruction get operand => inputs[0]; | 1962 HInstruction get operand => inputs[0]; |
1993 | 1963 |
1994 UnaryOperation operation(ConstantSystem constantSystem); | 1964 UnaryOperation operation(ConstantSystem constantSystem); |
1995 } | 1965 } |
1996 | 1966 |
1997 class HNegate extends HInvokeUnary { | 1967 class HNegate extends HInvokeUnary { |
1998 HNegate(HInstruction input, Selector selector, TypeMask type) | 1968 HNegate(input, selector, type) : super(input, selector, type); |
1999 : super(input, selector, type); | |
2000 accept(HVisitor visitor) => visitor.visitNegate(this); | 1969 accept(HVisitor visitor) => visitor.visitNegate(this); |
2001 | 1970 |
2002 UnaryOperation operation(ConstantSystem constantSystem) | 1971 UnaryOperation operation(ConstantSystem constantSystem) |
2003 => constantSystem.negate; | 1972 => constantSystem.negate; |
2004 int typeCode() => HInstruction.NEGATE_TYPECODE; | 1973 int typeCode() => HInstruction.NEGATE_TYPECODE; |
2005 bool typeEquals(other) => other is HNegate; | 1974 bool typeEquals(other) => other is HNegate; |
2006 bool dataEquals(HInstruction other) => true; | 1975 bool dataEquals(HInstruction other) => true; |
2007 } | 1976 } |
2008 | 1977 |
2009 class HBitNot extends HInvokeUnary { | 1978 class HBitNot extends HInvokeUnary { |
2010 HBitNot(HInstruction input, Selector selector, TypeMask type) | 1979 HBitNot(input, selector, type) : super(input, selector, type); |
2011 : super(input, selector, type); | |
2012 accept(HVisitor visitor) => visitor.visitBitNot(this); | 1980 accept(HVisitor visitor) => visitor.visitBitNot(this); |
2013 | 1981 |
2014 UnaryOperation operation(ConstantSystem constantSystem) | 1982 UnaryOperation operation(ConstantSystem constantSystem) |
2015 => constantSystem.bitNot; | 1983 => constantSystem.bitNot; |
2016 int typeCode() => HInstruction.BIT_NOT_TYPECODE; | 1984 int typeCode() => HInstruction.BIT_NOT_TYPECODE; |
2017 bool typeEquals(other) => other is HBitNot; | 1985 bool typeEquals(other) => other is HBitNot; |
2018 bool dataEquals(HInstruction other) => true; | 1986 bool dataEquals(HInstruction other) => true; |
2019 } | 1987 } |
2020 | 1988 |
2021 class HExit extends HControlFlow { | 1989 class HExit extends HControlFlow { |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2404 * will fetch the interceptor of its first parameter, and make a call | 2372 * will fetch the interceptor of its first parameter, and make a call |
2405 * on a given selector with the remaining parameters. | 2373 * on a given selector with the remaining parameters. |
2406 * | 2374 * |
2407 * In order to share the same optimizations with regular interceptor | 2375 * In order to share the same optimizations with regular interceptor |
2408 * calls, this class extends [HInvokeDynamic] and also has the null | 2376 * calls, this class extends [HInvokeDynamic] and also has the null |
2409 * constant as the first input. | 2377 * constant as the first input. |
2410 */ | 2378 */ |
2411 class HOneShotInterceptor extends HInvokeDynamic { | 2379 class HOneShotInterceptor extends HInvokeDynamic { |
2412 Set<ClassElement> interceptedClasses; | 2380 Set<ClassElement> interceptedClasses; |
2413 HOneShotInterceptor(Selector selector, | 2381 HOneShotInterceptor(Selector selector, |
2414 TypeMask mask, | |
2415 List<HInstruction> inputs, | 2382 List<HInstruction> inputs, |
2416 TypeMask type, | 2383 TypeMask type, |
2417 this.interceptedClasses) | 2384 this.interceptedClasses) |
2418 : super(selector, mask, null, inputs, type, true) { | 2385 : super(selector, null, inputs, type, true) { |
2419 assert(inputs[0] is HConstant); | 2386 assert(inputs[0] is HConstant); |
2420 assert(inputs[0].isNull()); | 2387 assert(inputs[0].isNull()); |
2421 } | 2388 } |
2422 bool isCallOnInterceptor(Compiler compiler) => true; | 2389 bool isCallOnInterceptor(Compiler compiler) => true; |
2423 | 2390 |
2424 String toString() => 'one shot interceptor: selector=$selector, mask=$mask'; | 2391 String toString() => 'one shot interceptor on $selector'; |
2425 accept(HVisitor visitor) => visitor.visitOneShotInterceptor(this); | 2392 accept(HVisitor visitor) => visitor.visitOneShotInterceptor(this); |
2426 } | 2393 } |
2427 | 2394 |
2428 /** 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. */ |
2429 class HLazyStatic extends HInstruction { | 2396 class HLazyStatic extends HInstruction { |
2430 final Element element; | 2397 final Element element; |
2431 HLazyStatic(this.element, type) : super(<HInstruction>[], type) { | 2398 HLazyStatic(this.element, type) : super(<HInstruction>[], type) { |
2432 // TODO(4931): The first access has side-effects, but we afterwards we | 2399 // TODO(4931): The first access has side-effects, but we afterwards we |
2433 // should be able to GVN. | 2400 // should be able to GVN. |
2434 sideEffects.setAllSideEffects(); | 2401 sideEffects.setAllSideEffects(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2468 | 2435 |
2469 bool get isAllocation => true; | 2436 bool get isAllocation => true; |
2470 } | 2437 } |
2471 | 2438 |
2472 /** | 2439 /** |
2473 * The primitive array indexing operation. Note that this instruction | 2440 * The primitive array indexing operation. Note that this instruction |
2474 * does not throw because we generate the checks explicitly. | 2441 * does not throw because we generate the checks explicitly. |
2475 */ | 2442 */ |
2476 class HIndex extends HInstruction { | 2443 class HIndex extends HInstruction { |
2477 final Selector selector; | 2444 final Selector selector; |
2478 HIndex(HInstruction receiver, | 2445 HIndex(HInstruction receiver, HInstruction index, this.selector, type) |
2479 HInstruction index, | |
2480 this.selector, | |
2481 TypeMask type) | |
2482 : super(<HInstruction>[receiver, index], type) { | 2446 : super(<HInstruction>[receiver, index], type) { |
2483 sideEffects.clearAllSideEffects(); | 2447 sideEffects.clearAllSideEffects(); |
2484 sideEffects.clearAllDependencies(); | 2448 sideEffects.clearAllDependencies(); |
2485 sideEffects.setDependsOnIndexStore(); | 2449 sideEffects.setDependsOnIndexStore(); |
2486 setUseGvn(); | 2450 setUseGvn(); |
2487 } | 2451 } |
2488 | 2452 |
2489 String toString() => 'index operator'; | 2453 String toString() => 'index operator'; |
2490 accept(HVisitor visitor) => visitor.visitIndex(this); | 2454 accept(HVisitor visitor) => visitor.visitIndex(this); |
2491 | 2455 |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3217 class HDynamicType extends HRuntimeType { | 3181 class HDynamicType extends HRuntimeType { |
3218 HDynamicType(DynamicType dartType, TypeMask instructionType) | 3182 HDynamicType(DynamicType dartType, TypeMask instructionType) |
3219 : super(const <HInstruction>[], dartType, instructionType); | 3183 : super(const <HInstruction>[], dartType, instructionType); |
3220 | 3184 |
3221 accept(HVisitor visitor) => visitor.visitDynamicType(this); | 3185 accept(HVisitor visitor) => visitor.visitDynamicType(this); |
3222 | 3186 |
3223 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; | 3187 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; |
3224 | 3188 |
3225 bool typeEquals(HInstruction other) => other is HDynamicType; | 3189 bool typeEquals(HInstruction other) => other is HDynamicType; |
3226 } | 3190 } |
OLD | NEW |