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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 virtual bool Is##type() const { return false; } | 677 virtual bool Is##type() const { return false; } |
678 HYDROGEN_ABSTRACT_INSTRUCTION_LIST(DECLARE_PREDICATE) | 678 HYDROGEN_ABSTRACT_INSTRUCTION_LIST(DECLARE_PREDICATE) |
679 #undef DECLARE_PREDICATE | 679 #undef DECLARE_PREDICATE |
680 | 680 |
681 HValue(HType type = HType::Tagged()) | 681 HValue(HType type = HType::Tagged()) |
682 : block_(NULL), | 682 : block_(NULL), |
683 id_(kNoNumber), | 683 id_(kNoNumber), |
684 type_(type), | 684 type_(type), |
685 use_list_(NULL), | 685 use_list_(NULL), |
686 range_(NULL), | 686 range_(NULL), |
| 687 #ifdef DEBUG |
| 688 range_poisoned_(false), |
| 689 #endif |
687 flags_(0) {} | 690 flags_(0) {} |
688 virtual ~HValue() {} | 691 virtual ~HValue() {} |
689 | 692 |
690 virtual HSourcePosition position() const { | 693 virtual HSourcePosition position() const { |
691 return HSourcePosition::Unknown(); | 694 return HSourcePosition::Unknown(); |
692 } | 695 } |
693 virtual HSourcePosition operand_position(int index) const { | 696 virtual HSourcePosition operand_position(int index) const { |
694 return position(); | 697 return position(); |
695 } | 698 } |
696 | 699 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 result.Intersect(AllSideEffectsFlagSet()); | 850 result.Intersect(AllSideEffectsFlagSet()); |
848 return result; | 851 return result; |
849 } | 852 } |
850 | 853 |
851 GVNFlagSet ObservableChangesFlags() const { | 854 GVNFlagSet ObservableChangesFlags() const { |
852 GVNFlagSet result = ChangesFlags(); | 855 GVNFlagSet result = ChangesFlags(); |
853 result.Intersect(AllObservableSideEffectsFlagSet()); | 856 result.Intersect(AllObservableSideEffectsFlagSet()); |
854 return result; | 857 return result; |
855 } | 858 } |
856 | 859 |
857 Range* range() const { return range_; } | 860 Range* range() const { |
858 // TODO(svenpanne) We should really use the null object pattern here. | 861 ASSERT(!range_poisoned_); |
859 bool HasRange() const { return range_ != NULL; } | 862 return range_; |
| 863 } |
| 864 bool HasRange() const { |
| 865 ASSERT(!range_poisoned_); |
| 866 return range_ != NULL; |
| 867 } |
| 868 #ifdef DEBUG |
| 869 void PoisonRange() { range_poisoned_ = true; } |
| 870 #endif |
860 void AddNewRange(Range* r, Zone* zone); | 871 void AddNewRange(Range* r, Zone* zone); |
861 void RemoveLastAddedRange(); | 872 void RemoveLastAddedRange(); |
862 void ComputeInitialRange(Zone* zone); | 873 void ComputeInitialRange(Zone* zone); |
863 | 874 |
864 // Escape analysis helpers. | 875 // Escape analysis helpers. |
865 virtual bool HasEscapingOperandAt(int index) { return true; } | 876 virtual bool HasEscapingOperandAt(int index) { return true; } |
866 virtual bool HasOutOfBoundsAccess(int size) { return false; } | 877 virtual bool HasOutOfBoundsAccess(int size) { return false; } |
867 | 878 |
868 // Representation helpers. | 879 // Representation helpers. |
869 virtual Representation observed_input_representation(int index) { | 880 virtual Representation observed_input_representation(int index) { |
(...skipping 11 matching lines...) Expand all Loading... |
881 bool Equals(HValue* other); | 892 bool Equals(HValue* other); |
882 virtual intptr_t Hashcode(); | 893 virtual intptr_t Hashcode(); |
883 | 894 |
884 // Compute unique ids upfront that is safe wrt GC and concurrent compilation. | 895 // Compute unique ids upfront that is safe wrt GC and concurrent compilation. |
885 virtual void FinalizeUniqueness() { } | 896 virtual void FinalizeUniqueness() { } |
886 | 897 |
887 // Printing support. | 898 // Printing support. |
888 virtual void PrintTo(StringStream* stream) = 0; | 899 virtual void PrintTo(StringStream* stream) = 0; |
889 void PrintNameTo(StringStream* stream); | 900 void PrintNameTo(StringStream* stream); |
890 void PrintTypeTo(StringStream* stream); | 901 void PrintTypeTo(StringStream* stream); |
891 void PrintRangeTo(StringStream* stream); | |
892 void PrintChangesTo(StringStream* stream); | 902 void PrintChangesTo(StringStream* stream); |
893 | 903 |
894 const char* Mnemonic() const; | 904 const char* Mnemonic() const; |
895 | 905 |
896 // Type information helpers. | 906 // Type information helpers. |
897 bool HasMonomorphicJSObjectType(); | 907 bool HasMonomorphicJSObjectType(); |
898 | 908 |
899 // TODO(mstarzinger): For now instructions can override this function to | 909 // TODO(mstarzinger): For now instructions can override this function to |
900 // specify statically known types, once HType can convey more information | 910 // specify statically known types, once HType can convey more information |
901 // it should be based on the HType. | 911 // it should be based on the HType. |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 HBasicBlock* block_; | 1031 HBasicBlock* block_; |
1022 | 1032 |
1023 // The id of this instruction in the hydrogen graph, assigned when first | 1033 // The id of this instruction in the hydrogen graph, assigned when first |
1024 // added to the graph. Reflects creation order. | 1034 // added to the graph. Reflects creation order. |
1025 int id_; | 1035 int id_; |
1026 | 1036 |
1027 Representation representation_; | 1037 Representation representation_; |
1028 HType type_; | 1038 HType type_; |
1029 HUseListNode* use_list_; | 1039 HUseListNode* use_list_; |
1030 Range* range_; | 1040 Range* range_; |
| 1041 #ifdef DEBUG |
| 1042 bool range_poisoned_; |
| 1043 #endif |
1031 int flags_; | 1044 int flags_; |
1032 GVNFlagSet changes_flags_; | 1045 GVNFlagSet changes_flags_; |
1033 GVNFlagSet depends_on_flags_; | 1046 GVNFlagSet depends_on_flags_; |
1034 | 1047 |
1035 private: | 1048 private: |
1036 virtual bool IsDeletable() const { return false; } | 1049 virtual bool IsDeletable() const { return false; } |
1037 | 1050 |
1038 DISALLOW_COPY_AND_ASSIGN(HValue); | 1051 DISALLOW_COPY_AND_ASSIGN(HValue); |
1039 }; | 1052 }; |
1040 | 1053 |
(...skipping 6485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7526 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7539 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7527 }; | 7540 }; |
7528 | 7541 |
7529 | 7542 |
7530 #undef DECLARE_INSTRUCTION | 7543 #undef DECLARE_INSTRUCTION |
7531 #undef DECLARE_CONCRETE_INSTRUCTION | 7544 #undef DECLARE_CONCRETE_INSTRUCTION |
7532 | 7545 |
7533 } } // namespace v8::internal | 7546 } } // namespace v8::internal |
7534 | 7547 |
7535 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7548 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |