| 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 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 bool HasRange() const { return range_ != NULL; } | 1051 bool HasRange() const { return range_ != NULL; } |
| 1052 bool CanBeNegative() const { return !HasRange() || range()->CanBeNegative(); } | 1052 bool CanBeNegative() const { return !HasRange() || range()->CanBeNegative(); } |
| 1053 bool CanBeZero() const { return !HasRange() || range()->CanBeZero(); } | 1053 bool CanBeZero() const { return !HasRange() || range()->CanBeZero(); } |
| 1054 bool RangeCanInclude(int value) const { | 1054 bool RangeCanInclude(int value) const { |
| 1055 return !HasRange() || range()->Includes(value); | 1055 return !HasRange() || range()->Includes(value); |
| 1056 } | 1056 } |
| 1057 void AddNewRange(Range* r, Zone* zone); | 1057 void AddNewRange(Range* r, Zone* zone); |
| 1058 void RemoveLastAddedRange(); | 1058 void RemoveLastAddedRange(); |
| 1059 void ComputeInitialRange(Zone* zone); | 1059 void ComputeInitialRange(Zone* zone); |
| 1060 | 1060 |
| 1061 // Escape analysis helpers. |
| 1062 virtual bool HasEscapingOperandAt(int index) { return true; } |
| 1063 |
| 1061 // Representation helpers. | 1064 // Representation helpers. |
| 1062 virtual Representation observed_input_representation(int index) { | 1065 virtual Representation observed_input_representation(int index) { |
| 1063 return Representation::None(); | 1066 return Representation::None(); |
| 1064 } | 1067 } |
| 1065 virtual Representation RequiredInputRepresentation(int index) = 0; | 1068 virtual Representation RequiredInputRepresentation(int index) = 0; |
| 1066 virtual void InferRepresentation(HInferRepresentation* h_infer); | 1069 virtual void InferRepresentation(HInferRepresentation* h_infer); |
| 1067 | 1070 |
| 1068 // This gives the instruction an opportunity to replace itself with an | 1071 // This gives the instruction an opportunity to replace itself with an |
| 1069 // instruction that does the same in some better way. To replace an | 1072 // instruction that does the same in some better way. To replace an |
| 1070 // instruction with a new one, first add the new instruction to the graph, | 1073 // instruction with a new one, first add the new instruction to the graph, |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1422 explicit HDummyUse(HValue* value) { | 1425 explicit HDummyUse(HValue* value) { |
| 1423 SetOperandAt(0, value); | 1426 SetOperandAt(0, value); |
| 1424 // Pretend to be a Smi so that the HChange instructions inserted | 1427 // Pretend to be a Smi so that the HChange instructions inserted |
| 1425 // before any use generate as little code as possible. | 1428 // before any use generate as little code as possible. |
| 1426 set_representation(Representation::Tagged()); | 1429 set_representation(Representation::Tagged()); |
| 1427 set_type(HType::Smi()); | 1430 set_type(HType::Smi()); |
| 1428 } | 1431 } |
| 1429 | 1432 |
| 1430 HValue* value() { return OperandAt(0); } | 1433 HValue* value() { return OperandAt(0); } |
| 1431 | 1434 |
| 1435 virtual bool HasEscapingOperandAt(int index) { return false; } |
| 1432 virtual Representation RequiredInputRepresentation(int index) { | 1436 virtual Representation RequiredInputRepresentation(int index) { |
| 1433 return Representation::None(); | 1437 return Representation::None(); |
| 1434 } | 1438 } |
| 1435 | 1439 |
| 1436 virtual void PrintDataTo(StringStream* stream); | 1440 virtual void PrintDataTo(StringStream* stream); |
| 1437 | 1441 |
| 1438 DECLARE_CONCRETE_INSTRUCTION(DummyUse); | 1442 DECLARE_CONCRETE_INSTRUCTION(DummyUse); |
| 1439 }; | 1443 }; |
| 1440 | 1444 |
| 1441 | 1445 |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 } | 1885 } |
| 1882 int ToOperandIndex(int environment_index) { | 1886 int ToOperandIndex(int environment_index) { |
| 1883 for (int i = 0; i < assigned_indexes_.length(); ++i) { | 1887 for (int i = 0; i < assigned_indexes_.length(); ++i) { |
| 1884 if (assigned_indexes_[i] == environment_index) return i; | 1888 if (assigned_indexes_[i] == environment_index) return i; |
| 1885 } | 1889 } |
| 1886 return -1; | 1890 return -1; |
| 1887 } | 1891 } |
| 1888 virtual int OperandCount() { return values_.length(); } | 1892 virtual int OperandCount() { return values_.length(); } |
| 1889 virtual HValue* OperandAt(int index) const { return values_[index]; } | 1893 virtual HValue* OperandAt(int index) const { return values_[index]; } |
| 1890 | 1894 |
| 1895 virtual bool HasEscapingOperandAt(int index) { return false; } |
| 1891 virtual Representation RequiredInputRepresentation(int index) { | 1896 virtual Representation RequiredInputRepresentation(int index) { |
| 1892 return Representation::None(); | 1897 return Representation::None(); |
| 1893 } | 1898 } |
| 1894 | 1899 |
| 1895 void MergeWith(ZoneList<HSimulate*>* list); | 1900 void MergeWith(ZoneList<HSimulate*>* list); |
| 1896 bool is_candidate_for_removal() { return removable_ == REMOVABLE_SIMULATE; } | 1901 bool is_candidate_for_removal() { return removable_ == REMOVABLE_SIMULATE; } |
| 1897 | 1902 |
| 1898 DECLARE_CONCRETE_INSTRUCTION(Simulate) | 1903 DECLARE_CONCRETE_INSTRUCTION(Simulate) |
| 1899 | 1904 |
| 1900 #ifdef DEBUG | 1905 #ifdef DEBUG |
| (...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2790 Map* transitioned_map = | 2795 Map* transitioned_map = |
| 2791 map->LookupElementsTransitionMap(kind); | 2796 map->LookupElementsTransitionMap(kind); |
| 2792 if (transitioned_map) { | 2797 if (transitioned_map) { |
| 2793 check_map->map_set_.Add(Handle<Map>(transitioned_map), zone); | 2798 check_map->map_set_.Add(Handle<Map>(transitioned_map), zone); |
| 2794 } | 2799 } |
| 2795 }; | 2800 }; |
| 2796 check_map->map_set_.Sort(); | 2801 check_map->map_set_.Sort(); |
| 2797 return check_map; | 2802 return check_map; |
| 2798 } | 2803 } |
| 2799 | 2804 |
| 2805 virtual bool HasEscapingOperandAt(int index) { return false; } |
| 2800 virtual Representation RequiredInputRepresentation(int index) { | 2806 virtual Representation RequiredInputRepresentation(int index) { |
| 2801 return Representation::Tagged(); | 2807 return Representation::Tagged(); |
| 2802 } | 2808 } |
| 2803 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator); | 2809 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator); |
| 2804 virtual void PrintDataTo(StringStream* stream); | 2810 virtual void PrintDataTo(StringStream* stream); |
| 2805 virtual HType CalculateInferredType(); | 2811 virtual HType CalculateInferredType(); |
| 2806 | 2812 |
| 2807 HValue* value() { return OperandAt(0); } | 2813 HValue* value() { return OperandAt(0); } |
| 2808 SmallMapList* map_set() { return &map_set_; } | 2814 SmallMapList* map_set() { return &map_set_; } |
| 2809 | 2815 |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3221 int arguments_count() const { return values_.length(); } | 3227 int arguments_count() const { return values_.length(); } |
| 3222 | 3228 |
| 3223 void AddArgument(HValue* argument, Zone* zone) { | 3229 void AddArgument(HValue* argument, Zone* zone) { |
| 3224 values_.Add(NULL, zone); // Resize list. | 3230 values_.Add(NULL, zone); // Resize list. |
| 3225 SetOperandAt(values_.length() - 1, argument); | 3231 SetOperandAt(values_.length() - 1, argument); |
| 3226 } | 3232 } |
| 3227 | 3233 |
| 3228 virtual int OperandCount() { return values_.length(); } | 3234 virtual int OperandCount() { return values_.length(); } |
| 3229 virtual HValue* OperandAt(int index) const { return values_[index]; } | 3235 virtual HValue* OperandAt(int index) const { return values_[index]; } |
| 3230 | 3236 |
| 3237 virtual bool HasEscapingOperandAt(int index) { return false; } |
| 3231 virtual Representation RequiredInputRepresentation(int index) { | 3238 virtual Representation RequiredInputRepresentation(int index) { |
| 3232 return Representation::None(); | 3239 return Representation::None(); |
| 3233 } | 3240 } |
| 3234 | 3241 |
| 3235 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) | 3242 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) |
| 3236 | 3243 |
| 3237 protected: | 3244 protected: |
| 3238 virtual void InternalSetOperandAt(int index, HValue* value) { | 3245 virtual void InternalSetOperandAt(int index, HValue* value) { |
| 3239 values_[index] = value; | 3246 values_[index] = value; |
| 3240 } | 3247 } |
| (...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5424 HValue* object() { return OperandAt(0); } | 5431 HValue* object() { return OperandAt(0); } |
| 5425 HValue* typecheck() { | 5432 HValue* typecheck() { |
| 5426 ASSERT(HasTypeCheck()); | 5433 ASSERT(HasTypeCheck()); |
| 5427 return OperandAt(1); | 5434 return OperandAt(1); |
| 5428 } | 5435 } |
| 5429 | 5436 |
| 5430 bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); } | 5437 bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); } |
| 5431 HObjectAccess access() const { return access_; } | 5438 HObjectAccess access() const { return access_; } |
| 5432 Representation field_representation() const { return representation_; } | 5439 Representation field_representation() const { return representation_; } |
| 5433 | 5440 |
| 5441 virtual bool HasEscapingOperandAt(int index) { return false; } |
| 5434 virtual Representation RequiredInputRepresentation(int index) { | 5442 virtual Representation RequiredInputRepresentation(int index) { |
| 5435 return Representation::Tagged(); | 5443 return Representation::Tagged(); |
| 5436 } | 5444 } |
| 5437 virtual void PrintDataTo(StringStream* stream); | 5445 virtual void PrintDataTo(StringStream* stream); |
| 5438 | 5446 |
| 5439 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) | 5447 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) |
| 5440 | 5448 |
| 5441 protected: | 5449 protected: |
| 5442 virtual bool DataEquals(HValue* other) { | 5450 virtual bool DataEquals(HValue* other) { |
| 5443 HLoadNamedField* b = HLoadNamedField::cast(other); | 5451 HLoadNamedField* b = HLoadNamedField::cast(other); |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5756 transition_(), | 5764 transition_(), |
| 5757 transition_unique_id_(), | 5765 transition_unique_id_(), |
| 5758 new_space_dominator_(NULL) { | 5766 new_space_dominator_(NULL) { |
| 5759 SetOperandAt(0, obj); | 5767 SetOperandAt(0, obj); |
| 5760 SetOperandAt(1, val); | 5768 SetOperandAt(1, val); |
| 5761 access.SetGVNFlags(this, true); | 5769 access.SetGVNFlags(this, true); |
| 5762 } | 5770 } |
| 5763 | 5771 |
| 5764 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) | 5772 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) |
| 5765 | 5773 |
| 5774 virtual bool HasEscapingOperandAt(int index) { return index == 1; } |
| 5766 virtual Representation RequiredInputRepresentation(int index) { | 5775 virtual Representation RequiredInputRepresentation(int index) { |
| 5767 if (FLAG_track_double_fields && | 5776 if (FLAG_track_double_fields && |
| 5768 index == 1 && field_representation_.IsDouble()) { | 5777 index == 1 && field_representation_.IsDouble()) { |
| 5769 return field_representation_; | 5778 return field_representation_; |
| 5770 } else if (FLAG_track_fields && | 5779 } else if (FLAG_track_fields && |
| 5771 index == 1 && field_representation_.IsSmi()) { | 5780 index == 1 && field_representation_.IsSmi()) { |
| 5772 return field_representation_; | 5781 return field_representation_; |
| 5773 } | 5782 } |
| 5774 return Representation::Tagged(); | 5783 return Representation::Tagged(); |
| 5775 } | 5784 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5888 SetGVNFlag(kChangesArrayElements); | 5897 SetGVNFlag(kChangesArrayElements); |
| 5889 } | 5898 } |
| 5890 | 5899 |
| 5891 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. | 5900 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. |
| 5892 if (elements_kind >= EXTERNAL_BYTE_ELEMENTS && | 5901 if (elements_kind >= EXTERNAL_BYTE_ELEMENTS && |
| 5893 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) { | 5902 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) { |
| 5894 SetFlag(kTruncatingToInt32); | 5903 SetFlag(kTruncatingToInt32); |
| 5895 } | 5904 } |
| 5896 } | 5905 } |
| 5897 | 5906 |
| 5907 virtual bool HasEscapingOperandAt(int index) { return index != 0; } |
| 5898 virtual Representation RequiredInputRepresentation(int index) { | 5908 virtual Representation RequiredInputRepresentation(int index) { |
| 5899 // kind_fast: tagged[int32] = tagged | 5909 // kind_fast: tagged[int32] = tagged |
| 5900 // kind_double: tagged[int32] = double | 5910 // kind_double: tagged[int32] = double |
| 5901 // kind_smi : tagged[int32] = smi | 5911 // kind_smi : tagged[int32] = smi |
| 5902 // kind_external: external[int32] = (double | int32) | 5912 // kind_external: external[int32] = (double | int32) |
| 5903 if (index == 0) { | 5913 if (index == 0) { |
| 5904 return is_external() ? Representation::External() | 5914 return is_external() ? Representation::External() |
| 5905 : Representation::Tagged(); | 5915 : Representation::Tagged(); |
| 5906 } else if (index == 1) { | 5916 } else if (index == 1) { |
| 5907 return ArrayInstructionInterface::KeyedAccessIndexRequirement( | 5917 return ArrayInstructionInterface::KeyedAccessIndexRequirement( |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6641 virtual bool IsDeletable() const { return true; } | 6651 virtual bool IsDeletable() const { return true; } |
| 6642 }; | 6652 }; |
| 6643 | 6653 |
| 6644 | 6654 |
| 6645 #undef DECLARE_INSTRUCTION | 6655 #undef DECLARE_INSTRUCTION |
| 6646 #undef DECLARE_CONCRETE_INSTRUCTION | 6656 #undef DECLARE_CONCRETE_INSTRUCTION |
| 6647 | 6657 |
| 6648 } } // namespace v8::internal | 6658 } } // namespace v8::internal |
| 6649 | 6659 |
| 6650 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6660 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |