| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 V(TypeofIsAndBranch) \ | 176 V(TypeofIsAndBranch) \ |
| 177 V(UnaryMathOperation) \ | 177 V(UnaryMathOperation) \ |
| 178 V(UnknownOSRValue) \ | 178 V(UnknownOSRValue) \ |
| 179 V(UseConst) \ | 179 V(UseConst) \ |
| 180 V(ValueOf) | 180 V(ValueOf) |
| 181 | 181 |
| 182 #define GVN_FLAG_LIST(V) \ | 182 #define GVN_FLAG_LIST(V) \ |
| 183 V(Calls) \ | 183 V(Calls) \ |
| 184 V(InobjectFields) \ | 184 V(InobjectFields) \ |
| 185 V(BackingStoreFields) \ | 185 V(BackingStoreFields) \ |
| 186 V(ElementsKind) \ |
| 186 V(ArrayElements) \ | 187 V(ArrayElements) \ |
| 187 V(DoubleArrayElements) \ | 188 V(DoubleArrayElements) \ |
| 188 V(SpecializedArrayElements) \ | 189 V(SpecializedArrayElements) \ |
| 189 V(GlobalVars) \ | 190 V(GlobalVars) \ |
| 190 V(Maps) \ | 191 V(Maps) \ |
| 191 V(ArrayLengths) \ | 192 V(ArrayLengths) \ |
| 192 V(ContextSlots) \ | 193 V(ContextSlots) \ |
| 193 V(OsrEntries) | 194 V(OsrEntries) |
| 194 | 195 |
| 195 #define DECLARE_ABSTRACT_INSTRUCTION(type) \ | 196 #define DECLARE_ABSTRACT_INSTRUCTION(type) \ |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 void ClearOperands(); | 615 void ClearOperands(); |
| 615 | 616 |
| 616 int flags() const { return flags_; } | 617 int flags() const { return flags_; } |
| 617 void SetFlag(Flag f) { flags_ |= (1 << f); } | 618 void SetFlag(Flag f) { flags_ |= (1 << f); } |
| 618 void ClearFlag(Flag f) { flags_ &= ~(1 << f); } | 619 void ClearFlag(Flag f) { flags_ &= ~(1 << f); } |
| 619 bool CheckFlag(Flag f) const { return (flags_ & (1 << f)) != 0; } | 620 bool CheckFlag(Flag f) const { return (flags_ & (1 << f)) != 0; } |
| 620 | 621 |
| 621 void SetAllSideEffects() { flags_ |= AllSideEffects(); } | 622 void SetAllSideEffects() { flags_ |= AllSideEffects(); } |
| 622 void ClearAllSideEffects() { flags_ &= ~AllSideEffects(); } | 623 void ClearAllSideEffects() { flags_ &= ~AllSideEffects(); } |
| 623 bool HasSideEffects() const { return (flags_ & AllSideEffects()) != 0; } | 624 bool HasSideEffects() const { return (flags_ & AllSideEffects()) != 0; } |
| 625 bool HasObservableSideEffects() const { |
| 626 return (flags_ & ObservableSideEffects()) != 0; |
| 627 } |
| 624 | 628 |
| 625 int ChangesFlags() const { return flags_ & ChangesFlagsMask(); } | 629 int ChangesFlags() const { return flags_ & ChangesFlagsMask(); } |
| 630 int ObservableChangesFlags() const { |
| 631 return flags_ & ChangesFlagsMask() & ObservableSideEffects(); |
| 632 } |
| 626 | 633 |
| 627 Range* range() const { return range_; } | 634 Range* range() const { return range_; } |
| 628 bool HasRange() const { return range_ != NULL; } | 635 bool HasRange() const { return range_ != NULL; } |
| 629 void AddNewRange(Range* r); | 636 void AddNewRange(Range* r); |
| 630 void RemoveLastAddedRange(); | 637 void RemoveLastAddedRange(); |
| 631 void ComputeInitialRange(); | 638 void ComputeInitialRange(); |
| 632 | 639 |
| 633 // Representation helpers. | 640 // Representation helpers. |
| 634 virtual Representation RequiredInputRepresentation(int index) = 0; | 641 virtual Representation RequiredInputRepresentation(int index) = 0; |
| 635 | 642 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 GVN_FLAG_LIST(ADD_FLAG) | 702 GVN_FLAG_LIST(ADD_FLAG) |
| 696 #undef ADD_FLAG | 703 #undef ADD_FLAG |
| 697 return result; | 704 return result; |
| 698 } | 705 } |
| 699 | 706 |
| 700 // A flag mask to mark an instruction as having arbitrary side effects. | 707 // A flag mask to mark an instruction as having arbitrary side effects. |
| 701 static int AllSideEffects() { | 708 static int AllSideEffects() { |
| 702 return ChangesFlagsMask() & ~(1 << kChangesOsrEntries); | 709 return ChangesFlagsMask() & ~(1 << kChangesOsrEntries); |
| 703 } | 710 } |
| 704 | 711 |
| 712 // A flag mask of all side effects that can make observable changes in |
| 713 // an executing program (i.e. are not safe to repeat, move or remove); |
| 714 static int ObservableSideEffects() { |
| 715 return ChangesFlagsMask() & ~(1 << kChangesElementsKind); |
| 716 } |
| 717 |
| 705 // Remove the matching use from the use list if present. Returns the | 718 // Remove the matching use from the use list if present. Returns the |
| 706 // removed list node or NULL. | 719 // removed list node or NULL. |
| 707 HUseListNode* RemoveUse(HValue* value, int index); | 720 HUseListNode* RemoveUse(HValue* value, int index); |
| 708 | 721 |
| 709 void RegisterUse(int index, HValue* new_value); | 722 void RegisterUse(int index, HValue* new_value); |
| 710 | 723 |
| 711 HBasicBlock* block_; | 724 HBasicBlock* block_; |
| 712 | 725 |
| 713 // The id of this instruction in the hydrogen graph, assigned when first | 726 // The id of this instruction in the hydrogen graph, assigned when first |
| 714 // added to the graph. Reflects creation order. | 727 // added to the graph. Reflects creation order. |
| (...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1732 protected: | 1745 protected: |
| 1733 virtual bool DataEquals(HValue* other) { return true; } | 1746 virtual bool DataEquals(HValue* other) { return true; } |
| 1734 }; | 1747 }; |
| 1735 | 1748 |
| 1736 | 1749 |
| 1737 class HElementsKind: public HUnaryOperation { | 1750 class HElementsKind: public HUnaryOperation { |
| 1738 public: | 1751 public: |
| 1739 explicit HElementsKind(HValue* value) : HUnaryOperation(value) { | 1752 explicit HElementsKind(HValue* value) : HUnaryOperation(value) { |
| 1740 set_representation(Representation::Integer32()); | 1753 set_representation(Representation::Integer32()); |
| 1741 SetFlag(kUseGVN); | 1754 SetFlag(kUseGVN); |
| 1742 SetFlag(kDependsOnMaps); | 1755 SetFlag(kDependsOnElementsKind); |
| 1743 } | 1756 } |
| 1744 | 1757 |
| 1745 virtual Representation RequiredInputRepresentation(int index) { | 1758 virtual Representation RequiredInputRepresentation(int index) { |
| 1746 return Representation::Tagged(); | 1759 return Representation::Tagged(); |
| 1747 } | 1760 } |
| 1748 | 1761 |
| 1749 DECLARE_CONCRETE_INSTRUCTION(ElementsKind) | 1762 DECLARE_CONCRETE_INSTRUCTION(ElementsKind) |
| 1750 | 1763 |
| 1751 protected: | 1764 protected: |
| 1752 virtual bool DataEquals(HValue* other) { return true; } | 1765 virtual bool DataEquals(HValue* other) { return true; } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1859 BuiltinFunctionId op_; | 1872 BuiltinFunctionId op_; |
| 1860 }; | 1873 }; |
| 1861 | 1874 |
| 1862 | 1875 |
| 1863 class HLoadElements: public HUnaryOperation { | 1876 class HLoadElements: public HUnaryOperation { |
| 1864 public: | 1877 public: |
| 1865 explicit HLoadElements(HValue* value) : HUnaryOperation(value) { | 1878 explicit HLoadElements(HValue* value) : HUnaryOperation(value) { |
| 1866 set_representation(Representation::Tagged()); | 1879 set_representation(Representation::Tagged()); |
| 1867 SetFlag(kUseGVN); | 1880 SetFlag(kUseGVN); |
| 1868 SetFlag(kDependsOnMaps); | 1881 SetFlag(kDependsOnMaps); |
| 1882 SetFlag(kDependsOnElementsKind); |
| 1869 } | 1883 } |
| 1870 | 1884 |
| 1871 virtual Representation RequiredInputRepresentation(int index) { | 1885 virtual Representation RequiredInputRepresentation(int index) { |
| 1872 return Representation::Tagged(); | 1886 return Representation::Tagged(); |
| 1873 } | 1887 } |
| 1874 | 1888 |
| 1875 DECLARE_CONCRETE_INSTRUCTION(LoadElements) | 1889 DECLARE_CONCRETE_INSTRUCTION(LoadElements) |
| 1876 | 1890 |
| 1877 protected: | 1891 protected: |
| 1878 virtual bool DataEquals(HValue* other) { return true; } | 1892 virtual bool DataEquals(HValue* other) { return true; } |
| (...skipping 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3908 | 3922 |
| 3909 class HTransitionElementsKind: public HTemplateInstruction<1> { | 3923 class HTransitionElementsKind: public HTemplateInstruction<1> { |
| 3910 public: | 3924 public: |
| 3911 HTransitionElementsKind(HValue* object, | 3925 HTransitionElementsKind(HValue* object, |
| 3912 Handle<Map> original_map, | 3926 Handle<Map> original_map, |
| 3913 Handle<Map> transitioned_map) | 3927 Handle<Map> transitioned_map) |
| 3914 : original_map_(original_map), | 3928 : original_map_(original_map), |
| 3915 transitioned_map_(transitioned_map) { | 3929 transitioned_map_(transitioned_map) { |
| 3916 SetOperandAt(0, object); | 3930 SetOperandAt(0, object); |
| 3917 SetFlag(kUseGVN); | 3931 SetFlag(kUseGVN); |
| 3918 SetFlag(kDependsOnMaps); | 3932 SetFlag(kChangesElementsKind); |
| 3919 set_representation(Representation::Tagged()); | 3933 set_representation(Representation::Tagged()); |
| 3920 } | 3934 } |
| 3921 | 3935 |
| 3922 virtual Representation RequiredInputRepresentation(int index) { | 3936 virtual Representation RequiredInputRepresentation(int index) { |
| 3923 return Representation::Tagged(); | 3937 return Representation::Tagged(); |
| 3924 } | 3938 } |
| 3925 | 3939 |
| 3926 HValue* object() { return OperandAt(0); } | 3940 HValue* object() { return OperandAt(0); } |
| 3927 Handle<Map> original_map() { return original_map_; } | 3941 Handle<Map> original_map() { return original_map_; } |
| 3928 Handle<Map> transitioned_map() { return transitioned_map_; } | 3942 Handle<Map> transitioned_map() { return transitioned_map_; } |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4297 | 4311 |
| 4298 DECLARE_CONCRETE_INSTRUCTION(In) | 4312 DECLARE_CONCRETE_INSTRUCTION(In) |
| 4299 }; | 4313 }; |
| 4300 | 4314 |
| 4301 #undef DECLARE_INSTRUCTION | 4315 #undef DECLARE_INSTRUCTION |
| 4302 #undef DECLARE_CONCRETE_INSTRUCTION | 4316 #undef DECLARE_CONCRETE_INSTRUCTION |
| 4303 | 4317 |
| 4304 } } // namespace v8::internal | 4318 } } // namespace v8::internal |
| 4305 | 4319 |
| 4306 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4320 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |