Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 710 virtual HType CalculateInferredType() const; | 710 virtual HType CalculateInferredType() const; |
| 711 | 711 |
| 712 // Helper for type conversions used by normal and phi instructions. | 712 // Helper for type conversions used by normal and phi instructions. |
| 713 void InsertInputConversion(HInstruction* previous, int index, HType type); | 713 void InsertInputConversion(HInstruction* previous, int index, HType type); |
| 714 | 714 |
| 715 #ifdef DEBUG | 715 #ifdef DEBUG |
| 716 virtual void Verify() const = 0; | 716 virtual void Verify() const = 0; |
| 717 #endif | 717 #endif |
| 718 | 718 |
| 719 protected: | 719 protected: |
| 720 virtual bool DataEquals(HValue* other) const { return true; } | 720 // This function must be overridden for instructions with flag kUseGVN, to |
| 721 // compare the non-Operand parts of the instruction. | |
| 722 virtual bool DataEquals(HValue* other) const { | |
| 723 UNREACHABLE(); | |
| 724 return false; | |
| 725 } | |
| 721 virtual void RepresentationChanged(Representation to) { } | 726 virtual void RepresentationChanged(Representation to) { } |
| 722 virtual Range* InferRange(); | 727 virtual Range* InferRange(); |
| 723 virtual void DeleteFromGraph() = 0; | 728 virtual void DeleteFromGraph() = 0; |
| 724 virtual void InternalSetOperandAt(int index, HValue* value) { UNREACHABLE(); } | 729 virtual void InternalSetOperandAt(int index, HValue* value) { UNREACHABLE(); } |
| 725 void clear_block() { | 730 void clear_block() { |
| 726 ASSERT(block_ != NULL); | 731 ASSERT(block_ != NULL); |
| 727 block_ = NULL; | 732 block_ = NULL; |
| 728 } | 733 } |
| 729 | 734 |
| 730 void set_representation(Representation r) { | 735 void set_representation(Representation r) { |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1151 | 1156 |
| 1152 class HGlobalObject: public HInstruction { | 1157 class HGlobalObject: public HInstruction { |
| 1153 public: | 1158 public: |
| 1154 HGlobalObject() { | 1159 HGlobalObject() { |
| 1155 set_representation(Representation::Tagged()); | 1160 set_representation(Representation::Tagged()); |
| 1156 SetFlag(kUseGVN); | 1161 SetFlag(kUseGVN); |
| 1157 SetFlag(kDependsOnCalls); | 1162 SetFlag(kDependsOnCalls); |
| 1158 } | 1163 } |
| 1159 | 1164 |
| 1160 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global_object") | 1165 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global_object") |
| 1166 | |
| 1167 protected: | |
| 1168 virtual bool DataEquals(HValue* other) const { return true; } | |
| 1161 }; | 1169 }; |
| 1162 | 1170 |
| 1163 | 1171 |
| 1164 class HGlobalReceiver: public HInstruction { | 1172 class HGlobalReceiver: public HInstruction { |
| 1165 public: | 1173 public: |
| 1166 HGlobalReceiver() { | 1174 HGlobalReceiver() { |
| 1167 set_representation(Representation::Tagged()); | 1175 set_representation(Representation::Tagged()); |
| 1168 SetFlag(kUseGVN); | 1176 SetFlag(kUseGVN); |
| 1169 SetFlag(kDependsOnCalls); | 1177 SetFlag(kDependsOnCalls); |
| 1170 } | 1178 } |
| 1171 | 1179 |
| 1172 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global_receiver") | 1180 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global_receiver") |
| 1181 | |
| 1182 protected: | |
| 1183 virtual bool DataEquals(HValue* other) const { return true; } | |
| 1173 }; | 1184 }; |
| 1174 | 1185 |
| 1175 | 1186 |
| 1176 class HCall: public HInstruction { | 1187 class HCall: public HInstruction { |
| 1177 public: | 1188 public: |
| 1178 // Construct a call with uninitialized arguments. The argument count | 1189 // Construct a call with uninitialized arguments. The argument count |
| 1179 // includes the receiver. | 1190 // includes the receiver. |
| 1180 explicit HCall(int count); | 1191 explicit HCall(int count); |
| 1181 | 1192 |
| 1182 virtual HType CalculateInferredType() const { return HType::Tagged(); } | 1193 virtual HType CalculateInferredType() const { return HType::Tagged(); } |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1353 set_representation(Representation::Tagged()); | 1364 set_representation(Representation::Tagged()); |
| 1354 SetFlag(kDependsOnArrayLengths); | 1365 SetFlag(kDependsOnArrayLengths); |
| 1355 SetFlag(kUseGVN); | 1366 SetFlag(kUseGVN); |
| 1356 } | 1367 } |
| 1357 | 1368 |
| 1358 virtual Representation RequiredInputRepresentation(int index) const { | 1369 virtual Representation RequiredInputRepresentation(int index) const { |
| 1359 return Representation::Tagged(); | 1370 return Representation::Tagged(); |
| 1360 } | 1371 } |
| 1361 | 1372 |
| 1362 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js_array_length") | 1373 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js_array_length") |
| 1374 | |
| 1375 protected: | |
| 1376 virtual bool DataEquals(HValue* other) const { return true; } | |
| 1363 }; | 1377 }; |
| 1364 | 1378 |
| 1365 | 1379 |
| 1366 class HFixedArrayLength: public HUnaryOperation { | 1380 class HFixedArrayLength: public HUnaryOperation { |
| 1367 public: | 1381 public: |
| 1368 explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) { | 1382 explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) { |
| 1369 set_representation(Representation::Tagged()); | 1383 set_representation(Representation::Tagged()); |
| 1370 SetFlag(kDependsOnArrayLengths); | 1384 SetFlag(kDependsOnArrayLengths); |
| 1371 SetFlag(kUseGVN); | 1385 SetFlag(kUseGVN); |
| 1372 } | 1386 } |
| 1373 | 1387 |
| 1374 virtual Representation RequiredInputRepresentation(int index) const { | 1388 virtual Representation RequiredInputRepresentation(int index) const { |
| 1375 return Representation::Tagged(); | 1389 return Representation::Tagged(); |
| 1376 } | 1390 } |
| 1377 | 1391 |
| 1378 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed_array_length") | 1392 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed_array_length") |
| 1393 | |
| 1394 protected: | |
| 1395 virtual bool DataEquals(HValue* other) const { return true; } | |
| 1379 }; | 1396 }; |
| 1380 | 1397 |
| 1381 | 1398 |
| 1382 class HBitNot: public HUnaryOperation { | 1399 class HBitNot: public HUnaryOperation { |
| 1383 public: | 1400 public: |
| 1384 explicit HBitNot(HValue* value) : HUnaryOperation(value) { | 1401 explicit HBitNot(HValue* value) : HUnaryOperation(value) { |
| 1385 set_representation(Representation::Integer32()); | 1402 set_representation(Representation::Integer32()); |
| 1386 SetFlag(kUseGVN); | 1403 SetFlag(kUseGVN); |
| 1387 SetFlag(kTruncatingToInt32); | 1404 SetFlag(kTruncatingToInt32); |
| 1388 } | 1405 } |
| 1389 | 1406 |
| 1390 virtual Representation RequiredInputRepresentation(int index) const { | 1407 virtual Representation RequiredInputRepresentation(int index) const { |
| 1391 return Representation::Integer32(); | 1408 return Representation::Integer32(); |
| 1392 } | 1409 } |
| 1393 virtual HType CalculateInferredType() const; | 1410 virtual HType CalculateInferredType() const; |
| 1394 | 1411 |
| 1395 DECLARE_CONCRETE_INSTRUCTION(BitNot, "bit_not") | 1412 DECLARE_CONCRETE_INSTRUCTION(BitNot, "bit_not") |
| 1413 | |
| 1414 protected: | |
| 1415 virtual bool DataEquals(HValue* other) const { return true; } | |
| 1396 }; | 1416 }; |
| 1397 | 1417 |
| 1398 | 1418 |
| 1399 class HUnaryMathOperation: public HUnaryOperation { | 1419 class HUnaryMathOperation: public HUnaryOperation { |
| 1400 public: | 1420 public: |
| 1401 HUnaryMathOperation(HValue* value, BuiltinFunctionId op) | 1421 HUnaryMathOperation(HValue* value, BuiltinFunctionId op) |
| 1402 : HUnaryOperation(value), op_(op) { | 1422 : HUnaryOperation(value), op_(op) { |
| 1403 switch (op) { | 1423 switch (op) { |
| 1404 case kMathFloor: | 1424 case kMathFloor: |
| 1405 case kMathRound: | 1425 case kMathRound: |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1481 set_representation(Representation::Tagged()); | 1501 set_representation(Representation::Tagged()); |
| 1482 SetFlag(kUseGVN); | 1502 SetFlag(kUseGVN); |
| 1483 SetFlag(kDependsOnMaps); | 1503 SetFlag(kDependsOnMaps); |
| 1484 } | 1504 } |
| 1485 | 1505 |
| 1486 virtual Representation RequiredInputRepresentation(int index) const { | 1506 virtual Representation RequiredInputRepresentation(int index) const { |
| 1487 return Representation::Tagged(); | 1507 return Representation::Tagged(); |
| 1488 } | 1508 } |
| 1489 | 1509 |
| 1490 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements") | 1510 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements") |
| 1511 | |
| 1512 protected: | |
| 1513 virtual bool DataEquals(HValue* other) const { return true; } | |
| 1491 }; | 1514 }; |
| 1492 | 1515 |
| 1493 | 1516 |
| 1494 class HCheckMap: public HUnaryOperation { | 1517 class HCheckMap: public HUnaryOperation { |
| 1495 public: | 1518 public: |
| 1496 HCheckMap(HValue* value, Handle<Map> map) | 1519 HCheckMap(HValue* value, Handle<Map> map) |
| 1497 : HUnaryOperation(value), map_(map) { | 1520 : HUnaryOperation(value), map_(map) { |
| 1498 set_representation(Representation::Tagged()); | 1521 set_representation(Representation::Tagged()); |
| 1499 SetFlag(kUseGVN); | 1522 SetFlag(kUseGVN); |
| 1500 SetFlag(kDependsOnMaps); | 1523 SetFlag(kDependsOnMaps); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1624 return Representation::Tagged(); | 1647 return Representation::Tagged(); |
| 1625 } | 1648 } |
| 1626 | 1649 |
| 1627 virtual HType CalculateInferredType() const; | 1650 virtual HType CalculateInferredType() const; |
| 1628 | 1651 |
| 1629 #ifdef DEBUG | 1652 #ifdef DEBUG |
| 1630 virtual void Verify() const; | 1653 virtual void Verify() const; |
| 1631 #endif | 1654 #endif |
| 1632 | 1655 |
| 1633 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check_non_smi") | 1656 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check_non_smi") |
| 1657 | |
| 1658 protected: | |
| 1659 virtual bool DataEquals(HValue* other) const { return true; } | |
| 1634 }; | 1660 }; |
| 1635 | 1661 |
| 1636 | 1662 |
| 1637 class HCheckPrototypeMaps: public HInstruction { | 1663 class HCheckPrototypeMaps: public HInstruction { |
| 1638 public: | 1664 public: |
| 1639 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder) | 1665 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder) |
| 1640 : prototype_(prototype), holder_(holder) { | 1666 : prototype_(prototype), holder_(holder) { |
| 1641 SetFlag(kUseGVN); | 1667 SetFlag(kUseGVN); |
| 1642 SetFlag(kDependsOnMaps); | 1668 SetFlag(kDependsOnMaps); |
| 1643 } | 1669 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1685 virtual Representation RequiredInputRepresentation(int index) const { | 1711 virtual Representation RequiredInputRepresentation(int index) const { |
| 1686 return Representation::Tagged(); | 1712 return Representation::Tagged(); |
| 1687 } | 1713 } |
| 1688 virtual HType CalculateInferredType() const; | 1714 virtual HType CalculateInferredType() const; |
| 1689 | 1715 |
| 1690 #ifdef DEBUG | 1716 #ifdef DEBUG |
| 1691 virtual void Verify() const; | 1717 virtual void Verify() const; |
| 1692 #endif | 1718 #endif |
| 1693 | 1719 |
| 1694 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check_smi") | 1720 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check_smi") |
| 1721 | |
| 1722 protected: | |
| 1723 virtual bool DataEquals(HValue* other) const { return true; } | |
| 1695 }; | 1724 }; |
| 1696 | 1725 |
| 1697 | 1726 |
| 1698 class HPhi: public HValue { | 1727 class HPhi: public HValue { |
| 1699 public: | 1728 public: |
| 1700 explicit HPhi(int merged_index) | 1729 explicit HPhi(int merged_index) |
| 1701 : inputs_(2), | 1730 : inputs_(2), |
| 1702 merged_index_(merged_index), | 1731 merged_index_(merged_index), |
| 1703 phi_id_(-1) { | 1732 phi_id_(-1) { |
| 1704 for (int i = 0; i < Representation::kNumRepresentations; i++) { | 1733 for (int i = 0; i < Representation::kNumRepresentations; i++) { |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1944 class HArgumentsElements: public HInstruction { | 1973 class HArgumentsElements: public HInstruction { |
| 1945 public: | 1974 public: |
| 1946 HArgumentsElements() { | 1975 HArgumentsElements() { |
| 1947 // The value produced by this instruction is a pointer into the stack | 1976 // The value produced by this instruction is a pointer into the stack |
| 1948 // that looks as if it was a smi because of alignment. | 1977 // that looks as if it was a smi because of alignment. |
| 1949 set_representation(Representation::Tagged()); | 1978 set_representation(Representation::Tagged()); |
| 1950 SetFlag(kUseGVN); | 1979 SetFlag(kUseGVN); |
| 1951 } | 1980 } |
| 1952 | 1981 |
| 1953 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments_elements") | 1982 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments_elements") |
| 1983 | |
| 1984 protected: | |
| 1985 virtual bool DataEquals(HValue* other) const { return true; } | |
| 1954 }; | 1986 }; |
| 1955 | 1987 |
| 1956 | 1988 |
| 1957 class HArgumentsLength: public HUnaryOperation { | 1989 class HArgumentsLength: public HUnaryOperation { |
| 1958 public: | 1990 public: |
| 1959 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { | 1991 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { |
| 1960 set_representation(Representation::Integer32()); | 1992 set_representation(Representation::Integer32()); |
| 1961 SetFlag(kUseGVN); | 1993 SetFlag(kUseGVN); |
| 1962 } | 1994 } |
| 1963 | 1995 |
| 1964 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments_length") | 1996 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments_length") |
| 1997 | |
| 1998 protected: | |
| 1999 virtual bool DataEquals(HValue* other) const { return true; } | |
| 1965 }; | 2000 }; |
| 1966 | 2001 |
| 1967 | 2002 |
| 1968 class HAccessArgumentsAt: public HInstruction { | 2003 class HAccessArgumentsAt: public HInstruction { |
| 1969 public: | 2004 public: |
| 1970 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { | 2005 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { |
| 1971 set_representation(Representation::Tagged()); | 2006 set_representation(Representation::Tagged()); |
| 1972 SetFlag(kUseGVN); | 2007 SetFlag(kUseGVN); |
| 1973 SetOperandAt(0, arguments); | 2008 SetOperandAt(0, arguments); |
| 1974 SetOperandAt(1, length); | 2009 SetOperandAt(1, length); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1991 virtual int OperandCount() const { return operands_.length(); } | 2026 virtual int OperandCount() const { return operands_.length(); } |
| 1992 virtual HValue* OperandAt(int index) const { return operands_[index]; } | 2027 virtual HValue* OperandAt(int index) const { return operands_[index]; } |
| 1993 | 2028 |
| 1994 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access_arguments_at") | 2029 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access_arguments_at") |
| 1995 | 2030 |
| 1996 protected: | 2031 protected: |
| 1997 virtual void InternalSetOperandAt(int index, HValue* value) { | 2032 virtual void InternalSetOperandAt(int index, HValue* value) { |
| 1998 operands_[index] = value; | 2033 operands_[index] = value; |
| 1999 } | 2034 } |
| 2000 | 2035 |
| 2036 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2037 | |
| 2001 private: | 2038 private: |
| 2002 HOperandVector<3> operands_; | 2039 HOperandVector<3> operands_; |
| 2003 }; | 2040 }; |
| 2004 | 2041 |
| 2005 | 2042 |
| 2006 class HBoundsCheck: public HBinaryOperation { | 2043 class HBoundsCheck: public HBinaryOperation { |
| 2007 public: | 2044 public: |
| 2008 HBoundsCheck(HValue* index, HValue* length) | 2045 HBoundsCheck(HValue* index, HValue* length) |
| 2009 : HBinaryOperation(index, length) { | 2046 : HBinaryOperation(index, length) { |
| 2010 SetFlag(kUseGVN); | 2047 SetFlag(kUseGVN); |
| 2011 } | 2048 } |
| 2012 | 2049 |
| 2013 virtual bool IsCheckInstruction() const { return true; } | 2050 virtual bool IsCheckInstruction() const { return true; } |
| 2014 | 2051 |
| 2015 virtual Representation RequiredInputRepresentation(int index) const { | 2052 virtual Representation RequiredInputRepresentation(int index) const { |
| 2016 return Representation::Integer32(); | 2053 return Representation::Integer32(); |
| 2017 } | 2054 } |
| 2018 | 2055 |
| 2019 #ifdef DEBUG | 2056 #ifdef DEBUG |
| 2020 virtual void Verify() const; | 2057 virtual void Verify() const; |
| 2021 #endif | 2058 #endif |
| 2022 | 2059 |
| 2023 HValue* index() const { return left(); } | 2060 HValue* index() const { return left(); } |
| 2024 HValue* length() const { return right(); } | 2061 HValue* length() const { return right(); } |
| 2025 | 2062 |
| 2026 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds_check") | 2063 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds_check") |
| 2064 | |
| 2065 protected: | |
| 2066 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2027 }; | 2067 }; |
| 2028 | 2068 |
| 2029 | 2069 |
| 2030 class HBitwiseBinaryOperation: public HBinaryOperation { | 2070 class HBitwiseBinaryOperation: public HBinaryOperation { |
| 2031 public: | 2071 public: |
| 2032 HBitwiseBinaryOperation(HValue* left, HValue* right) | 2072 HBitwiseBinaryOperation(HValue* left, HValue* right) |
| 2033 : HBinaryOperation(left, right) { | 2073 : HBinaryOperation(left, right) { |
| 2034 set_representation(Representation::Tagged()); | 2074 set_representation(Representation::Tagged()); |
| 2035 SetFlag(kFlexibleRepresentation); | 2075 SetFlag(kFlexibleRepresentation); |
| 2036 SetFlagMask(AllSideEffects()); | 2076 SetFlagMask(AllSideEffects()); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2134 SetFlag(kUseGVN); | 2174 SetFlag(kUseGVN); |
| 2135 } | 2175 } |
| 2136 | 2176 |
| 2137 virtual bool EmitAtUses() const { return uses()->length() <= 1; } | 2177 virtual bool EmitAtUses() const { return uses()->length() <= 1; } |
| 2138 virtual Representation RequiredInputRepresentation(int index) const { | 2178 virtual Representation RequiredInputRepresentation(int index) const { |
| 2139 return Representation::Tagged(); | 2179 return Representation::Tagged(); |
| 2140 } | 2180 } |
| 2141 virtual HType CalculateInferredType() const; | 2181 virtual HType CalculateInferredType() const; |
| 2142 | 2182 |
| 2143 DECLARE_CONCRETE_INSTRUCTION(CompareJSObjectEq, "compare-js-object-eq") | 2183 DECLARE_CONCRETE_INSTRUCTION(CompareJSObjectEq, "compare-js-object-eq") |
| 2184 | |
| 2185 protected: | |
| 2186 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2144 }; | 2187 }; |
| 2145 | 2188 |
| 2146 | 2189 |
| 2147 class HUnaryPredicate: public HUnaryOperation { | 2190 class HUnaryPredicate: public HUnaryOperation { |
| 2148 public: | 2191 public: |
| 2149 explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) { | 2192 explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) { |
| 2150 set_representation(Representation::Tagged()); | 2193 set_representation(Representation::Tagged()); |
| 2151 SetFlag(kUseGVN); | 2194 SetFlag(kUseGVN); |
| 2152 } | 2195 } |
| 2153 virtual bool EmitAtUses() const { return uses()->length() <= 1; } | 2196 virtual bool EmitAtUses() const { return uses()->length() <= 1; } |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 2176 private: | 2219 private: |
| 2177 bool is_strict_; | 2220 bool is_strict_; |
| 2178 }; | 2221 }; |
| 2179 | 2222 |
| 2180 | 2223 |
| 2181 class HIsObject: public HUnaryPredicate { | 2224 class HIsObject: public HUnaryPredicate { |
| 2182 public: | 2225 public: |
| 2183 explicit HIsObject(HValue* value) : HUnaryPredicate(value) { } | 2226 explicit HIsObject(HValue* value) : HUnaryPredicate(value) { } |
| 2184 | 2227 |
| 2185 DECLARE_CONCRETE_INSTRUCTION(IsObject, "is_object") | 2228 DECLARE_CONCRETE_INSTRUCTION(IsObject, "is_object") |
| 2229 | |
| 2230 protected: | |
| 2231 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2186 }; | 2232 }; |
| 2187 | 2233 |
| 2188 | 2234 |
| 2189 class HIsSmi: public HUnaryPredicate { | 2235 class HIsSmi: public HUnaryPredicate { |
| 2190 public: | 2236 public: |
| 2191 explicit HIsSmi(HValue* value) : HUnaryPredicate(value) { } | 2237 explicit HIsSmi(HValue* value) : HUnaryPredicate(value) { } |
| 2192 | 2238 |
| 2193 DECLARE_CONCRETE_INSTRUCTION(IsSmi, "is_smi") | 2239 DECLARE_CONCRETE_INSTRUCTION(IsSmi, "is_smi") |
| 2240 | |
| 2241 protected: | |
| 2242 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2194 }; | 2243 }; |
| 2195 | 2244 |
| 2196 | 2245 |
| 2197 class HHasInstanceType: public HUnaryPredicate { | 2246 class HHasInstanceType: public HUnaryPredicate { |
| 2198 public: | 2247 public: |
| 2199 HHasInstanceType(HValue* value, InstanceType type) | 2248 HHasInstanceType(HValue* value, InstanceType type) |
| 2200 : HUnaryPredicate(value), from_(type), to_(type) { } | 2249 : HUnaryPredicate(value), from_(type), to_(type) { } |
| 2201 HHasInstanceType(HValue* value, InstanceType from, InstanceType to) | 2250 HHasInstanceType(HValue* value, InstanceType from, InstanceType to) |
| 2202 : HUnaryPredicate(value), from_(from), to_(to) { | 2251 : HUnaryPredicate(value), from_(from), to_(to) { |
| 2203 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. | 2252 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 2220 InstanceType from_; | 2269 InstanceType from_; |
| 2221 InstanceType to_; // Inclusive range, not all combinations work. | 2270 InstanceType to_; // Inclusive range, not all combinations work. |
| 2222 }; | 2271 }; |
| 2223 | 2272 |
| 2224 | 2273 |
| 2225 class HHasCachedArrayIndex: public HUnaryPredicate { | 2274 class HHasCachedArrayIndex: public HUnaryPredicate { |
| 2226 public: | 2275 public: |
| 2227 explicit HHasCachedArrayIndex(HValue* value) : HUnaryPredicate(value) { } | 2276 explicit HHasCachedArrayIndex(HValue* value) : HUnaryPredicate(value) { } |
| 2228 | 2277 |
| 2229 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndex, "has_cached_array_index") | 2278 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndex, "has_cached_array_index") |
| 2279 | |
| 2280 protected: | |
| 2281 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2230 }; | 2282 }; |
| 2231 | 2283 |
| 2232 | 2284 |
| 2233 class HClassOfTest: public HUnaryPredicate { | 2285 class HClassOfTest: public HUnaryPredicate { |
| 2234 public: | 2286 public: |
| 2235 HClassOfTest(HValue* value, Handle<String> class_name) | 2287 HClassOfTest(HValue* value, Handle<String> class_name) |
| 2236 : HUnaryPredicate(value), class_name_(class_name) { } | 2288 : HUnaryPredicate(value), class_name_(class_name) { } |
| 2237 | 2289 |
| 2238 DECLARE_CONCRETE_INSTRUCTION(ClassOfTest, "class_of_test") | 2290 DECLARE_CONCRETE_INSTRUCTION(ClassOfTest, "class_of_test") |
| 2239 | 2291 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2318 : HBinaryOperation(left, right) { | 2370 : HBinaryOperation(left, right) { |
| 2319 set_representation(Representation::Double()); | 2371 set_representation(Representation::Double()); |
| 2320 SetFlag(kUseGVN); | 2372 SetFlag(kUseGVN); |
| 2321 } | 2373 } |
| 2322 | 2374 |
| 2323 virtual Representation RequiredInputRepresentation(int index) const { | 2375 virtual Representation RequiredInputRepresentation(int index) const { |
| 2324 return (index == 1) ? Representation::None() : Representation::Double(); | 2376 return (index == 1) ? Representation::None() : Representation::Double(); |
| 2325 } | 2377 } |
| 2326 | 2378 |
| 2327 DECLARE_CONCRETE_INSTRUCTION(Power, "power") | 2379 DECLARE_CONCRETE_INSTRUCTION(Power, "power") |
| 2380 | |
| 2381 protected: | |
| 2382 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2328 }; | 2383 }; |
| 2329 | 2384 |
| 2330 | 2385 |
| 2331 class HAdd: public HArithmeticBinaryOperation { | 2386 class HAdd: public HArithmeticBinaryOperation { |
| 2332 public: | 2387 public: |
| 2333 HAdd(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { | 2388 HAdd(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { |
| 2334 SetFlag(kCanOverflow); | 2389 SetFlag(kCanOverflow); |
| 2335 } | 2390 } |
| 2336 | 2391 |
| 2337 // Add is only commutative if two integer values are added and not if two | 2392 // Add is only commutative if two integer values are added and not if two |
| 2338 // tagged values are added (because it might be a String concatenation). | 2393 // tagged values are added (because it might be a String concatenation). |
| 2339 virtual bool IsCommutative() const { | 2394 virtual bool IsCommutative() const { |
| 2340 return !representation().IsTagged(); | 2395 return !representation().IsTagged(); |
| 2341 } | 2396 } |
| 2342 | 2397 |
| 2343 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 2398 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 2344 | 2399 |
| 2345 virtual HType CalculateInferredType() const; | 2400 virtual HType CalculateInferredType() const; |
| 2346 | 2401 |
| 2347 DECLARE_CONCRETE_INSTRUCTION(Add, "add") | 2402 DECLARE_CONCRETE_INSTRUCTION(Add, "add") |
| 2348 | 2403 |
| 2349 protected: | 2404 protected: |
| 2405 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2406 | |
| 2350 virtual Range* InferRange(); | 2407 virtual Range* InferRange(); |
| 2351 }; | 2408 }; |
| 2352 | 2409 |
| 2353 | 2410 |
| 2354 class HSub: public HArithmeticBinaryOperation { | 2411 class HSub: public HArithmeticBinaryOperation { |
| 2355 public: | 2412 public: |
| 2356 HSub(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { | 2413 HSub(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { |
| 2357 SetFlag(kCanOverflow); | 2414 SetFlag(kCanOverflow); |
| 2358 } | 2415 } |
| 2359 | 2416 |
| 2360 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 2417 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 2361 | 2418 |
| 2362 DECLARE_CONCRETE_INSTRUCTION(Sub, "sub") | 2419 DECLARE_CONCRETE_INSTRUCTION(Sub, "sub") |
| 2363 | 2420 |
| 2364 protected: | 2421 protected: |
| 2422 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2423 | |
| 2365 virtual Range* InferRange(); | 2424 virtual Range* InferRange(); |
| 2366 }; | 2425 }; |
| 2367 | 2426 |
| 2368 | 2427 |
| 2369 class HMul: public HArithmeticBinaryOperation { | 2428 class HMul: public HArithmeticBinaryOperation { |
| 2370 public: | 2429 public: |
| 2371 HMul(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { | 2430 HMul(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { |
| 2372 SetFlag(kCanOverflow); | 2431 SetFlag(kCanOverflow); |
| 2373 } | 2432 } |
| 2374 | 2433 |
| 2375 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 2434 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 2376 | 2435 |
| 2377 // Only commutative if it is certain that not two objects are multiplicated. | 2436 // Only commutative if it is certain that not two objects are multiplicated. |
| 2378 virtual bool IsCommutative() const { | 2437 virtual bool IsCommutative() const { |
| 2379 return !representation().IsTagged(); | 2438 return !representation().IsTagged(); |
| 2380 } | 2439 } |
| 2381 | 2440 |
| 2382 DECLARE_CONCRETE_INSTRUCTION(Mul, "mul") | 2441 DECLARE_CONCRETE_INSTRUCTION(Mul, "mul") |
| 2383 | 2442 |
| 2384 protected: | 2443 protected: |
| 2444 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2445 | |
| 2385 virtual Range* InferRange(); | 2446 virtual Range* InferRange(); |
| 2386 }; | 2447 }; |
| 2387 | 2448 |
| 2388 | 2449 |
| 2389 class HMod: public HArithmeticBinaryOperation { | 2450 class HMod: public HArithmeticBinaryOperation { |
| 2390 public: | 2451 public: |
| 2391 HMod(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { | 2452 HMod(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { |
| 2392 SetFlag(kCanBeDivByZero); | 2453 SetFlag(kCanBeDivByZero); |
| 2393 } | 2454 } |
| 2394 | 2455 |
| 2395 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 2456 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 2396 | 2457 |
| 2397 DECLARE_CONCRETE_INSTRUCTION(Mod, "mod") | 2458 DECLARE_CONCRETE_INSTRUCTION(Mod, "mod") |
| 2398 | 2459 |
| 2399 protected: | 2460 protected: |
| 2461 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2462 | |
| 2400 virtual Range* InferRange(); | 2463 virtual Range* InferRange(); |
| 2401 }; | 2464 }; |
| 2402 | 2465 |
| 2403 | 2466 |
| 2404 class HDiv: public HArithmeticBinaryOperation { | 2467 class HDiv: public HArithmeticBinaryOperation { |
| 2405 public: | 2468 public: |
| 2406 HDiv(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { | 2469 HDiv(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { |
| 2407 SetFlag(kCanBeDivByZero); | 2470 SetFlag(kCanBeDivByZero); |
| 2408 SetFlag(kCanOverflow); | 2471 SetFlag(kCanOverflow); |
| 2409 } | 2472 } |
| 2410 | 2473 |
| 2411 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 2474 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 2412 | 2475 |
| 2413 DECLARE_CONCRETE_INSTRUCTION(Div, "div") | 2476 DECLARE_CONCRETE_INSTRUCTION(Div, "div") |
| 2414 | 2477 |
| 2415 protected: | 2478 protected: |
| 2479 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2480 | |
| 2416 virtual Range* InferRange(); | 2481 virtual Range* InferRange(); |
| 2417 }; | 2482 }; |
| 2418 | 2483 |
| 2419 | 2484 |
| 2420 class HBitAnd: public HBitwiseBinaryOperation { | 2485 class HBitAnd: public HBitwiseBinaryOperation { |
| 2421 public: | 2486 public: |
| 2422 HBitAnd(HValue* left, HValue* right) | 2487 HBitAnd(HValue* left, HValue* right) |
| 2423 : HBitwiseBinaryOperation(left, right) { } | 2488 : HBitwiseBinaryOperation(left, right) { } |
| 2424 | 2489 |
| 2425 virtual bool IsCommutative() const { return true; } | 2490 virtual bool IsCommutative() const { return true; } |
| 2426 virtual HType CalculateInferredType() const; | 2491 virtual HType CalculateInferredType() const; |
| 2427 | 2492 |
| 2428 DECLARE_CONCRETE_INSTRUCTION(BitAnd, "bit_and") | 2493 DECLARE_CONCRETE_INSTRUCTION(BitAnd, "bit_and") |
| 2429 | 2494 |
| 2430 protected: | 2495 protected: |
| 2496 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2497 | |
| 2431 virtual Range* InferRange(); | 2498 virtual Range* InferRange(); |
| 2432 }; | 2499 }; |
| 2433 | 2500 |
| 2434 | 2501 |
| 2435 class HBitXor: public HBitwiseBinaryOperation { | 2502 class HBitXor: public HBitwiseBinaryOperation { |
| 2436 public: | 2503 public: |
| 2437 HBitXor(HValue* left, HValue* right) | 2504 HBitXor(HValue* left, HValue* right) |
| 2438 : HBitwiseBinaryOperation(left, right) { } | 2505 : HBitwiseBinaryOperation(left, right) { } |
| 2439 | 2506 |
| 2440 virtual bool IsCommutative() const { return true; } | 2507 virtual bool IsCommutative() const { return true; } |
| 2441 virtual HType CalculateInferredType() const; | 2508 virtual HType CalculateInferredType() const; |
| 2442 | 2509 |
| 2443 DECLARE_CONCRETE_INSTRUCTION(BitXor, "bit_xor") | 2510 DECLARE_CONCRETE_INSTRUCTION(BitXor, "bit_xor") |
| 2511 | |
| 2512 protected: | |
| 2513 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2444 }; | 2514 }; |
| 2445 | 2515 |
| 2446 | 2516 |
| 2447 class HBitOr: public HBitwiseBinaryOperation { | 2517 class HBitOr: public HBitwiseBinaryOperation { |
| 2448 public: | 2518 public: |
| 2449 HBitOr(HValue* left, HValue* right) | 2519 HBitOr(HValue* left, HValue* right) |
| 2450 : HBitwiseBinaryOperation(left, right) { } | 2520 : HBitwiseBinaryOperation(left, right) { } |
| 2451 | 2521 |
| 2452 virtual bool IsCommutative() const { return true; } | 2522 virtual bool IsCommutative() const { return true; } |
| 2453 virtual HType CalculateInferredType() const; | 2523 virtual HType CalculateInferredType() const; |
| 2454 | 2524 |
| 2455 DECLARE_CONCRETE_INSTRUCTION(BitOr, "bit_or") | 2525 DECLARE_CONCRETE_INSTRUCTION(BitOr, "bit_or") |
| 2456 | 2526 |
| 2457 protected: | 2527 protected: |
| 2528 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2529 | |
| 2458 virtual Range* InferRange(); | 2530 virtual Range* InferRange(); |
| 2459 }; | 2531 }; |
| 2460 | 2532 |
| 2461 | 2533 |
| 2462 class HShl: public HBitwiseBinaryOperation { | 2534 class HShl: public HBitwiseBinaryOperation { |
| 2463 public: | 2535 public: |
| 2464 HShl(HValue* left, HValue* right) | 2536 HShl(HValue* left, HValue* right) |
| 2465 : HBitwiseBinaryOperation(left, right) { } | 2537 : HBitwiseBinaryOperation(left, right) { } |
| 2466 | 2538 |
| 2467 virtual Range* InferRange(); | 2539 virtual Range* InferRange(); |
| 2468 virtual HType CalculateInferredType() const; | 2540 virtual HType CalculateInferredType() const; |
| 2469 | 2541 |
| 2470 DECLARE_CONCRETE_INSTRUCTION(Shl, "shl") | 2542 DECLARE_CONCRETE_INSTRUCTION(Shl, "shl") |
| 2543 | |
| 2544 protected: | |
| 2545 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2471 }; | 2546 }; |
| 2472 | 2547 |
| 2473 | 2548 |
| 2474 class HShr: public HBitwiseBinaryOperation { | 2549 class HShr: public HBitwiseBinaryOperation { |
| 2475 public: | 2550 public: |
| 2476 HShr(HValue* left, HValue* right) | 2551 HShr(HValue* left, HValue* right) |
| 2477 : HBitwiseBinaryOperation(left, right) { } | 2552 : HBitwiseBinaryOperation(left, right) { } |
| 2478 | 2553 |
| 2479 virtual HType CalculateInferredType() const; | 2554 virtual HType CalculateInferredType() const; |
| 2480 | 2555 |
| 2481 DECLARE_CONCRETE_INSTRUCTION(Shr, "shr") | 2556 DECLARE_CONCRETE_INSTRUCTION(Shr, "shr") |
| 2557 | |
| 2558 protected: | |
| 2559 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2482 }; | 2560 }; |
| 2483 | 2561 |
| 2484 | 2562 |
| 2485 class HSar: public HBitwiseBinaryOperation { | 2563 class HSar: public HBitwiseBinaryOperation { |
| 2486 public: | 2564 public: |
| 2487 HSar(HValue* left, HValue* right) | 2565 HSar(HValue* left, HValue* right) |
| 2488 : HBitwiseBinaryOperation(left, right) { } | 2566 : HBitwiseBinaryOperation(left, right) { } |
| 2489 | 2567 |
| 2490 virtual Range* InferRange(); | 2568 virtual Range* InferRange(); |
| 2491 virtual HType CalculateInferredType() const; | 2569 virtual HType CalculateInferredType() const; |
| 2492 | 2570 |
| 2493 DECLARE_CONCRETE_INSTRUCTION(Sar, "sar") | 2571 DECLARE_CONCRETE_INSTRUCTION(Sar, "sar") |
| 2572 | |
| 2573 protected: | |
| 2574 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2494 }; | 2575 }; |
| 2495 | 2576 |
| 2496 | 2577 |
| 2497 class HOsrEntry: public HInstruction { | 2578 class HOsrEntry: public HInstruction { |
| 2498 public: | 2579 public: |
| 2499 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) { | 2580 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) { |
| 2500 SetFlag(kChangesOsrEntries); | 2581 SetFlag(kChangesOsrEntries); |
| 2501 } | 2582 } |
| 2502 | 2583 |
| 2503 int ast_id() const { return ast_id_; } | 2584 int ast_id() const { return ast_id_; } |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2708 | 2789 |
| 2709 HValue* object() const { return OperandAt(0); } | 2790 HValue* object() const { return OperandAt(0); } |
| 2710 Handle<Object> name() const { return name_; } | 2791 Handle<Object> name() const { return name_; } |
| 2711 | 2792 |
| 2712 virtual Representation RequiredInputRepresentation(int index) const { | 2793 virtual Representation RequiredInputRepresentation(int index) const { |
| 2713 return Representation::Tagged(); | 2794 return Representation::Tagged(); |
| 2714 } | 2795 } |
| 2715 | 2796 |
| 2716 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load_named_generic") | 2797 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load_named_generic") |
| 2717 | 2798 |
| 2718 protected: | |
| 2719 virtual bool DataEquals(HValue* other) const { | |
| 2720 HLoadNamedGeneric* b = HLoadNamedGeneric::cast(other); | |
| 2721 return name_.is_identical_to(b->name_); | |
| 2722 } | |
| 2723 | |
| 2724 private: | 2799 private: |
| 2725 Handle<Object> name_; | 2800 Handle<Object> name_; |
| 2726 }; | 2801 }; |
| 2727 | 2802 |
| 2728 | 2803 |
| 2729 class HLoadFunctionPrototype: public HUnaryOperation { | 2804 class HLoadFunctionPrototype: public HUnaryOperation { |
| 2730 public: | 2805 public: |
| 2731 explicit HLoadFunctionPrototype(HValue* function) | 2806 explicit HLoadFunctionPrototype(HValue* function) |
| 2732 : HUnaryOperation(function) { | 2807 : HUnaryOperation(function) { |
| 2733 set_representation(Representation::Tagged()); | 2808 set_representation(Representation::Tagged()); |
| 2734 SetFlag(kUseGVN); | 2809 SetFlag(kUseGVN); |
| 2735 SetFlag(kDependsOnCalls); | 2810 SetFlag(kDependsOnCalls); |
| 2736 } | 2811 } |
| 2737 | 2812 |
| 2738 HValue* function() const { return OperandAt(0); } | 2813 HValue* function() const { return OperandAt(0); } |
| 2739 | 2814 |
| 2740 virtual Representation RequiredInputRepresentation(int index) const { | 2815 virtual Representation RequiredInputRepresentation(int index) const { |
| 2741 return Representation::Tagged(); | 2816 return Representation::Tagged(); |
| 2742 } | 2817 } |
| 2743 | 2818 |
| 2744 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load_function_prototype") | 2819 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load_function_prototype") |
| 2820 | |
| 2821 protected: | |
| 2822 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2745 }; | 2823 }; |
| 2746 | 2824 |
| 2747 | 2825 |
| 2748 class HLoadKeyed: public HBinaryOperation { | 2826 class HLoadKeyed: public HBinaryOperation { |
| 2749 public: | 2827 public: |
| 2750 HLoadKeyed(HValue* obj, HValue* key) : HBinaryOperation(obj, key) { | 2828 HLoadKeyed(HValue* obj, HValue* key) : HBinaryOperation(obj, key) { |
| 2751 set_representation(Representation::Tagged()); | 2829 set_representation(Representation::Tagged()); |
| 2752 } | 2830 } |
| 2753 | 2831 |
| 2754 virtual void PrintDataTo(StringStream* stream) const; | 2832 virtual void PrintDataTo(StringStream* stream) const; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 2771 } | 2849 } |
| 2772 | 2850 |
| 2773 virtual Representation RequiredInputRepresentation(int index) const { | 2851 virtual Representation RequiredInputRepresentation(int index) const { |
| 2774 // The key is supposed to be Integer32. | 2852 // The key is supposed to be Integer32. |
| 2775 return (index == 1) ? Representation::Integer32() | 2853 return (index == 1) ? Representation::Integer32() |
| 2776 : Representation::Tagged(); | 2854 : Representation::Tagged(); |
| 2777 } | 2855 } |
| 2778 | 2856 |
| 2779 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, | 2857 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, |
| 2780 "load_keyed_fast_element") | 2858 "load_keyed_fast_element") |
| 2859 | |
| 2860 protected: | |
| 2861 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2781 }; | 2862 }; |
| 2782 | 2863 |
| 2783 | 2864 |
| 2784 class HLoadKeyedGeneric: public HLoadKeyed { | 2865 class HLoadKeyedGeneric: public HLoadKeyed { |
| 2785 public: | 2866 public: |
| 2786 HLoadKeyedGeneric(HValue* obj, HValue* key) : HLoadKeyed(obj, key) { | 2867 HLoadKeyedGeneric(HValue* obj, HValue* key) : HLoadKeyed(obj, key) { |
| 2787 SetFlagMask(AllSideEffects()); | 2868 SetFlagMask(AllSideEffects()); |
| 2788 } | 2869 } |
| 2789 | 2870 |
| 2790 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic") | 2871 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic") |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 2814 HValue* value() const { return OperandAt(1); } | 2895 HValue* value() const { return OperandAt(1); } |
| 2815 void set_value(HValue* value) { SetOperandAt(1, value); } | 2896 void set_value(HValue* value) { SetOperandAt(1, value); } |
| 2816 | 2897 |
| 2817 bool NeedsWriteBarrier() const { | 2898 bool NeedsWriteBarrier() const { |
| 2818 return StoringValueNeedsWriteBarrier(value()); | 2899 return StoringValueNeedsWriteBarrier(value()); |
| 2819 } | 2900 } |
| 2820 | 2901 |
| 2821 DECLARE_INSTRUCTION(StoreNamed) | 2902 DECLARE_INSTRUCTION(StoreNamed) |
| 2822 | 2903 |
| 2823 protected: | 2904 protected: |
| 2824 virtual bool DataEquals(HValue* other) const { | 2905 virtual bool DataEquals(HValue* other) const { |
|
fschneider
2011/01/26 14:13:41
Since stores do not participate in GVN we don't ne
| |
| 2825 HStoreNamed* b = HStoreNamed::cast(other); | 2906 HStoreNamed* b = HStoreNamed::cast(other); |
| 2826 return name_.is_identical_to(b->name_); | 2907 return name_.is_identical_to(b->name_); |
| 2827 } | 2908 } |
| 2828 | 2909 |
| 2829 private: | 2910 private: |
| 2830 Handle<Object> name_; | 2911 Handle<Object> name_; |
| 2831 }; | 2912 }; |
| 2832 | 2913 |
| 2833 | 2914 |
| 2834 class HStoreNamedField: public HStoreNamed { | 2915 class HStoreNamedField: public HStoreNamed { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2950 set_representation(Representation::Integer32()); | 3031 set_representation(Representation::Integer32()); |
| 2951 SetFlag(kUseGVN); | 3032 SetFlag(kUseGVN); |
| 2952 } | 3033 } |
| 2953 | 3034 |
| 2954 virtual Representation RequiredInputRepresentation(int index) const { | 3035 virtual Representation RequiredInputRepresentation(int index) const { |
| 2955 // The index is supposed to be Integer32. | 3036 // The index is supposed to be Integer32. |
| 2956 return (index == 1) ? Representation::Integer32() | 3037 return (index == 1) ? Representation::Integer32() |
| 2957 : Representation::Tagged(); | 3038 : Representation::Tagged(); |
| 2958 } | 3039 } |
| 2959 | 3040 |
| 2960 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2961 | |
| 2962 HValue* string() const { return OperandAt(0); } | 3041 HValue* string() const { return OperandAt(0); } |
| 2963 HValue* index() const { return OperandAt(1); } | 3042 HValue* index() const { return OperandAt(1); } |
| 2964 | 3043 |
| 2965 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string_char_code_at") | 3044 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string_char_code_at") |
| 2966 | 3045 |
| 2967 protected: | 3046 protected: |
| 3047 virtual bool DataEquals(HValue* other) const { return true; } | |
| 3048 | |
| 2968 virtual Range* InferRange() { | 3049 virtual Range* InferRange() { |
| 2969 return new Range(0, String::kMaxUC16CharCode); | 3050 return new Range(0, String::kMaxUC16CharCode); |
| 2970 } | 3051 } |
| 2971 }; | 3052 }; |
| 2972 | 3053 |
| 2973 | 3054 |
| 2974 class HStringLength: public HUnaryOperation { | 3055 class HStringLength: public HUnaryOperation { |
| 2975 public: | 3056 public: |
| 2976 explicit HStringLength(HValue* string) : HUnaryOperation(string) { | 3057 explicit HStringLength(HValue* string) : HUnaryOperation(string) { |
| 2977 set_representation(Representation::Tagged()); | 3058 set_representation(Representation::Tagged()); |
| 2978 SetFlag(kUseGVN); | 3059 SetFlag(kUseGVN); |
| 2979 } | 3060 } |
| 2980 | 3061 |
| 2981 virtual Representation RequiredInputRepresentation(int index) const { | 3062 virtual Representation RequiredInputRepresentation(int index) const { |
| 2982 return Representation::Tagged(); | 3063 return Representation::Tagged(); |
| 2983 } | 3064 } |
| 2984 | 3065 |
| 2985 virtual HType CalculateInferredType() const { | 3066 virtual HType CalculateInferredType() const { |
| 2986 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); | 3067 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); |
| 2987 return HType::Smi(); | 3068 return HType::Smi(); |
| 2988 } | 3069 } |
| 2989 | 3070 |
| 2990 virtual bool DataEquals(HValue* other) const { return true; } | |
| 2991 | |
| 2992 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string_length") | 3071 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string_length") |
| 2993 | 3072 |
| 2994 protected: | 3073 protected: |
| 3074 virtual bool DataEquals(HValue* other) const { return true; } | |
| 3075 | |
| 2995 virtual Range* InferRange() { | 3076 virtual Range* InferRange() { |
| 2996 return new Range(0, String::kMaxLength); | 3077 return new Range(0, String::kMaxLength); |
| 2997 } | 3078 } |
| 2998 }; | 3079 }; |
| 2999 | 3080 |
| 3000 | 3081 |
| 3001 class HMaterializedLiteral: public HInstruction { | 3082 class HMaterializedLiteral: public HInstruction { |
| 3002 public: | 3083 public: |
| 3003 HMaterializedLiteral(int index, int depth) | 3084 HMaterializedLiteral(int index, int depth) |
| 3004 : literal_index_(index), depth_(depth) { | 3085 : literal_index_(index), depth_(depth) { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3137 HValue* object() const { return left(); } | 3218 HValue* object() const { return left(); } |
| 3138 HValue* key() const { return right(); } | 3219 HValue* key() const { return right(); } |
| 3139 }; | 3220 }; |
| 3140 | 3221 |
| 3141 #undef DECLARE_INSTRUCTION | 3222 #undef DECLARE_INSTRUCTION |
| 3142 #undef DECLARE_CONCRETE_INSTRUCTION | 3223 #undef DECLARE_CONCRETE_INSTRUCTION |
| 3143 | 3224 |
| 3144 } } // namespace v8::internal | 3225 } } // namespace v8::internal |
| 3145 | 3226 |
| 3146 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3227 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |