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

Side by Side Diff: src/hydrogen-instructions.h

Issue 11088027: Added a simple dead code removal phase. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 { return true; }
4435
4344 ElementsKind elements_kind_; 4436 ElementsKind elements_kind_;
4345 uint32_t index_offset_; 4437 uint32_t index_offset_;
4346 bool is_dehoisted_; 4438 bool is_dehoisted_;
4347 }; 4439 };
4348 4440
4349 4441
4350 class HLoadKeyedGeneric: public HTemplateInstruction<3> { 4442 class HLoadKeyedGeneric: public HTemplateInstruction<3> {
4351 public: 4443 public:
4352 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) { 4444 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) {
4353 set_representation(Representation::Tagged()); 4445 set_representation(Representation::Tagged());
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
4715 } 4807 }
4716 4808
4717 virtual HType CalculateInferredType() { 4809 virtual HType CalculateInferredType() {
4718 return HType::String(); 4810 return HType::String();
4719 } 4811 }
4720 4812
4721 DECLARE_CONCRETE_INSTRUCTION(StringAdd) 4813 DECLARE_CONCRETE_INSTRUCTION(StringAdd)
4722 4814
4723 protected: 4815 protected:
4724 virtual bool DataEquals(HValue* other) { return true; } 4816 virtual bool DataEquals(HValue* other) { return true; }
4817
4818 // TODO(svenpanne) Might be safe, but leave it out until we know for sure.
4819 // private:
4820 // virtual bool IsDeletable() const { return true; }
4725 }; 4821 };
4726 4822
4727 4823
4728 class HStringCharCodeAt: public HTemplateInstruction<3> { 4824 class HStringCharCodeAt: public HTemplateInstruction<3> {
4729 public: 4825 public:
4730 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { 4826 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) {
4731 SetOperandAt(0, context); 4827 SetOperandAt(0, context);
4732 SetOperandAt(1, string); 4828 SetOperandAt(1, string);
4733 SetOperandAt(2, index); 4829 SetOperandAt(2, index);
4734 set_representation(Representation::Integer32()); 4830 set_representation(Representation::Integer32());
(...skipping 14 matching lines...) Expand all
4749 HValue* index() { return OperandAt(2); } 4845 HValue* index() { return OperandAt(2); }
4750 4846
4751 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt) 4847 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt)
4752 4848
4753 protected: 4849 protected:
4754 virtual bool DataEquals(HValue* other) { return true; } 4850 virtual bool DataEquals(HValue* other) { return true; }
4755 4851
4756 virtual Range* InferRange(Zone* zone) { 4852 virtual Range* InferRange(Zone* zone) {
4757 return new(zone) Range(0, String::kMaxUtf16CodeUnit); 4853 return new(zone) Range(0, String::kMaxUtf16CodeUnit);
4758 } 4854 }
4855
4856 // TODO(svenpanne) Might be safe, but leave it out until we know for sure.
4857 // private:
4858 // virtual bool IsDeletable() const { return true; }
4759 }; 4859 };
4760 4860
4761 4861
4762 class HStringCharFromCode: public HTemplateInstruction<2> { 4862 class HStringCharFromCode: public HTemplateInstruction<2> {
4763 public: 4863 public:
4764 HStringCharFromCode(HValue* context, HValue* char_code) { 4864 HStringCharFromCode(HValue* context, HValue* char_code) {
4765 SetOperandAt(0, context); 4865 SetOperandAt(0, context);
4766 SetOperandAt(1, char_code); 4866 SetOperandAt(1, char_code);
4767 set_representation(Representation::Tagged()); 4867 set_representation(Representation::Tagged());
4768 SetFlag(kUseGVN); 4868 SetFlag(kUseGVN);
4769 SetGVNFlag(kChangesNewSpacePromotion); 4869 SetGVNFlag(kChangesNewSpacePromotion);
4770 } 4870 }
4771 4871
4772 virtual Representation RequiredInputRepresentation(int index) { 4872 virtual Representation RequiredInputRepresentation(int index) {
4773 return index == 0 4873 return index == 0
4774 ? Representation::Tagged() 4874 ? Representation::Tagged()
4775 : Representation::Integer32(); 4875 : Representation::Integer32();
4776 } 4876 }
4777 virtual HType CalculateInferredType(); 4877 virtual HType CalculateInferredType();
4778 4878
4779 HValue* context() { return OperandAt(0); } 4879 HValue* context() { return OperandAt(0); }
4780 HValue* value() { return OperandAt(1); } 4880 HValue* value() { return OperandAt(1); }
4781 4881
4782 virtual bool DataEquals(HValue* other) { return true; } 4882 virtual bool DataEquals(HValue* other) { return true; }
4783 4883
4784 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) 4884 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode)
4885
4886 // TODO(svenpanne) Might be safe, but leave it out until we know for sure.
4887 // private:
4888 // virtual bool IsDeletable() const { return true; }
4785 }; 4889 };
4786 4890
4787 4891
4788 class HStringLength: public HUnaryOperation { 4892 class HStringLength: public HUnaryOperation {
4789 public: 4893 public:
4790 explicit HStringLength(HValue* string) : HUnaryOperation(string) { 4894 explicit HStringLength(HValue* string) : HUnaryOperation(string) {
4791 set_representation(Representation::Tagged()); 4895 set_representation(Representation::Tagged());
4792 SetFlag(kUseGVN); 4896 SetFlag(kUseGVN);
4793 SetGVNFlag(kDependsOnMaps); 4897 SetGVNFlag(kDependsOnMaps);
4794 } 4898 }
4795 4899
4796 virtual Representation RequiredInputRepresentation(int index) { 4900 virtual Representation RequiredInputRepresentation(int index) {
4797 return Representation::Tagged(); 4901 return Representation::Tagged();
4798 } 4902 }
4799 4903
4800 virtual HType CalculateInferredType() { 4904 virtual HType CalculateInferredType() {
4801 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); 4905 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue);
4802 return HType::Smi(); 4906 return HType::Smi();
4803 } 4907 }
4804 4908
4805 DECLARE_CONCRETE_INSTRUCTION(StringLength) 4909 DECLARE_CONCRETE_INSTRUCTION(StringLength)
4806 4910
4807 protected: 4911 protected:
4808 virtual bool DataEquals(HValue* other) { return true; } 4912 virtual bool DataEquals(HValue* other) { return true; }
4809 4913
4810 virtual Range* InferRange(Zone* zone) { 4914 virtual Range* InferRange(Zone* zone) {
4811 return new(zone) Range(0, String::kMaxLength); 4915 return new(zone) Range(0, String::kMaxLength);
4812 } 4916 }
4917
4918 private:
4919 virtual bool IsDeletable() const { return true; }
4813 }; 4920 };
4814 4921
4815 4922
4816 class HAllocateObject: public HTemplateInstruction<1> { 4923 class HAllocateObject: public HTemplateInstruction<1> {
4817 public: 4924 public:
4818 HAllocateObject(HValue* context, Handle<JSFunction> constructor) 4925 HAllocateObject(HValue* context, Handle<JSFunction> constructor)
4819 : constructor_(constructor) { 4926 : constructor_(constructor) {
4820 SetOperandAt(0, context); 4927 SetOperandAt(0, context);
4821 set_representation(Representation::Tagged()); 4928 set_representation(Representation::Tagged());
4822 SetGVNFlag(kChangesNewSpacePromotion); 4929 SetGVNFlag(kChangesNewSpacePromotion);
4823 } 4930 }
4824 4931
4825 // Maximum instance size for which allocations will be inlined. 4932 // Maximum instance size for which allocations will be inlined.
4826 static const int kMaxSize = 64 * kPointerSize; 4933 static const int kMaxSize = 64 * kPointerSize;
4827 4934
4828 HValue* context() { return OperandAt(0); } 4935 HValue* context() { return OperandAt(0); }
4829 Handle<JSFunction> constructor() { return constructor_; } 4936 Handle<JSFunction> constructor() { return constructor_; }
4830 4937
4831 virtual Representation RequiredInputRepresentation(int index) { 4938 virtual Representation RequiredInputRepresentation(int index) {
4832 return Representation::Tagged(); 4939 return Representation::Tagged();
4833 } 4940 }
4834 virtual HType CalculateInferredType(); 4941 virtual HType CalculateInferredType();
4835 4942
4836 DECLARE_CONCRETE_INSTRUCTION(AllocateObject) 4943 DECLARE_CONCRETE_INSTRUCTION(AllocateObject)
4837 4944
4838 private: 4945 private:
4946 // TODO(svenpanne) Might be safe, but leave it out until we know for sure.
4947 // virtual bool IsDeletable() const { return true; }
4948
4839 Handle<JSFunction> constructor_; 4949 Handle<JSFunction> constructor_;
4840 }; 4950 };
4841 4951
4842 4952
4843 template <int V> 4953 template <int V>
4844 class HMaterializedLiteral: public HTemplateInstruction<V> { 4954 class HMaterializedLiteral: public HTemplateInstruction<V> {
4845 public: 4955 public:
4846 HMaterializedLiteral<V>(int index, int depth) 4956 HMaterializedLiteral<V>(int index, int depth)
4847 : literal_index_(index), depth_(depth) { 4957 : literal_index_(index), depth_(depth) {
4848 this->set_representation(Representation::Tagged()); 4958 this->set_representation(Representation::Tagged());
4849 } 4959 }
4850 4960
4851 int literal_index() const { return literal_index_; } 4961 int literal_index() const { return literal_index_; }
4852 int depth() const { return depth_; } 4962 int depth() const { return depth_; }
4853 4963
4854 private: 4964 private:
4965 virtual bool IsDeletable() const { return true; }
4966
4855 int literal_index_; 4967 int literal_index_;
4856 int depth_; 4968 int depth_;
4857 }; 4969 };
4858 4970
4859 4971
4860 class HFastLiteral: public HMaterializedLiteral<1> { 4972 class HFastLiteral: public HMaterializedLiteral<1> {
4861 public: 4973 public:
4862 HFastLiteral(HValue* context, 4974 HFastLiteral(HValue* context,
4863 Handle<JSObject> boilerplate, 4975 Handle<JSObject> boilerplate,
4864 int total_size, 4976 int total_size,
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
5020 return Representation::Tagged(); 5132 return Representation::Tagged();
5021 } 5133 }
5022 virtual HType CalculateInferredType(); 5134 virtual HType CalculateInferredType();
5023 5135
5024 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) 5136 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral)
5025 5137
5026 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } 5138 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
5027 bool pretenure() const { return pretenure_; } 5139 bool pretenure() const { return pretenure_; }
5028 5140
5029 private: 5141 private:
5142 virtual bool IsDeletable() const { return true; }
5143
5030 Handle<SharedFunctionInfo> shared_info_; 5144 Handle<SharedFunctionInfo> shared_info_;
5031 bool pretenure_; 5145 bool pretenure_;
5032 }; 5146 };
5033 5147
5034 5148
5035 class HTypeof: public HTemplateInstruction<2> { 5149 class HTypeof: public HTemplateInstruction<2> {
5036 public: 5150 public:
5037 explicit HTypeof(HValue* context, HValue* value) { 5151 explicit HTypeof(HValue* context, HValue* value) {
5038 SetOperandAt(0, context); 5152 SetOperandAt(0, context);
5039 SetOperandAt(1, value); 5153 SetOperandAt(1, value);
5040 set_representation(Representation::Tagged()); 5154 set_representation(Representation::Tagged());
5041 } 5155 }
5042 5156
5043 HValue* context() { return OperandAt(0); } 5157 HValue* context() { return OperandAt(0); }
5044 HValue* value() { return OperandAt(1); } 5158 HValue* value() { return OperandAt(1); }
5045 5159
5046 virtual HValue* Canonicalize(); 5160 virtual HValue* Canonicalize();
5047 virtual void PrintDataTo(StringStream* stream); 5161 virtual void PrintDataTo(StringStream* stream);
5048 5162
5049 virtual Representation RequiredInputRepresentation(int index) { 5163 virtual Representation RequiredInputRepresentation(int index) {
5050 return Representation::Tagged(); 5164 return Representation::Tagged();
5051 } 5165 }
5052 5166
5053 DECLARE_CONCRETE_INSTRUCTION(Typeof) 5167 DECLARE_CONCRETE_INSTRUCTION(Typeof)
5168
5169 private:
5170 virtual bool IsDeletable() const { return true; }
5054 }; 5171 };
5055 5172
5056 5173
5057 class HToFastProperties: public HUnaryOperation { 5174 class HToFastProperties: public HUnaryOperation {
5058 public: 5175 public:
5059 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { 5176 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) {
5060 // This instruction is not marked as having side effects, but 5177 // This instruction is not marked as having side effects, but
5061 // changes the map of the input operand. Use it only when creating 5178 // changes the map of the input operand. Use it only when creating
5062 // object literals. 5179 // object literals.
5063 ASSERT(value->IsObjectLiteral() || value->IsFastLiteral()); 5180 ASSERT(value->IsObjectLiteral() || value->IsFastLiteral());
5064 set_representation(Representation::Tagged()); 5181 set_representation(Representation::Tagged());
5065 } 5182 }
5066 5183
5067 virtual Representation RequiredInputRepresentation(int index) { 5184 virtual Representation RequiredInputRepresentation(int index) {
5068 return Representation::Tagged(); 5185 return Representation::Tagged();
5069 } 5186 }
5070 5187
5071 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) 5188 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties)
5189
5190 private:
5191 virtual bool IsDeletable() const { return true; }
5072 }; 5192 };
5073 5193
5074 5194
5075 class HValueOf: public HUnaryOperation { 5195 class HValueOf: public HUnaryOperation {
5076 public: 5196 public:
5077 explicit HValueOf(HValue* value) : HUnaryOperation(value) { 5197 explicit HValueOf(HValue* value) : HUnaryOperation(value) {
5078 set_representation(Representation::Tagged()); 5198 set_representation(Representation::Tagged());
5079 } 5199 }
5080 5200
5081 virtual Representation RequiredInputRepresentation(int index) { 5201 virtual Representation RequiredInputRepresentation(int index) {
5082 return Representation::Tagged(); 5202 return Representation::Tagged();
5083 } 5203 }
5084 5204
5085 DECLARE_CONCRETE_INSTRUCTION(ValueOf) 5205 DECLARE_CONCRETE_INSTRUCTION(ValueOf)
5206
5207 private:
5208 virtual bool IsDeletable() const { return true; }
5086 }; 5209 };
5087 5210
5088 5211
5089 class HDateField: public HUnaryOperation { 5212 class HDateField: public HUnaryOperation {
5090 public: 5213 public:
5091 HDateField(HValue* date, Smi* index) 5214 HDateField(HValue* date, Smi* index)
5092 : HUnaryOperation(date), index_(index) { 5215 : HUnaryOperation(date), index_(index) {
5093 set_representation(Representation::Tagged()); 5216 set_representation(Representation::Tagged());
5094 } 5217 }
5095 5218
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
5272 HValue* object() { return OperandAt(0); } 5395 HValue* object() { return OperandAt(0); }
5273 HValue* index() { return OperandAt(1); } 5396 HValue* index() { return OperandAt(1); }
5274 5397
5275 virtual void PrintDataTo(StringStream* stream); 5398 virtual void PrintDataTo(StringStream* stream);
5276 5399
5277 virtual HType CalculateInferredType() { 5400 virtual HType CalculateInferredType() {
5278 return HType::Tagged(); 5401 return HType::Tagged();
5279 } 5402 }
5280 5403
5281 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); 5404 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex);
5405
5406 private:
5407 virtual bool IsDeletable() const { return true; }
5282 }; 5408 };
5283 5409
5284 5410
5285 #undef DECLARE_INSTRUCTION 5411 #undef DECLARE_INSTRUCTION
5286 #undef DECLARE_CONCRETE_INSTRUCTION 5412 #undef DECLARE_CONCRETE_INSTRUCTION
5287 5413
5288 } } // namespace v8::internal 5414 } } // namespace v8::internal
5289 5415
5290 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 5416 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698