OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
660 // and expect the caller to take care of things. | 660 // and expect the caller to take care of things. |
661 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited) { | 661 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited) { |
662 visited->Add(id()); | 662 visited->Add(id()); |
663 return NULL; | 663 return NULL; |
664 } | 664 } |
665 | 665 |
666 bool IsDefinedAfter(HBasicBlock* other) const; | 666 bool IsDefinedAfter(HBasicBlock* other) const; |
667 | 667 |
668 // Operands. | 668 // Operands. |
669 virtual int OperandCount() = 0; | 669 virtual int OperandCount() = 0; |
670 virtual HValue* OperandAt(int index) = 0; | 670 virtual HValue* OperandAt(int index) const = 0; |
671 void SetOperandAt(int index, HValue* value); | 671 void SetOperandAt(int index, HValue* value); |
672 | 672 |
673 void DeleteAndReplaceWith(HValue* other); | 673 void DeleteAndReplaceWith(HValue* other); |
674 void ReplaceAllUsesWith(HValue* other); | 674 void ReplaceAllUsesWith(HValue* other); |
675 bool HasNoUses() const { return use_list_ == NULL; } | 675 bool HasNoUses() const { return use_list_ == NULL; } |
676 bool HasMultipleUses() const { | 676 bool HasMultipleUses() const { |
677 return use_list_ != NULL && use_list_->tail() != NULL; | 677 return use_list_ != NULL && use_list_->tail() != NULL; |
678 } | 678 } |
679 int UseCount() const; | 679 int UseCount() const; |
680 | 680 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
771 | 771 |
772 virtual HType CalculateInferredType(); | 772 virtual HType CalculateInferredType(); |
773 | 773 |
774 // This function must be overridden for instructions which have the | 774 // This function must be overridden for instructions which have the |
775 // kTrackSideEffectDominators flag set, to track instructions that are | 775 // kTrackSideEffectDominators flag set, to track instructions that are |
776 // dominating side effects. | 776 // dominating side effects. |
777 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { | 777 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { |
778 UNREACHABLE(); | 778 UNREACHABLE(); |
779 } | 779 } |
780 | 780 |
781 bool IsDead() const { | |
782 return HasNoUses() && !HasObservableSideEffects() && IsDeletable(); | |
783 } | |
784 | |
781 #ifdef DEBUG | 785 #ifdef DEBUG |
782 virtual void Verify() = 0; | 786 virtual void Verify() = 0; |
783 #endif | 787 #endif |
784 | 788 |
785 protected: | 789 protected: |
786 // This function must be overridden for instructions with flag kUseGVN, to | 790 // This function must be overridden for instructions with flag kUseGVN, to |
787 // compare the non-Operand parts of the instruction. | 791 // compare the non-Operand parts of the instruction. |
788 virtual bool DataEquals(HValue* other) { | 792 virtual bool DataEquals(HValue* other) { |
789 UNREACHABLE(); | 793 UNREACHABLE(); |
790 return false; | 794 return false; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
855 int id_; | 859 int id_; |
856 | 860 |
857 Representation representation_; | 861 Representation representation_; |
858 HType type_; | 862 HType type_; |
859 HUseListNode* use_list_; | 863 HUseListNode* use_list_; |
860 Range* range_; | 864 Range* range_; |
861 int flags_; | 865 int flags_; |
862 GVNFlagSet gvn_flags_; | 866 GVNFlagSet gvn_flags_; |
863 | 867 |
864 private: | 868 private: |
869 virtual bool IsDeletable() const { return false; } | |
870 | |
865 DISALLOW_COPY_AND_ASSIGN(HValue); | 871 DISALLOW_COPY_AND_ASSIGN(HValue); |
866 }; | 872 }; |
867 | 873 |
868 | 874 |
869 class HInstruction: public HValue { | 875 class HInstruction: public HValue { |
870 public: | 876 public: |
871 HInstruction* next() const { return next_; } | 877 HInstruction* next() const { return next_; } |
872 HInstruction* previous() const { return previous_; } | 878 HInstruction* previous() const { return previous_; } |
873 | 879 |
874 virtual void PrintTo(StringStream* stream); | 880 virtual void PrintTo(StringStream* stream); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
923 int position_; | 929 int position_; |
924 | 930 |
925 friend class HBasicBlock; | 931 friend class HBasicBlock; |
926 }; | 932 }; |
927 | 933 |
928 | 934 |
929 template<int V> | 935 template<int V> |
930 class HTemplateInstruction : public HInstruction { | 936 class HTemplateInstruction : public HInstruction { |
931 public: | 937 public: |
932 int OperandCount() { return V; } | 938 int OperandCount() { return V; } |
933 HValue* OperandAt(int i) { return inputs_[i]; } | 939 HValue* OperandAt(int i) const { return inputs_[i]; } |
934 | 940 |
935 protected: | 941 protected: |
936 void InternalSetOperandAt(int i, HValue* value) { inputs_[i] = value; } | 942 void InternalSetOperandAt(int i, HValue* value) { inputs_[i] = value; } |
937 | 943 |
938 private: | 944 private: |
939 EmbeddedContainer<HValue*, V> inputs_; | 945 EmbeddedContainer<HValue*, V> inputs_; |
940 }; | 946 }; |
941 | 947 |
942 | 948 |
943 class HControlInstruction: public HInstruction { | 949 class HControlInstruction: public HInstruction { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
975 | 981 |
976 | 982 |
977 template<int S, int V> | 983 template<int S, int V> |
978 class HTemplateControlInstruction: public HControlInstruction { | 984 class HTemplateControlInstruction: public HControlInstruction { |
979 public: | 985 public: |
980 int SuccessorCount() { return S; } | 986 int SuccessorCount() { return S; } |
981 HBasicBlock* SuccessorAt(int i) { return successors_[i]; } | 987 HBasicBlock* SuccessorAt(int i) { return successors_[i]; } |
982 void SetSuccessorAt(int i, HBasicBlock* block) { successors_[i] = block; } | 988 void SetSuccessorAt(int i, HBasicBlock* block) { successors_[i] = block; } |
983 | 989 |
984 int OperandCount() { return V; } | 990 int OperandCount() { return V; } |
985 HValue* OperandAt(int i) { return inputs_[i]; } | 991 HValue* OperandAt(int i) const { return inputs_[i]; } |
986 | 992 |
987 | 993 |
988 protected: | 994 protected: |
989 void InternalSetOperandAt(int i, HValue* value) { inputs_[i] = value; } | 995 void InternalSetOperandAt(int i, HValue* value) { inputs_[i] = value; } |
990 | 996 |
991 private: | 997 private: |
992 EmbeddedContainer<HBasicBlock*, S> successors_; | 998 EmbeddedContainer<HBasicBlock*, S> successors_; |
993 EmbeddedContainer<HValue*, V> inputs_; | 999 EmbeddedContainer<HValue*, V> inputs_; |
994 }; | 1000 }; |
995 | 1001 |
(...skipping 24 matching lines...) Expand all Loading... | |
1020 class HDeoptimize: public HControlInstruction { | 1026 class HDeoptimize: public HControlInstruction { |
1021 public: | 1027 public: |
1022 HDeoptimize(int environment_length, Zone* zone) | 1028 HDeoptimize(int environment_length, Zone* zone) |
1023 : values_(environment_length, zone) { } | 1029 : values_(environment_length, zone) { } |
1024 | 1030 |
1025 virtual Representation RequiredInputRepresentation(int index) { | 1031 virtual Representation RequiredInputRepresentation(int index) { |
1026 return Representation::None(); | 1032 return Representation::None(); |
1027 } | 1033 } |
1028 | 1034 |
1029 virtual int OperandCount() { return values_.length(); } | 1035 virtual int OperandCount() { return values_.length(); } |
1030 virtual HValue* OperandAt(int index) { return values_[index]; } | 1036 virtual HValue* OperandAt(int index) const { return values_[index]; } |
1031 virtual void PrintDataTo(StringStream* stream); | 1037 virtual void PrintDataTo(StringStream* stream); |
1032 | 1038 |
1033 virtual int SuccessorCount() { return 0; } | 1039 virtual int SuccessorCount() { return 0; } |
1034 virtual HBasicBlock* SuccessorAt(int i) { | 1040 virtual HBasicBlock* SuccessorAt(int i) { |
1035 UNREACHABLE(); | 1041 UNREACHABLE(); |
1036 return NULL; | 1042 return NULL; |
1037 } | 1043 } |
1038 virtual void SetSuccessorAt(int i, HBasicBlock* block) { | 1044 virtual void SetSuccessorAt(int i, HBasicBlock* block) { |
1039 UNREACHABLE(); | 1045 UNREACHABLE(); |
1040 } | 1046 } |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1277 } | 1283 } |
1278 | 1284 |
1279 virtual Range* InferRange(Zone* zone); | 1285 virtual Range* InferRange(Zone* zone); |
1280 | 1286 |
1281 virtual void PrintDataTo(StringStream* stream); | 1287 virtual void PrintDataTo(StringStream* stream); |
1282 | 1288 |
1283 DECLARE_CONCRETE_INSTRUCTION(Change) | 1289 DECLARE_CONCRETE_INSTRUCTION(Change) |
1284 | 1290 |
1285 protected: | 1291 protected: |
1286 virtual bool DataEquals(HValue* other) { return true; } | 1292 virtual bool DataEquals(HValue* other) { return true; } |
1293 | |
1294 private: | |
1295 virtual bool IsDeletable() const { return true; } | |
1287 }; | 1296 }; |
1288 | 1297 |
1289 | 1298 |
1290 class HClampToUint8: public HUnaryOperation { | 1299 class HClampToUint8: public HUnaryOperation { |
1291 public: | 1300 public: |
1292 explicit HClampToUint8(HValue* value) | 1301 explicit HClampToUint8(HValue* value) |
1293 : HUnaryOperation(value) { | 1302 : HUnaryOperation(value) { |
1294 set_representation(Representation::Integer32()); | 1303 set_representation(Representation::Integer32()); |
1295 SetFlag(kUseGVN); | 1304 SetFlag(kUseGVN); |
1296 } | 1305 } |
1297 | 1306 |
1298 virtual Representation RequiredInputRepresentation(int index) { | 1307 virtual Representation RequiredInputRepresentation(int index) { |
1299 return Representation::None(); | 1308 return Representation::None(); |
1300 } | 1309 } |
1301 | 1310 |
1302 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) | 1311 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) |
1303 | 1312 |
1304 protected: | 1313 protected: |
1305 virtual bool DataEquals(HValue* other) { return true; } | 1314 virtual bool DataEquals(HValue* other) { return true; } |
1315 | |
1316 private: | |
1317 virtual bool IsDeletable() const { return true; } | |
1306 }; | 1318 }; |
1307 | 1319 |
1308 | 1320 |
1309 class HSimulate: public HInstruction { | 1321 class HSimulate: public HInstruction { |
1310 public: | 1322 public: |
1311 HSimulate(BailoutId ast_id, int pop_count, Zone* zone) | 1323 HSimulate(BailoutId ast_id, int pop_count, Zone* zone) |
1312 : ast_id_(ast_id), | 1324 : ast_id_(ast_id), |
1313 pop_count_(pop_count), | 1325 pop_count_(pop_count), |
1314 values_(2, zone), | 1326 values_(2, zone), |
1315 assigned_indexes_(2, zone), | 1327 assigned_indexes_(2, zone), |
(...skipping 18 matching lines...) Expand all Loading... | |
1334 bool HasAssignedIndexAt(int index) const { | 1346 bool HasAssignedIndexAt(int index) const { |
1335 return assigned_indexes_[index] != kNoIndex; | 1347 return assigned_indexes_[index] != kNoIndex; |
1336 } | 1348 } |
1337 void AddAssignedValue(int index, HValue* value) { | 1349 void AddAssignedValue(int index, HValue* value) { |
1338 AddValue(index, value); | 1350 AddValue(index, value); |
1339 } | 1351 } |
1340 void AddPushedValue(HValue* value) { | 1352 void AddPushedValue(HValue* value) { |
1341 AddValue(kNoIndex, value); | 1353 AddValue(kNoIndex, value); |
1342 } | 1354 } |
1343 virtual int OperandCount() { return values_.length(); } | 1355 virtual int OperandCount() { return values_.length(); } |
1344 virtual HValue* OperandAt(int index) { return values_[index]; } | 1356 virtual HValue* OperandAt(int index) const { return values_[index]; } |
1345 | 1357 |
1346 virtual Representation RequiredInputRepresentation(int index) { | 1358 virtual Representation RequiredInputRepresentation(int index) { |
1347 return Representation::None(); | 1359 return Representation::None(); |
1348 } | 1360 } |
1349 | 1361 |
1350 DECLARE_CONCRETE_INSTRUCTION(Simulate) | 1362 DECLARE_CONCRETE_INSTRUCTION(Simulate) |
1351 | 1363 |
1352 #ifdef DEBUG | 1364 #ifdef DEBUG |
1353 virtual void Verify(); | 1365 virtual void Verify(); |
1354 #endif | 1366 #endif |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1507 } | 1519 } |
1508 | 1520 |
1509 virtual Representation RequiredInputRepresentation(int index) { | 1521 virtual Representation RequiredInputRepresentation(int index) { |
1510 return Representation::None(); | 1522 return Representation::None(); |
1511 } | 1523 } |
1512 | 1524 |
1513 DECLARE_CONCRETE_INSTRUCTION(ThisFunction) | 1525 DECLARE_CONCRETE_INSTRUCTION(ThisFunction) |
1514 | 1526 |
1515 protected: | 1527 protected: |
1516 virtual bool DataEquals(HValue* other) { return true; } | 1528 virtual bool DataEquals(HValue* other) { return true; } |
1529 | |
1530 private: | |
1531 virtual bool IsDeletable() const { return true; } | |
1517 }; | 1532 }; |
1518 | 1533 |
1519 | 1534 |
1520 class HContext: public HTemplateInstruction<0> { | 1535 class HContext: public HTemplateInstruction<0> { |
1521 public: | 1536 public: |
1522 HContext() { | 1537 HContext() { |
1523 set_representation(Representation::Tagged()); | 1538 set_representation(Representation::Tagged()); |
1524 SetFlag(kUseGVN); | 1539 SetFlag(kUseGVN); |
1525 } | 1540 } |
1526 | 1541 |
1527 virtual Representation RequiredInputRepresentation(int index) { | 1542 virtual Representation RequiredInputRepresentation(int index) { |
1528 return Representation::None(); | 1543 return Representation::None(); |
1529 } | 1544 } |
1530 | 1545 |
1531 DECLARE_CONCRETE_INSTRUCTION(Context) | 1546 DECLARE_CONCRETE_INSTRUCTION(Context) |
1532 | 1547 |
1533 protected: | 1548 protected: |
1534 virtual bool DataEquals(HValue* other) { return true; } | 1549 virtual bool DataEquals(HValue* other) { return true; } |
1550 | |
1551 private: | |
1552 virtual bool IsDeletable() const { return true; } | |
1535 }; | 1553 }; |
1536 | 1554 |
1537 | 1555 |
1538 class HOuterContext: public HUnaryOperation { | 1556 class HOuterContext: public HUnaryOperation { |
1539 public: | 1557 public: |
1540 explicit HOuterContext(HValue* inner) : HUnaryOperation(inner) { | 1558 explicit HOuterContext(HValue* inner) : HUnaryOperation(inner) { |
1541 set_representation(Representation::Tagged()); | 1559 set_representation(Representation::Tagged()); |
1542 SetFlag(kUseGVN); | 1560 SetFlag(kUseGVN); |
1543 } | 1561 } |
1544 | 1562 |
1545 DECLARE_CONCRETE_INSTRUCTION(OuterContext); | 1563 DECLARE_CONCRETE_INSTRUCTION(OuterContext); |
1546 | 1564 |
1547 virtual Representation RequiredInputRepresentation(int index) { | 1565 virtual Representation RequiredInputRepresentation(int index) { |
1548 return Representation::Tagged(); | 1566 return Representation::Tagged(); |
1549 } | 1567 } |
1550 | 1568 |
1551 protected: | 1569 protected: |
1552 virtual bool DataEquals(HValue* other) { return true; } | 1570 virtual bool DataEquals(HValue* other) { return true; } |
1571 | |
1572 private: | |
1573 virtual bool IsDeletable() const { return true; } | |
1553 }; | 1574 }; |
1554 | 1575 |
1555 | 1576 |
1556 class HDeclareGlobals: public HUnaryOperation { | 1577 class HDeclareGlobals: public HUnaryOperation { |
1557 public: | 1578 public: |
1558 HDeclareGlobals(HValue* context, | 1579 HDeclareGlobals(HValue* context, |
1559 Handle<FixedArray> pairs, | 1580 Handle<FixedArray> pairs, |
1560 int flags) | 1581 int flags) |
1561 : HUnaryOperation(context), | 1582 : HUnaryOperation(context), |
1562 pairs_(pairs), | 1583 pairs_(pairs), |
(...skipping 25 matching lines...) Expand all Loading... | |
1588 } | 1609 } |
1589 | 1610 |
1590 DECLARE_CONCRETE_INSTRUCTION(GlobalObject) | 1611 DECLARE_CONCRETE_INSTRUCTION(GlobalObject) |
1591 | 1612 |
1592 virtual Representation RequiredInputRepresentation(int index) { | 1613 virtual Representation RequiredInputRepresentation(int index) { |
1593 return Representation::Tagged(); | 1614 return Representation::Tagged(); |
1594 } | 1615 } |
1595 | 1616 |
1596 protected: | 1617 protected: |
1597 virtual bool DataEquals(HValue* other) { return true; } | 1618 virtual bool DataEquals(HValue* other) { return true; } |
1619 | |
1620 private: | |
1621 virtual bool IsDeletable() const { return true; } | |
1598 }; | 1622 }; |
1599 | 1623 |
1600 | 1624 |
1601 class HGlobalReceiver: public HUnaryOperation { | 1625 class HGlobalReceiver: public HUnaryOperation { |
1602 public: | 1626 public: |
1603 explicit HGlobalReceiver(HValue* global_object) | 1627 explicit HGlobalReceiver(HValue* global_object) |
1604 : HUnaryOperation(global_object) { | 1628 : HUnaryOperation(global_object) { |
1605 set_representation(Representation::Tagged()); | 1629 set_representation(Representation::Tagged()); |
1606 SetFlag(kUseGVN); | 1630 SetFlag(kUseGVN); |
1607 } | 1631 } |
1608 | 1632 |
1609 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver) | 1633 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver) |
1610 | 1634 |
1611 virtual Representation RequiredInputRepresentation(int index) { | 1635 virtual Representation RequiredInputRepresentation(int index) { |
1612 return Representation::Tagged(); | 1636 return Representation::Tagged(); |
1613 } | 1637 } |
1614 | 1638 |
1615 protected: | 1639 protected: |
1616 virtual bool DataEquals(HValue* other) { return true; } | 1640 virtual bool DataEquals(HValue* other) { return true; } |
1641 | |
1642 private: | |
1643 virtual bool IsDeletable() const { return true; } | |
1617 }; | 1644 }; |
1618 | 1645 |
1619 | 1646 |
1620 template <int V> | 1647 template <int V> |
1621 class HCall: public HTemplateInstruction<V> { | 1648 class HCall: public HTemplateInstruction<V> { |
1622 public: | 1649 public: |
1623 // The argument count includes the receiver. | 1650 // The argument count includes the receiver. |
1624 explicit HCall<V>(int argument_count) : argument_count_(argument_count) { | 1651 explicit HCall<V>(int argument_count) : argument_count_(argument_count) { |
1625 this->set_representation(Representation::Tagged()); | 1652 this->set_representation(Representation::Tagged()); |
1626 this->SetAllSideEffects(); | 1653 this->SetAllSideEffects(); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1892 | 1919 |
1893 virtual void PrintDataTo(StringStream* stream); | 1920 virtual void PrintDataTo(StringStream* stream); |
1894 | 1921 |
1895 HValue* value() { return OperandAt(0); } | 1922 HValue* value() { return OperandAt(0); } |
1896 HValue* typecheck() { return OperandAt(1); } | 1923 HValue* typecheck() { return OperandAt(1); } |
1897 | 1924 |
1898 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength) | 1925 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength) |
1899 | 1926 |
1900 protected: | 1927 protected: |
1901 virtual bool DataEquals(HValue* other_raw) { return true; } | 1928 virtual bool DataEquals(HValue* other_raw) { return true; } |
1929 | |
1930 private: | |
1931 virtual bool IsDeletable() const { return true; } | |
1902 }; | 1932 }; |
1903 | 1933 |
1904 | 1934 |
1905 class HFixedArrayBaseLength: public HUnaryOperation { | 1935 class HFixedArrayBaseLength: public HUnaryOperation { |
1906 public: | 1936 public: |
1907 explicit HFixedArrayBaseLength(HValue* value) : HUnaryOperation(value) { | 1937 explicit HFixedArrayBaseLength(HValue* value) : HUnaryOperation(value) { |
1908 set_type(HType::Smi()); | 1938 set_type(HType::Smi()); |
1909 set_representation(Representation::Tagged()); | 1939 set_representation(Representation::Tagged()); |
1910 SetFlag(kUseGVN); | 1940 SetFlag(kUseGVN); |
1911 SetGVNFlag(kDependsOnArrayLengths); | 1941 SetGVNFlag(kDependsOnArrayLengths); |
1912 } | 1942 } |
1913 | 1943 |
1914 virtual Representation RequiredInputRepresentation(int index) { | 1944 virtual Representation RequiredInputRepresentation(int index) { |
1915 return Representation::Tagged(); | 1945 return Representation::Tagged(); |
1916 } | 1946 } |
1917 | 1947 |
1918 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength) | 1948 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength) |
1919 | 1949 |
1920 protected: | 1950 protected: |
1921 virtual bool DataEquals(HValue* other) { return true; } | 1951 virtual bool DataEquals(HValue* other) { return true; } |
1952 | |
1953 private: | |
1954 virtual bool IsDeletable() const { return true; } | |
1922 }; | 1955 }; |
1923 | 1956 |
1924 | 1957 |
1925 class HMapEnumLength: public HUnaryOperation { | 1958 class HMapEnumLength: public HUnaryOperation { |
1926 public: | 1959 public: |
1927 explicit HMapEnumLength(HValue* value) : HUnaryOperation(value) { | 1960 explicit HMapEnumLength(HValue* value) : HUnaryOperation(value) { |
1928 set_type(HType::Smi()); | 1961 set_type(HType::Smi()); |
1929 set_representation(Representation::Tagged()); | 1962 set_representation(Representation::Tagged()); |
1930 SetFlag(kUseGVN); | 1963 SetFlag(kUseGVN); |
1931 SetGVNFlag(kDependsOnMaps); | 1964 SetGVNFlag(kDependsOnMaps); |
1932 } | 1965 } |
1933 | 1966 |
1934 virtual Representation RequiredInputRepresentation(int index) { | 1967 virtual Representation RequiredInputRepresentation(int index) { |
1935 return Representation::Tagged(); | 1968 return Representation::Tagged(); |
1936 } | 1969 } |
1937 | 1970 |
1938 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength) | 1971 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength) |
1939 | 1972 |
1940 protected: | 1973 protected: |
1941 virtual bool DataEquals(HValue* other) { return true; } | 1974 virtual bool DataEquals(HValue* other) { return true; } |
1975 | |
1976 private: | |
1977 virtual bool IsDeletable() const { return true; } | |
1942 }; | 1978 }; |
1943 | 1979 |
1944 | 1980 |
1945 class HElementsKind: public HUnaryOperation { | 1981 class HElementsKind: public HUnaryOperation { |
1946 public: | 1982 public: |
1947 explicit HElementsKind(HValue* value) : HUnaryOperation(value) { | 1983 explicit HElementsKind(HValue* value) : HUnaryOperation(value) { |
1948 set_representation(Representation::Integer32()); | 1984 set_representation(Representation::Integer32()); |
1949 SetFlag(kUseGVN); | 1985 SetFlag(kUseGVN); |
1950 SetGVNFlag(kDependsOnElementsKind); | 1986 SetGVNFlag(kDependsOnElementsKind); |
1951 } | 1987 } |
1952 | 1988 |
1953 virtual Representation RequiredInputRepresentation(int index) { | 1989 virtual Representation RequiredInputRepresentation(int index) { |
1954 return Representation::Tagged(); | 1990 return Representation::Tagged(); |
1955 } | 1991 } |
1956 | 1992 |
1957 DECLARE_CONCRETE_INSTRUCTION(ElementsKind) | 1993 DECLARE_CONCRETE_INSTRUCTION(ElementsKind) |
1958 | 1994 |
1959 protected: | 1995 protected: |
1960 virtual bool DataEquals(HValue* other) { return true; } | 1996 virtual bool DataEquals(HValue* other) { return true; } |
1997 | |
1998 private: | |
1999 virtual bool IsDeletable() const { return true; } | |
1961 }; | 2000 }; |
1962 | 2001 |
1963 | 2002 |
1964 class HBitNot: public HUnaryOperation { | 2003 class HBitNot: public HUnaryOperation { |
1965 public: | 2004 public: |
1966 explicit HBitNot(HValue* value) : HUnaryOperation(value) { | 2005 explicit HBitNot(HValue* value) : HUnaryOperation(value) { |
1967 set_representation(Representation::Integer32()); | 2006 set_representation(Representation::Integer32()); |
1968 SetFlag(kUseGVN); | 2007 SetFlag(kUseGVN); |
1969 SetFlag(kTruncatingToInt32); | 2008 SetFlag(kTruncatingToInt32); |
1970 } | 2009 } |
1971 | 2010 |
1972 virtual Representation RequiredInputRepresentation(int index) { | 2011 virtual Representation RequiredInputRepresentation(int index) { |
1973 return Representation::Integer32(); | 2012 return Representation::Integer32(); |
1974 } | 2013 } |
1975 virtual HType CalculateInferredType(); | 2014 virtual HType CalculateInferredType(); |
1976 | 2015 |
1977 virtual HValue* Canonicalize(); | 2016 virtual HValue* Canonicalize(); |
1978 | 2017 |
1979 DECLARE_CONCRETE_INSTRUCTION(BitNot) | 2018 DECLARE_CONCRETE_INSTRUCTION(BitNot) |
1980 | 2019 |
1981 protected: | 2020 protected: |
1982 virtual bool DataEquals(HValue* other) { return true; } | 2021 virtual bool DataEquals(HValue* other) { return true; } |
2022 | |
2023 private: | |
2024 virtual bool IsDeletable() const { return true; } | |
1983 }; | 2025 }; |
1984 | 2026 |
1985 | 2027 |
1986 class HUnaryMathOperation: public HTemplateInstruction<2> { | 2028 class HUnaryMathOperation: public HTemplateInstruction<2> { |
1987 public: | 2029 public: |
1988 HUnaryMathOperation(HValue* context, HValue* value, BuiltinFunctionId op) | 2030 HUnaryMathOperation(HValue* context, HValue* value, BuiltinFunctionId op) |
1989 : op_(op) { | 2031 : op_(op) { |
1990 SetOperandAt(0, context); | 2032 SetOperandAt(0, context); |
1991 SetOperandAt(1, value); | 2033 SetOperandAt(1, value); |
1992 switch (op) { | 2034 switch (op) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2055 | 2097 |
2056 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation) | 2098 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation) |
2057 | 2099 |
2058 protected: | 2100 protected: |
2059 virtual bool DataEquals(HValue* other) { | 2101 virtual bool DataEquals(HValue* other) { |
2060 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); | 2102 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); |
2061 return op_ == b->op(); | 2103 return op_ == b->op(); |
2062 } | 2104 } |
2063 | 2105 |
2064 private: | 2106 private: |
2107 virtual bool IsDeletable() const { return true; } | |
2108 | |
2065 BuiltinFunctionId op_; | 2109 BuiltinFunctionId op_; |
2066 }; | 2110 }; |
2067 | 2111 |
2068 | 2112 |
2069 class HLoadElements: public HTemplateInstruction<2> { | 2113 class HLoadElements: public HTemplateInstruction<2> { |
2070 public: | 2114 public: |
2071 HLoadElements(HValue* value, HValue* typecheck) { | 2115 HLoadElements(HValue* value, HValue* typecheck) { |
2072 SetOperandAt(0, value); | 2116 SetOperandAt(0, value); |
2073 SetOperandAt(1, typecheck); | 2117 SetOperandAt(1, typecheck); |
2074 set_representation(Representation::Tagged()); | 2118 set_representation(Representation::Tagged()); |
2075 SetFlag(kUseGVN); | 2119 SetFlag(kUseGVN); |
2076 SetGVNFlag(kDependsOnElementsPointer); | 2120 SetGVNFlag(kDependsOnElementsPointer); |
2077 } | 2121 } |
2078 | 2122 |
2079 HValue* value() { return OperandAt(0); } | 2123 HValue* value() { return OperandAt(0); } |
2080 | 2124 |
2081 virtual Representation RequiredInputRepresentation(int index) { | 2125 virtual Representation RequiredInputRepresentation(int index) { |
2082 return Representation::Tagged(); | 2126 return Representation::Tagged(); |
2083 } | 2127 } |
2084 | 2128 |
2085 DECLARE_CONCRETE_INSTRUCTION(LoadElements) | 2129 DECLARE_CONCRETE_INSTRUCTION(LoadElements) |
2086 | 2130 |
2087 protected: | 2131 protected: |
2088 virtual bool DataEquals(HValue* other) { return true; } | 2132 virtual bool DataEquals(HValue* other) { return true; } |
2133 | |
2134 private: | |
2135 virtual bool IsDeletable() const { return true; } | |
2089 }; | 2136 }; |
2090 | 2137 |
2091 | 2138 |
2092 class HLoadExternalArrayPointer: public HUnaryOperation { | 2139 class HLoadExternalArrayPointer: public HUnaryOperation { |
2093 public: | 2140 public: |
2094 explicit HLoadExternalArrayPointer(HValue* value) | 2141 explicit HLoadExternalArrayPointer(HValue* value) |
2095 : HUnaryOperation(value) { | 2142 : HUnaryOperation(value) { |
2096 set_representation(Representation::External()); | 2143 set_representation(Representation::External()); |
2097 // The result of this instruction is idempotent as long as its inputs don't | 2144 // The result of this instruction is idempotent as long as its inputs don't |
2098 // change. The external array of a specialized array elements object cannot | 2145 // change. The external array of a specialized array elements object cannot |
2099 // change once set, so it's no necessary to introduce any additional | 2146 // change once set, so it's no necessary to introduce any additional |
2100 // dependencies on top of the inputs. | 2147 // dependencies on top of the inputs. |
2101 SetFlag(kUseGVN); | 2148 SetFlag(kUseGVN); |
2102 } | 2149 } |
2103 | 2150 |
2104 virtual Representation RequiredInputRepresentation(int index) { | 2151 virtual Representation RequiredInputRepresentation(int index) { |
2105 return Representation::Tagged(); | 2152 return Representation::Tagged(); |
2106 } | 2153 } |
2107 | 2154 |
2108 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer) | 2155 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer) |
2109 | 2156 |
2110 protected: | 2157 protected: |
2111 virtual bool DataEquals(HValue* other) { return true; } | 2158 virtual bool DataEquals(HValue* other) { return true; } |
2159 | |
2160 private: | |
2161 virtual bool IsDeletable() const { return true; } | |
2112 }; | 2162 }; |
2113 | 2163 |
2114 | 2164 |
2115 class HCheckMaps: public HTemplateInstruction<2> { | 2165 class HCheckMaps: public HTemplateInstruction<2> { |
2116 public: | 2166 public: |
2117 HCheckMaps(HValue* value, Handle<Map> map, Zone* zone, | 2167 HCheckMaps(HValue* value, Handle<Map> map, Zone* zone, |
2118 HValue* typecheck = NULL) { | 2168 HValue* typecheck = NULL) { |
2119 SetOperandAt(0, value); | 2169 SetOperandAt(0, value); |
2120 // If callers don't depend on a typecheck, they can pass in NULL. In that | 2170 // If callers don't depend on a typecheck, they can pass in NULL. In that |
2121 // case we use a copy of the |value| argument as a dummy value. | 2171 // case we use a copy of the |value| argument as a dummy value. |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2401 } | 2451 } |
2402 | 2452 |
2403 virtual Representation InferredRepresentation(); | 2453 virtual Representation InferredRepresentation(); |
2404 | 2454 |
2405 virtual Range* InferRange(Zone* zone); | 2455 virtual Range* InferRange(Zone* zone); |
2406 virtual Representation RequiredInputRepresentation(int index) { | 2456 virtual Representation RequiredInputRepresentation(int index) { |
2407 return representation(); | 2457 return representation(); |
2408 } | 2458 } |
2409 virtual HType CalculateInferredType(); | 2459 virtual HType CalculateInferredType(); |
2410 virtual int OperandCount() { return inputs_.length(); } | 2460 virtual int OperandCount() { return inputs_.length(); } |
2411 virtual HValue* OperandAt(int index) { return inputs_[index]; } | 2461 virtual HValue* OperandAt(int index) const { return inputs_[index]; } |
2412 HValue* GetRedundantReplacement(); | 2462 HValue* GetRedundantReplacement(); |
2413 void AddInput(HValue* value); | 2463 void AddInput(HValue* value); |
2414 bool HasRealUses(); | 2464 bool HasRealUses(); |
2415 | 2465 |
2416 bool IsReceiver() { return merged_index_ == 0; } | 2466 bool IsReceiver() { return merged_index_ == 0; } |
2417 | 2467 |
2418 int merged_index() const { return merged_index_; } | 2468 int merged_index() const { return merged_index_; } |
2419 | 2469 |
2420 virtual void PrintTo(StringStream* stream); | 2470 virtual void PrintTo(StringStream* stream); |
2421 | 2471 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2497 HArgumentsObject() { | 2547 HArgumentsObject() { |
2498 set_representation(Representation::Tagged()); | 2548 set_representation(Representation::Tagged()); |
2499 SetFlag(kIsArguments); | 2549 SetFlag(kIsArguments); |
2500 } | 2550 } |
2501 | 2551 |
2502 virtual Representation RequiredInputRepresentation(int index) { | 2552 virtual Representation RequiredInputRepresentation(int index) { |
2503 return Representation::None(); | 2553 return Representation::None(); |
2504 } | 2554 } |
2505 | 2555 |
2506 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) | 2556 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) |
2557 | |
2558 private: | |
2559 virtual bool IsDeletable() const { return true; } | |
2507 }; | 2560 }; |
2508 | 2561 |
2509 | 2562 |
2510 class HConstant: public HTemplateInstruction<0> { | 2563 class HConstant: public HTemplateInstruction<0> { |
2511 public: | 2564 public: |
2512 HConstant(Handle<Object> handle, Representation r); | 2565 HConstant(Handle<Object> handle, Representation r); |
2513 HConstant(int32_t value, Representation r); | 2566 HConstant(int32_t value, Representation r); |
2514 HConstant(double value, Representation r); | 2567 HConstant(double value, Representation r); |
2515 | 2568 |
2516 Handle<Object> handle() { | 2569 Handle<Object> handle() { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2625 BitCast<int64_t>(double_value_) == | 2678 BitCast<int64_t>(double_value_) == |
2626 BitCast<int64_t>(other_constant->double_value_); | 2679 BitCast<int64_t>(other_constant->double_value_); |
2627 } else { | 2680 } else { |
2628 ASSERT(!handle_.is_null()); | 2681 ASSERT(!handle_.is_null()); |
2629 return !other_constant->handle_.is_null() && | 2682 return !other_constant->handle_.is_null() && |
2630 *handle_ == *other_constant->handle_; | 2683 *handle_ == *other_constant->handle_; |
2631 } | 2684 } |
2632 } | 2685 } |
2633 | 2686 |
2634 private: | 2687 private: |
2688 virtual bool IsDeletable() const { return true; } | |
2689 | |
2635 // If this is a numerical constant, handle_ either points to to the | 2690 // If this is a numerical constant, handle_ either points to to the |
2636 // HeapObject the constant originated from or is null. If the | 2691 // HeapObject the constant originated from or is null. If the |
2637 // constant is non-numeric, handle_ always points to a valid | 2692 // constant is non-numeric, handle_ always points to a valid |
2638 // constant HeapObject. | 2693 // constant HeapObject. |
2639 Handle<Object> handle_; | 2694 Handle<Object> handle_; |
2640 | 2695 |
2641 // We store the HConstant in the most specific form safely possible. | 2696 // We store the HConstant in the most specific form safely possible. |
2642 // The two flags, has_int32_value_ and has_double_value_ tell us if | 2697 // The two flags, has_int32_value_ and has_double_value_ tell us if |
2643 // int32_value_ and double_value_ hold valid, safe representations | 2698 // int32_value_ and double_value_ hold valid, safe representations |
2644 // of the constant. has_int32_value_ implies has_double_value_ but | 2699 // of the constant. has_int32_value_ implies has_double_value_ but |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2747 | 2802 |
2748 virtual Representation RequiredInputRepresentation(int index) { | 2803 virtual Representation RequiredInputRepresentation(int index) { |
2749 return Representation::None(); | 2804 return Representation::None(); |
2750 } | 2805 } |
2751 | 2806 |
2752 bool from_inlined() const { return from_inlined_; } | 2807 bool from_inlined() const { return from_inlined_; } |
2753 | 2808 |
2754 protected: | 2809 protected: |
2755 virtual bool DataEquals(HValue* other) { return true; } | 2810 virtual bool DataEquals(HValue* other) { return true; } |
2756 | 2811 |
2812 private: | |
2813 virtual bool IsDeletable() const { return true; } | |
2814 | |
2757 bool from_inlined_; | 2815 bool from_inlined_; |
2758 }; | 2816 }; |
2759 | 2817 |
2760 | 2818 |
2761 class HArgumentsLength: public HUnaryOperation { | 2819 class HArgumentsLength: public HUnaryOperation { |
2762 public: | 2820 public: |
2763 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { | 2821 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { |
2764 set_representation(Representation::Integer32()); | 2822 set_representation(Representation::Integer32()); |
2765 SetFlag(kUseGVN); | 2823 SetFlag(kUseGVN); |
2766 } | 2824 } |
2767 | 2825 |
2768 virtual Representation RequiredInputRepresentation(int index) { | 2826 virtual Representation RequiredInputRepresentation(int index) { |
2769 return Representation::Tagged(); | 2827 return Representation::Tagged(); |
2770 } | 2828 } |
2771 | 2829 |
2772 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength) | 2830 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength) |
2773 | 2831 |
2774 protected: | 2832 protected: |
2775 virtual bool DataEquals(HValue* other) { return true; } | 2833 virtual bool DataEquals(HValue* other) { return true; } |
2834 | |
2835 private: | |
2836 virtual bool IsDeletable() const { return true; } | |
2776 }; | 2837 }; |
2777 | 2838 |
2778 | 2839 |
2779 class HAccessArgumentsAt: public HTemplateInstruction<3> { | 2840 class HAccessArgumentsAt: public HTemplateInstruction<3> { |
2780 public: | 2841 public: |
2781 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { | 2842 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { |
2782 set_representation(Representation::Tagged()); | 2843 set_representation(Representation::Tagged()); |
2783 SetFlag(kUseGVN); | 2844 SetFlag(kUseGVN); |
2784 SetOperandAt(0, arguments); | 2845 SetOperandAt(0, arguments); |
2785 SetOperandAt(1, length); | 2846 SetOperandAt(1, length); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2891 } | 2952 } |
2892 | 2953 |
2893 void InitializeObservedInputRepresentation(Representation r) { | 2954 void InitializeObservedInputRepresentation(Representation r) { |
2894 observed_input_representation_[1] = r; | 2955 observed_input_representation_[1] = r; |
2895 observed_input_representation_[2] = r; | 2956 observed_input_representation_[2] = r; |
2896 } | 2957 } |
2897 | 2958 |
2898 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) | 2959 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) |
2899 | 2960 |
2900 private: | 2961 private: |
2962 virtual bool IsDeletable() const { return true; } | |
2963 | |
2901 Representation observed_input_representation_[3]; | 2964 Representation observed_input_representation_[3]; |
2902 }; | 2965 }; |
2903 | 2966 |
2904 | 2967 |
2905 class HMathFloorOfDiv: public HBinaryOperation { | 2968 class HMathFloorOfDiv: public HBinaryOperation { |
2906 public: | 2969 public: |
2907 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) | 2970 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) |
2908 : HBinaryOperation(context, left, right) { | 2971 : HBinaryOperation(context, left, right) { |
2909 set_representation(Representation::Integer32()); | 2972 set_representation(Representation::Integer32()); |
2910 SetFlag(kUseGVN); | 2973 SetFlag(kUseGVN); |
2911 SetFlag(kCanOverflow); | 2974 SetFlag(kCanOverflow); |
2912 } | 2975 } |
2913 | 2976 |
2914 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 2977 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
2915 | 2978 |
2916 virtual Representation RequiredInputRepresentation(int index) { | 2979 virtual Representation RequiredInputRepresentation(int index) { |
2917 return Representation::Integer32(); | 2980 return Representation::Integer32(); |
2918 } | 2981 } |
2919 | 2982 |
2920 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv) | 2983 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv) |
2921 | 2984 |
2922 protected: | 2985 protected: |
2923 virtual bool DataEquals(HValue* other) { return true; } | 2986 virtual bool DataEquals(HValue* other) { return true; } |
2987 | |
2988 private: | |
2989 virtual bool IsDeletable() const { return true; } | |
2924 }; | 2990 }; |
2925 | 2991 |
2926 | 2992 |
2927 class HArithmeticBinaryOperation: public HBinaryOperation { | 2993 class HArithmeticBinaryOperation: public HBinaryOperation { |
2928 public: | 2994 public: |
2929 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) | 2995 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) |
2930 : HBinaryOperation(context, left, right) { | 2996 : HBinaryOperation(context, left, right) { |
2931 set_representation(Representation::Tagged()); | 2997 set_representation(Representation::Tagged()); |
2932 SetFlag(kFlexibleRepresentation); | 2998 SetFlag(kFlexibleRepresentation); |
2933 SetAllSideEffects(); | 2999 SetAllSideEffects(); |
(...skipping 12 matching lines...) Expand all Loading... | |
2946 ? Representation::Tagged() | 3012 ? Representation::Tagged() |
2947 : representation(); | 3013 : representation(); |
2948 } | 3014 } |
2949 | 3015 |
2950 virtual Representation InferredRepresentation() { | 3016 virtual Representation InferredRepresentation() { |
2951 if (left()->representation().Equals(right()->representation())) { | 3017 if (left()->representation().Equals(right()->representation())) { |
2952 return left()->representation(); | 3018 return left()->representation(); |
2953 } | 3019 } |
2954 return HValue::InferredRepresentation(); | 3020 return HValue::InferredRepresentation(); |
2955 } | 3021 } |
3022 | |
3023 private: | |
3024 virtual bool IsDeletable() const { return true; } | |
2956 }; | 3025 }; |
2957 | 3026 |
2958 | 3027 |
2959 class HCompareGeneric: public HBinaryOperation { | 3028 class HCompareGeneric: public HBinaryOperation { |
2960 public: | 3029 public: |
2961 HCompareGeneric(HValue* context, | 3030 HCompareGeneric(HValue* context, |
2962 HValue* left, | 3031 HValue* left, |
2963 HValue* right, | 3032 HValue* right, |
2964 Token::Value token) | 3033 Token::Value token) |
2965 : HBinaryOperation(context, left, right), token_(token) { | 3034 : HBinaryOperation(context, left, right), token_(token) { |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3231 } | 3300 } |
3232 | 3301 |
3233 virtual Representation RequiredInputRepresentation(int index) { | 3302 virtual Representation RequiredInputRepresentation(int index) { |
3234 return Representation::Tagged(); | 3303 return Representation::Tagged(); |
3235 } | 3304 } |
3236 | 3305 |
3237 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex) | 3306 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex) |
3238 | 3307 |
3239 protected: | 3308 protected: |
3240 virtual bool DataEquals(HValue* other) { return true; } | 3309 virtual bool DataEquals(HValue* other) { return true; } |
3310 | |
3311 private: | |
3312 virtual bool IsDeletable() const { return true; } | |
3241 }; | 3313 }; |
3242 | 3314 |
3243 | 3315 |
3244 class HClassOfTestAndBranch: public HUnaryControlInstruction { | 3316 class HClassOfTestAndBranch: public HUnaryControlInstruction { |
3245 public: | 3317 public: |
3246 HClassOfTestAndBranch(HValue* value, Handle<String> class_name) | 3318 HClassOfTestAndBranch(HValue* value, Handle<String> class_name) |
3247 : HUnaryControlInstruction(value, NULL, NULL), | 3319 : HUnaryControlInstruction(value, NULL, NULL), |
3248 class_name_(class_name) { } | 3320 class_name_(class_name) { } |
3249 | 3321 |
3250 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch) | 3322 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch) |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3335 public: | 3407 public: |
3336 HPower(HValue* left, HValue* right) { | 3408 HPower(HValue* left, HValue* right) { |
3337 SetOperandAt(0, left); | 3409 SetOperandAt(0, left); |
3338 SetOperandAt(1, right); | 3410 SetOperandAt(1, right); |
3339 set_representation(Representation::Double()); | 3411 set_representation(Representation::Double()); |
3340 SetFlag(kUseGVN); | 3412 SetFlag(kUseGVN); |
3341 SetGVNFlag(kChangesNewSpacePromotion); | 3413 SetGVNFlag(kChangesNewSpacePromotion); |
3342 } | 3414 } |
3343 | 3415 |
3344 HValue* left() { return OperandAt(0); } | 3416 HValue* left() { return OperandAt(0); } |
3345 HValue* right() { return OperandAt(1); } | 3417 HValue* right() const { return OperandAt(1); } |
3346 | 3418 |
3347 virtual Representation RequiredInputRepresentation(int index) { | 3419 virtual Representation RequiredInputRepresentation(int index) { |
3348 return index == 0 | 3420 return index == 0 |
3349 ? Representation::Double() | 3421 ? Representation::Double() |
3350 : Representation::None(); | 3422 : Representation::None(); |
3351 } | 3423 } |
3352 | 3424 |
3353 DECLARE_CONCRETE_INSTRUCTION(Power) | 3425 DECLARE_CONCRETE_INSTRUCTION(Power) |
3354 | 3426 |
3355 protected: | 3427 protected: |
3356 virtual bool DataEquals(HValue* other) { return true; } | 3428 virtual bool DataEquals(HValue* other) { return true; } |
3429 | |
3430 private: | |
3431 virtual bool IsDeletable() const { | |
3432 return !right()->representation().IsTagged(); | |
3433 } | |
3357 }; | 3434 }; |
3358 | 3435 |
3359 | 3436 |
3360 class HRandom: public HTemplateInstruction<1> { | 3437 class HRandom: public HTemplateInstruction<1> { |
3361 public: | 3438 public: |
3362 explicit HRandom(HValue* global_object) { | 3439 explicit HRandom(HValue* global_object) { |
3363 SetOperandAt(0, global_object); | 3440 SetOperandAt(0, global_object); |
3364 set_representation(Representation::Double()); | 3441 set_representation(Representation::Double()); |
3365 } | 3442 } |
3366 | 3443 |
3367 HValue* global_object() { return OperandAt(0); } | 3444 HValue* global_object() { return OperandAt(0); } |
3368 | 3445 |
3369 virtual Representation RequiredInputRepresentation(int index) { | 3446 virtual Representation RequiredInputRepresentation(int index) { |
3370 return Representation::Tagged(); | 3447 return Representation::Tagged(); |
3371 } | 3448 } |
3372 | 3449 |
3373 DECLARE_CONCRETE_INSTRUCTION(Random) | 3450 DECLARE_CONCRETE_INSTRUCTION(Random) |
3451 | |
3452 private: | |
3453 virtual bool IsDeletable() const { return true; } | |
3374 }; | 3454 }; |
3375 | 3455 |
3376 | 3456 |
3377 class HAdd: public HArithmeticBinaryOperation { | 3457 class HAdd: public HArithmeticBinaryOperation { |
3378 public: | 3458 public: |
3379 HAdd(HValue* context, HValue* left, HValue* right) | 3459 HAdd(HValue* context, HValue* left, HValue* right) |
3380 : HArithmeticBinaryOperation(context, left, right) { | 3460 : HArithmeticBinaryOperation(context, left, right) { |
3381 SetFlag(kCanOverflow); | 3461 SetFlag(kCanOverflow); |
3382 } | 3462 } |
3383 | 3463 |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3754 class HLoadGlobalCell: public HTemplateInstruction<0> { | 3834 class HLoadGlobalCell: public HTemplateInstruction<0> { |
3755 public: | 3835 public: |
3756 HLoadGlobalCell(Handle<JSGlobalPropertyCell> cell, PropertyDetails details) | 3836 HLoadGlobalCell(Handle<JSGlobalPropertyCell> cell, PropertyDetails details) |
3757 : cell_(cell), details_(details) { | 3837 : cell_(cell), details_(details) { |
3758 set_representation(Representation::Tagged()); | 3838 set_representation(Representation::Tagged()); |
3759 SetFlag(kUseGVN); | 3839 SetFlag(kUseGVN); |
3760 SetGVNFlag(kDependsOnGlobalVars); | 3840 SetGVNFlag(kDependsOnGlobalVars); |
3761 } | 3841 } |
3762 | 3842 |
3763 Handle<JSGlobalPropertyCell> cell() const { return cell_; } | 3843 Handle<JSGlobalPropertyCell> cell() const { return cell_; } |
3764 bool RequiresHoleCheck(); | 3844 bool RequiresHoleCheck() const; |
3765 | 3845 |
3766 virtual void PrintDataTo(StringStream* stream); | 3846 virtual void PrintDataTo(StringStream* stream); |
3767 | 3847 |
3768 virtual intptr_t Hashcode() { | 3848 virtual intptr_t Hashcode() { |
3769 ASSERT_ALLOCATION_DISABLED; | 3849 ASSERT_ALLOCATION_DISABLED; |
3770 return reinterpret_cast<intptr_t>(*cell_); | 3850 return reinterpret_cast<intptr_t>(*cell_); |
3771 } | 3851 } |
3772 | 3852 |
3773 virtual Representation RequiredInputRepresentation(int index) { | 3853 virtual Representation RequiredInputRepresentation(int index) { |
3774 return Representation::None(); | 3854 return Representation::None(); |
3775 } | 3855 } |
3776 | 3856 |
3777 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) | 3857 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) |
3778 | 3858 |
3779 protected: | 3859 protected: |
3780 virtual bool DataEquals(HValue* other) { | 3860 virtual bool DataEquals(HValue* other) { |
3781 HLoadGlobalCell* b = HLoadGlobalCell::cast(other); | 3861 HLoadGlobalCell* b = HLoadGlobalCell::cast(other); |
3782 return cell_.is_identical_to(b->cell()); | 3862 return cell_.is_identical_to(b->cell()); |
3783 } | 3863 } |
3784 | 3864 |
3785 private: | 3865 private: |
3866 virtual bool IsDeletable() const { return !RequiresHoleCheck(); } | |
3867 | |
3786 Handle<JSGlobalPropertyCell> cell_; | 3868 Handle<JSGlobalPropertyCell> cell_; |
3787 PropertyDetails details_; | 3869 PropertyDetails details_; |
3788 }; | 3870 }; |
3789 | 3871 |
3790 | 3872 |
3791 class HLoadGlobalGeneric: public HTemplateInstruction<2> { | 3873 class HLoadGlobalGeneric: public HTemplateInstruction<2> { |
3792 public: | 3874 public: |
3793 HLoadGlobalGeneric(HValue* context, | 3875 HLoadGlobalGeneric(HValue* context, |
3794 HValue* global_object, | 3876 HValue* global_object, |
3795 Handle<Object> name, | 3877 Handle<Object> name, |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3936 SetGVNFlag(kDependsOnContextSlots); | 4018 SetGVNFlag(kDependsOnContextSlots); |
3937 } | 4019 } |
3938 | 4020 |
3939 int slot_index() const { return slot_index_; } | 4021 int slot_index() const { return slot_index_; } |
3940 Mode mode() const { return mode_; } | 4022 Mode mode() const { return mode_; } |
3941 | 4023 |
3942 bool DeoptimizesOnHole() { | 4024 bool DeoptimizesOnHole() { |
3943 return mode_ == kCheckDeoptimize; | 4025 return mode_ == kCheckDeoptimize; |
3944 } | 4026 } |
3945 | 4027 |
3946 bool RequiresHoleCheck() { | 4028 bool RequiresHoleCheck() const { |
3947 return mode_ != kNoCheck; | 4029 return mode_ != kNoCheck; |
3948 } | 4030 } |
3949 | 4031 |
3950 virtual Representation RequiredInputRepresentation(int index) { | 4032 virtual Representation RequiredInputRepresentation(int index) { |
3951 return Representation::Tagged(); | 4033 return Representation::Tagged(); |
3952 } | 4034 } |
3953 | 4035 |
3954 virtual void PrintDataTo(StringStream* stream); | 4036 virtual void PrintDataTo(StringStream* stream); |
3955 | 4037 |
3956 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot) | 4038 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot) |
3957 | 4039 |
3958 protected: | 4040 protected: |
3959 virtual bool DataEquals(HValue* other) { | 4041 virtual bool DataEquals(HValue* other) { |
3960 HLoadContextSlot* b = HLoadContextSlot::cast(other); | 4042 HLoadContextSlot* b = HLoadContextSlot::cast(other); |
3961 return (slot_index() == b->slot_index()); | 4043 return (slot_index() == b->slot_index()); |
3962 } | 4044 } |
3963 | 4045 |
3964 private: | 4046 private: |
4047 virtual bool IsDeletable() const { return !RequiresHoleCheck(); } | |
4048 | |
3965 int slot_index_; | 4049 int slot_index_; |
3966 Mode mode_; | 4050 Mode mode_; |
3967 }; | 4051 }; |
3968 | 4052 |
3969 | 4053 |
3970 class HStoreContextSlot: public HTemplateInstruction<2> { | 4054 class HStoreContextSlot: public HTemplateInstruction<2> { |
3971 public: | 4055 public: |
3972 enum Mode { | 4056 enum Mode { |
3973 // Perform a normal store to the context slot without checking its previous | 4057 // Perform a normal store to the context slot without checking its previous |
3974 // value. | 4058 // value. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4047 | 4131 |
4048 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) | 4132 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) |
4049 | 4133 |
4050 protected: | 4134 protected: |
4051 virtual bool DataEquals(HValue* other) { | 4135 virtual bool DataEquals(HValue* other) { |
4052 HLoadNamedField* b = HLoadNamedField::cast(other); | 4136 HLoadNamedField* b = HLoadNamedField::cast(other); |
4053 return is_in_object_ == b->is_in_object_ && offset_ == b->offset_; | 4137 return is_in_object_ == b->is_in_object_ && offset_ == b->offset_; |
4054 } | 4138 } |
4055 | 4139 |
4056 private: | 4140 private: |
4141 virtual bool IsDeletable() const { return true; } | |
4142 | |
4057 bool is_in_object_; | 4143 bool is_in_object_; |
4058 int offset_; | 4144 int offset_; |
4059 }; | 4145 }; |
4060 | 4146 |
4061 | 4147 |
4062 class HLoadNamedFieldPolymorphic: public HTemplateInstruction<2> { | 4148 class HLoadNamedFieldPolymorphic: public HTemplateInstruction<2> { |
4063 public: | 4149 public: |
4064 HLoadNamedFieldPolymorphic(HValue* context, | 4150 HLoadNamedFieldPolymorphic(HValue* context, |
4065 HValue* object, | 4151 HValue* object, |
4066 SmallMapList* types, | 4152 SmallMapList* types, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4193 | 4279 |
4194 virtual Representation RequiredInputRepresentation(int index) { | 4280 virtual Representation RequiredInputRepresentation(int index) { |
4195 // The key is supposed to be Integer32. | 4281 // The key is supposed to be Integer32. |
4196 if (index == 0) return Representation::Tagged(); | 4282 if (index == 0) return Representation::Tagged(); |
4197 if (index == 1) return Representation::Integer32(); | 4283 if (index == 1) return Representation::Integer32(); |
4198 return Representation::None(); | 4284 return Representation::None(); |
4199 } | 4285 } |
4200 | 4286 |
4201 virtual void PrintDataTo(StringStream* stream); | 4287 virtual void PrintDataTo(StringStream* stream); |
4202 | 4288 |
4203 bool RequiresHoleCheck(); | 4289 bool RequiresHoleCheck() const; |
4204 | 4290 |
4205 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement) | 4291 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement) |
4206 | 4292 |
4207 protected: | 4293 protected: |
4208 virtual bool DataEquals(HValue* other) { | 4294 virtual bool DataEquals(HValue* other) { |
4209 if (!other->IsLoadKeyedFastElement()) return false; | 4295 if (!other->IsLoadKeyedFastElement()) return false; |
4210 HLoadKeyedFastElement* other_load = HLoadKeyedFastElement::cast(other); | 4296 HLoadKeyedFastElement* other_load = HLoadKeyedFastElement::cast(other); |
4211 if (IsDehoisted() && index_offset() != other_load->index_offset()) | 4297 if (IsDehoisted() && index_offset() != other_load->index_offset()) |
4212 return false; | 4298 return false; |
4213 return elements_kind() == other_load->elements_kind(); | 4299 return elements_kind() == other_load->elements_kind(); |
4214 } | 4300 } |
4215 | 4301 |
4216 private: | 4302 private: |
4303 virtual bool IsDeletable() const { return !RequiresHoleCheck(); } | |
4304 | |
4217 class ElementsKindField: public BitField<ElementsKind, 0, 4> {}; | 4305 class ElementsKindField: public BitField<ElementsKind, 0, 4> {}; |
4218 class IndexOffsetField: public BitField<uint32_t, 4, 27> {}; | 4306 class IndexOffsetField: public BitField<uint32_t, 4, 27> {}; |
4219 class IsDehoistedField: public BitField<bool, 31, 1> {}; | 4307 class IsDehoistedField: public BitField<bool, 31, 1> {}; |
4220 uint32_t bit_field_; | 4308 uint32_t bit_field_; |
4221 }; | 4309 }; |
4222 | 4310 |
4223 | 4311 |
4224 enum HoleCheckMode { PERFORM_HOLE_CHECK, OMIT_HOLE_CHECK }; | 4312 enum HoleCheckMode { PERFORM_HOLE_CHECK, OMIT_HOLE_CHECK }; |
4225 | 4313 |
4226 | 4314 |
(...skipping 26 matching lines...) Expand all Loading... | |
4253 bool IsDehoisted() { return is_dehoisted_; } | 4341 bool IsDehoisted() { return is_dehoisted_; } |
4254 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } | 4342 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } |
4255 | 4343 |
4256 virtual Representation RequiredInputRepresentation(int index) { | 4344 virtual Representation RequiredInputRepresentation(int index) { |
4257 // The key is supposed to be Integer32. | 4345 // The key is supposed to be Integer32. |
4258 if (index == 0) return Representation::Tagged(); | 4346 if (index == 0) return Representation::Tagged(); |
4259 if (index == 1) return Representation::Integer32(); | 4347 if (index == 1) return Representation::Integer32(); |
4260 return Representation::None(); | 4348 return Representation::None(); |
4261 } | 4349 } |
4262 | 4350 |
4263 bool RequiresHoleCheck() { | 4351 bool RequiresHoleCheck() const { |
4264 return hole_check_mode_ == PERFORM_HOLE_CHECK; | 4352 return hole_check_mode_ == PERFORM_HOLE_CHECK; |
4265 } | 4353 } |
4266 | 4354 |
4267 virtual void PrintDataTo(StringStream* stream); | 4355 virtual void PrintDataTo(StringStream* stream); |
4268 | 4356 |
4269 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastDoubleElement) | 4357 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastDoubleElement) |
4270 | 4358 |
4271 protected: | 4359 protected: |
4272 virtual bool DataEquals(HValue* other) { | 4360 virtual bool DataEquals(HValue* other) { |
4273 if (!other->IsLoadKeyedFastDoubleElement()) return false; | 4361 if (!other->IsLoadKeyedFastDoubleElement()) return false; |
4274 HLoadKeyedFastDoubleElement* other_load = | 4362 HLoadKeyedFastDoubleElement* other_load = |
4275 HLoadKeyedFastDoubleElement::cast(other); | 4363 HLoadKeyedFastDoubleElement::cast(other); |
4276 return hole_check_mode_ == other_load->hole_check_mode_; | 4364 return hole_check_mode_ == other_load->hole_check_mode_; |
4277 } | 4365 } |
4278 | 4366 |
4279 private: | 4367 private: |
4368 virtual bool IsDeletable() const { return !RequiresHoleCheck(); } | |
4369 | |
4280 uint32_t index_offset_; | 4370 uint32_t index_offset_; |
4281 bool is_dehoisted_; | 4371 bool is_dehoisted_; |
4282 HoleCheckMode hole_check_mode_; | 4372 HoleCheckMode hole_check_mode_; |
4283 }; | 4373 }; |
4284 | 4374 |
4285 | 4375 |
4286 class HLoadKeyedSpecializedArrayElement | 4376 class HLoadKeyedSpecializedArrayElement |
4287 : public HTemplateInstruction<3>, public ArrayInstructionInterface { | 4377 : public HTemplateInstruction<3>, public ArrayInstructionInterface { |
4288 public: | 4378 public: |
4289 HLoadKeyedSpecializedArrayElement(HValue* external_elements, | 4379 HLoadKeyedSpecializedArrayElement(HValue* external_elements, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4334 | 4424 |
4335 protected: | 4425 protected: |
4336 virtual bool DataEquals(HValue* other) { | 4426 virtual bool DataEquals(HValue* other) { |
4337 if (!other->IsLoadKeyedSpecializedArrayElement()) return false; | 4427 if (!other->IsLoadKeyedSpecializedArrayElement()) return false; |
4338 HLoadKeyedSpecializedArrayElement* cast_other = | 4428 HLoadKeyedSpecializedArrayElement* cast_other = |
4339 HLoadKeyedSpecializedArrayElement::cast(other); | 4429 HLoadKeyedSpecializedArrayElement::cast(other); |
4340 return elements_kind_ == cast_other->elements_kind(); | 4430 return elements_kind_ == cast_other->elements_kind(); |
4341 } | 4431 } |
4342 | 4432 |
4343 private: | 4433 private: |
4434 virtual bool IsDeletable() const { | |
4435 return elements_kind_ != EXTERNAL_UNSIGNED_INT_ELEMENTS; | |
Jakob Kummerow
2012/10/10 15:24:18
As discussed offline, this instruction is always d
Sven Panne
2012/10/11 06:48:32
Done.
| |
4436 } | |
4437 | |
4344 ElementsKind elements_kind_; | 4438 ElementsKind elements_kind_; |
4345 uint32_t index_offset_; | 4439 uint32_t index_offset_; |
4346 bool is_dehoisted_; | 4440 bool is_dehoisted_; |
4347 }; | 4441 }; |
4348 | 4442 |
4349 | 4443 |
4350 class HLoadKeyedGeneric: public HTemplateInstruction<3> { | 4444 class HLoadKeyedGeneric: public HTemplateInstruction<3> { |
4351 public: | 4445 public: |
4352 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) { | 4446 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) { |
4353 set_representation(Representation::Tagged()); | 4447 set_representation(Representation::Tagged()); |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4715 } | 4809 } |
4716 | 4810 |
4717 virtual HType CalculateInferredType() { | 4811 virtual HType CalculateInferredType() { |
4718 return HType::String(); | 4812 return HType::String(); |
4719 } | 4813 } |
4720 | 4814 |
4721 DECLARE_CONCRETE_INSTRUCTION(StringAdd) | 4815 DECLARE_CONCRETE_INSTRUCTION(StringAdd) |
4722 | 4816 |
4723 protected: | 4817 protected: |
4724 virtual bool DataEquals(HValue* other) { return true; } | 4818 virtual bool DataEquals(HValue* other) { return true; } |
4819 | |
4820 // TODO(svenpanne) Might be safe, but leave it out until we know for sure. | |
4821 // private: | |
4822 // virtual bool IsDeletable() const { return true; } | |
4725 }; | 4823 }; |
4726 | 4824 |
4727 | 4825 |
4728 class HStringCharCodeAt: public HTemplateInstruction<3> { | 4826 class HStringCharCodeAt: public HTemplateInstruction<3> { |
4729 public: | 4827 public: |
4730 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { | 4828 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { |
4731 SetOperandAt(0, context); | 4829 SetOperandAt(0, context); |
4732 SetOperandAt(1, string); | 4830 SetOperandAt(1, string); |
4733 SetOperandAt(2, index); | 4831 SetOperandAt(2, index); |
4734 set_representation(Representation::Integer32()); | 4832 set_representation(Representation::Integer32()); |
(...skipping 14 matching lines...) Expand all Loading... | |
4749 HValue* index() { return OperandAt(2); } | 4847 HValue* index() { return OperandAt(2); } |
4750 | 4848 |
4751 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt) | 4849 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt) |
4752 | 4850 |
4753 protected: | 4851 protected: |
4754 virtual bool DataEquals(HValue* other) { return true; } | 4852 virtual bool DataEquals(HValue* other) { return true; } |
4755 | 4853 |
4756 virtual Range* InferRange(Zone* zone) { | 4854 virtual Range* InferRange(Zone* zone) { |
4757 return new(zone) Range(0, String::kMaxUtf16CodeUnit); | 4855 return new(zone) Range(0, String::kMaxUtf16CodeUnit); |
4758 } | 4856 } |
4857 | |
4858 // TODO(svenpanne) Might be safe, but leave it out until we know for sure. | |
4859 // private: | |
4860 // virtual bool IsDeletable() const { return true; } | |
4759 }; | 4861 }; |
4760 | 4862 |
4761 | 4863 |
4762 class HStringCharFromCode: public HTemplateInstruction<2> { | 4864 class HStringCharFromCode: public HTemplateInstruction<2> { |
4763 public: | 4865 public: |
4764 HStringCharFromCode(HValue* context, HValue* char_code) { | 4866 HStringCharFromCode(HValue* context, HValue* char_code) { |
4765 SetOperandAt(0, context); | 4867 SetOperandAt(0, context); |
4766 SetOperandAt(1, char_code); | 4868 SetOperandAt(1, char_code); |
4767 set_representation(Representation::Tagged()); | 4869 set_representation(Representation::Tagged()); |
4768 SetFlag(kUseGVN); | 4870 SetFlag(kUseGVN); |
4769 SetGVNFlag(kChangesNewSpacePromotion); | 4871 SetGVNFlag(kChangesNewSpacePromotion); |
4770 } | 4872 } |
4771 | 4873 |
4772 virtual Representation RequiredInputRepresentation(int index) { | 4874 virtual Representation RequiredInputRepresentation(int index) { |
4773 return index == 0 | 4875 return index == 0 |
4774 ? Representation::Tagged() | 4876 ? Representation::Tagged() |
4775 : Representation::Integer32(); | 4877 : Representation::Integer32(); |
4776 } | 4878 } |
4777 virtual HType CalculateInferredType(); | 4879 virtual HType CalculateInferredType(); |
4778 | 4880 |
4779 HValue* context() { return OperandAt(0); } | 4881 HValue* context() { return OperandAt(0); } |
4780 HValue* value() { return OperandAt(1); } | 4882 HValue* value() { return OperandAt(1); } |
4781 | 4883 |
4782 virtual bool DataEquals(HValue* other) { return true; } | 4884 virtual bool DataEquals(HValue* other) { return true; } |
4783 | 4885 |
4784 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) | 4886 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) |
4887 | |
4888 // TODO(svenpanne) Might be safe, but leave it out until we know for sure. | |
4889 // private: | |
4890 // virtual bool IsDeletable() const { return true; } | |
4785 }; | 4891 }; |
4786 | 4892 |
4787 | 4893 |
4788 class HStringLength: public HUnaryOperation { | 4894 class HStringLength: public HUnaryOperation { |
4789 public: | 4895 public: |
4790 explicit HStringLength(HValue* string) : HUnaryOperation(string) { | 4896 explicit HStringLength(HValue* string) : HUnaryOperation(string) { |
4791 set_representation(Representation::Tagged()); | 4897 set_representation(Representation::Tagged()); |
4792 SetFlag(kUseGVN); | 4898 SetFlag(kUseGVN); |
4793 SetGVNFlag(kDependsOnMaps); | 4899 SetGVNFlag(kDependsOnMaps); |
4794 } | 4900 } |
4795 | 4901 |
4796 virtual Representation RequiredInputRepresentation(int index) { | 4902 virtual Representation RequiredInputRepresentation(int index) { |
4797 return Representation::Tagged(); | 4903 return Representation::Tagged(); |
4798 } | 4904 } |
4799 | 4905 |
4800 virtual HType CalculateInferredType() { | 4906 virtual HType CalculateInferredType() { |
4801 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); | 4907 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); |
4802 return HType::Smi(); | 4908 return HType::Smi(); |
4803 } | 4909 } |
4804 | 4910 |
4805 DECLARE_CONCRETE_INSTRUCTION(StringLength) | 4911 DECLARE_CONCRETE_INSTRUCTION(StringLength) |
4806 | 4912 |
4807 protected: | 4913 protected: |
4808 virtual bool DataEquals(HValue* other) { return true; } | 4914 virtual bool DataEquals(HValue* other) { return true; } |
4809 | 4915 |
4810 virtual Range* InferRange(Zone* zone) { | 4916 virtual Range* InferRange(Zone* zone) { |
4811 return new(zone) Range(0, String::kMaxLength); | 4917 return new(zone) Range(0, String::kMaxLength); |
4812 } | 4918 } |
4919 | |
4920 private: | |
4921 virtual bool IsDeletable() const { return true; } | |
4813 }; | 4922 }; |
4814 | 4923 |
4815 | 4924 |
4816 class HAllocateObject: public HTemplateInstruction<1> { | 4925 class HAllocateObject: public HTemplateInstruction<1> { |
4817 public: | 4926 public: |
4818 HAllocateObject(HValue* context, Handle<JSFunction> constructor) | 4927 HAllocateObject(HValue* context, Handle<JSFunction> constructor) |
4819 : constructor_(constructor) { | 4928 : constructor_(constructor) { |
4820 SetOperandAt(0, context); | 4929 SetOperandAt(0, context); |
4821 set_representation(Representation::Tagged()); | 4930 set_representation(Representation::Tagged()); |
4822 SetGVNFlag(kChangesNewSpacePromotion); | 4931 SetGVNFlag(kChangesNewSpacePromotion); |
4823 } | 4932 } |
4824 | 4933 |
4825 // Maximum instance size for which allocations will be inlined. | 4934 // Maximum instance size for which allocations will be inlined. |
4826 static const int kMaxSize = 64 * kPointerSize; | 4935 static const int kMaxSize = 64 * kPointerSize; |
4827 | 4936 |
4828 HValue* context() { return OperandAt(0); } | 4937 HValue* context() { return OperandAt(0); } |
4829 Handle<JSFunction> constructor() { return constructor_; } | 4938 Handle<JSFunction> constructor() { return constructor_; } |
4830 | 4939 |
4831 virtual Representation RequiredInputRepresentation(int index) { | 4940 virtual Representation RequiredInputRepresentation(int index) { |
4832 return Representation::Tagged(); | 4941 return Representation::Tagged(); |
4833 } | 4942 } |
4834 virtual HType CalculateInferredType(); | 4943 virtual HType CalculateInferredType(); |
4835 | 4944 |
4836 DECLARE_CONCRETE_INSTRUCTION(AllocateObject) | 4945 DECLARE_CONCRETE_INSTRUCTION(AllocateObject) |
4837 | 4946 |
4838 private: | 4947 private: |
4948 // TODO(svenpanne) Might be safe, but leave it out until we know for sure. | |
4949 // virtual bool IsDeletable() const { return true; } | |
4950 | |
4839 Handle<JSFunction> constructor_; | 4951 Handle<JSFunction> constructor_; |
4840 }; | 4952 }; |
4841 | 4953 |
4842 | 4954 |
4843 template <int V> | 4955 template <int V> |
4844 class HMaterializedLiteral: public HTemplateInstruction<V> { | 4956 class HMaterializedLiteral: public HTemplateInstruction<V> { |
4845 public: | 4957 public: |
4846 HMaterializedLiteral<V>(int index, int depth) | 4958 HMaterializedLiteral<V>(int index, int depth) |
4847 : literal_index_(index), depth_(depth) { | 4959 : literal_index_(index), depth_(depth) { |
4848 this->set_representation(Representation::Tagged()); | 4960 this->set_representation(Representation::Tagged()); |
4849 } | 4961 } |
4850 | 4962 |
4851 int literal_index() const { return literal_index_; } | 4963 int literal_index() const { return literal_index_; } |
4852 int depth() const { return depth_; } | 4964 int depth() const { return depth_; } |
4853 | 4965 |
4854 private: | 4966 private: |
4967 virtual bool IsDeletable() const { return true; } | |
4968 | |
4855 int literal_index_; | 4969 int literal_index_; |
4856 int depth_; | 4970 int depth_; |
4857 }; | 4971 }; |
4858 | 4972 |
4859 | 4973 |
4860 class HFastLiteral: public HMaterializedLiteral<1> { | 4974 class HFastLiteral: public HMaterializedLiteral<1> { |
4861 public: | 4975 public: |
4862 HFastLiteral(HValue* context, | 4976 HFastLiteral(HValue* context, |
4863 Handle<JSObject> boilerplate, | 4977 Handle<JSObject> boilerplate, |
4864 int total_size, | 4978 int total_size, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5020 return Representation::Tagged(); | 5134 return Representation::Tagged(); |
5021 } | 5135 } |
5022 virtual HType CalculateInferredType(); | 5136 virtual HType CalculateInferredType(); |
5023 | 5137 |
5024 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) | 5138 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) |
5025 | 5139 |
5026 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } | 5140 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } |
5027 bool pretenure() const { return pretenure_; } | 5141 bool pretenure() const { return pretenure_; } |
5028 | 5142 |
5029 private: | 5143 private: |
5144 virtual bool IsDeletable() const { return true; } | |
5145 | |
5030 Handle<SharedFunctionInfo> shared_info_; | 5146 Handle<SharedFunctionInfo> shared_info_; |
5031 bool pretenure_; | 5147 bool pretenure_; |
5032 }; | 5148 }; |
5033 | 5149 |
5034 | 5150 |
5035 class HTypeof: public HTemplateInstruction<2> { | 5151 class HTypeof: public HTemplateInstruction<2> { |
5036 public: | 5152 public: |
5037 explicit HTypeof(HValue* context, HValue* value) { | 5153 explicit HTypeof(HValue* context, HValue* value) { |
5038 SetOperandAt(0, context); | 5154 SetOperandAt(0, context); |
5039 SetOperandAt(1, value); | 5155 SetOperandAt(1, value); |
5040 set_representation(Representation::Tagged()); | 5156 set_representation(Representation::Tagged()); |
5041 } | 5157 } |
5042 | 5158 |
5043 HValue* context() { return OperandAt(0); } | 5159 HValue* context() { return OperandAt(0); } |
5044 HValue* value() { return OperandAt(1); } | 5160 HValue* value() { return OperandAt(1); } |
5045 | 5161 |
5046 virtual HValue* Canonicalize(); | 5162 virtual HValue* Canonicalize(); |
5047 virtual void PrintDataTo(StringStream* stream); | 5163 virtual void PrintDataTo(StringStream* stream); |
5048 | 5164 |
5049 virtual Representation RequiredInputRepresentation(int index) { | 5165 virtual Representation RequiredInputRepresentation(int index) { |
5050 return Representation::Tagged(); | 5166 return Representation::Tagged(); |
5051 } | 5167 } |
5052 | 5168 |
5053 DECLARE_CONCRETE_INSTRUCTION(Typeof) | 5169 DECLARE_CONCRETE_INSTRUCTION(Typeof) |
5170 | |
5171 private: | |
5172 virtual bool IsDeletable() const { return true; } | |
5054 }; | 5173 }; |
5055 | 5174 |
5056 | 5175 |
5057 class HToFastProperties: public HUnaryOperation { | 5176 class HToFastProperties: public HUnaryOperation { |
5058 public: | 5177 public: |
5059 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { | 5178 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { |
5060 // This instruction is not marked as having side effects, but | 5179 // This instruction is not marked as having side effects, but |
5061 // changes the map of the input operand. Use it only when creating | 5180 // changes the map of the input operand. Use it only when creating |
5062 // object literals. | 5181 // object literals. |
5063 ASSERT(value->IsObjectLiteral() || value->IsFastLiteral()); | 5182 ASSERT(value->IsObjectLiteral() || value->IsFastLiteral()); |
5064 set_representation(Representation::Tagged()); | 5183 set_representation(Representation::Tagged()); |
5065 } | 5184 } |
5066 | 5185 |
5067 virtual Representation RequiredInputRepresentation(int index) { | 5186 virtual Representation RequiredInputRepresentation(int index) { |
5068 return Representation::Tagged(); | 5187 return Representation::Tagged(); |
5069 } | 5188 } |
5070 | 5189 |
5071 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) | 5190 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) |
5191 | |
5192 private: | |
5193 virtual bool IsDeletable() const { return true; } | |
5072 }; | 5194 }; |
5073 | 5195 |
5074 | 5196 |
5075 class HValueOf: public HUnaryOperation { | 5197 class HValueOf: public HUnaryOperation { |
5076 public: | 5198 public: |
5077 explicit HValueOf(HValue* value) : HUnaryOperation(value) { | 5199 explicit HValueOf(HValue* value) : HUnaryOperation(value) { |
5078 set_representation(Representation::Tagged()); | 5200 set_representation(Representation::Tagged()); |
5079 } | 5201 } |
5080 | 5202 |
5081 virtual Representation RequiredInputRepresentation(int index) { | 5203 virtual Representation RequiredInputRepresentation(int index) { |
5082 return Representation::Tagged(); | 5204 return Representation::Tagged(); |
5083 } | 5205 } |
5084 | 5206 |
5085 DECLARE_CONCRETE_INSTRUCTION(ValueOf) | 5207 DECLARE_CONCRETE_INSTRUCTION(ValueOf) |
5208 | |
5209 private: | |
5210 virtual bool IsDeletable() const { return true; } | |
5086 }; | 5211 }; |
5087 | 5212 |
5088 | 5213 |
5089 class HDateField: public HUnaryOperation { | 5214 class HDateField: public HUnaryOperation { |
5090 public: | 5215 public: |
5091 HDateField(HValue* date, Smi* index) | 5216 HDateField(HValue* date, Smi* index) |
5092 : HUnaryOperation(date), index_(index) { | 5217 : HUnaryOperation(date), index_(index) { |
5093 set_representation(Representation::Tagged()); | 5218 set_representation(Representation::Tagged()); |
5094 } | 5219 } |
5095 | 5220 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5272 HValue* object() { return OperandAt(0); } | 5397 HValue* object() { return OperandAt(0); } |
5273 HValue* index() { return OperandAt(1); } | 5398 HValue* index() { return OperandAt(1); } |
5274 | 5399 |
5275 virtual void PrintDataTo(StringStream* stream); | 5400 virtual void PrintDataTo(StringStream* stream); |
5276 | 5401 |
5277 virtual HType CalculateInferredType() { | 5402 virtual HType CalculateInferredType() { |
5278 return HType::Tagged(); | 5403 return HType::Tagged(); |
5279 } | 5404 } |
5280 | 5405 |
5281 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); | 5406 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); |
5407 | |
5408 private: | |
5409 virtual bool IsDeletable() const { return true; } | |
5282 }; | 5410 }; |
5283 | 5411 |
5284 | 5412 |
5285 #undef DECLARE_INSTRUCTION | 5413 #undef DECLARE_INSTRUCTION |
5286 #undef DECLARE_CONCRETE_INSTRUCTION | 5414 #undef DECLARE_CONCRETE_INSTRUCTION |
5287 | 5415 |
5288 } } // namespace v8::internal | 5416 } } // namespace v8::internal |
5289 | 5417 |
5290 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 5418 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |