Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: pkg/compiler/lib/src/ssa/nodes.dart

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

Powered by Google App Engine
This is Rietveld 408576698