| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 TRANSITION = 6, | 75 TRANSITION = 6, |
| 76 // Only used as a marker in LookupResult. | 76 // Only used as a marker in LookupResult. |
| 77 NONEXISTENT = 7 | 77 NONEXISTENT = 7 |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 | 80 |
| 81 class Representation { | 81 class Representation { |
| 82 public: | 82 public: |
| 83 enum Kind { | 83 enum Kind { |
| 84 kNone, | 84 kNone, |
| 85 kByte, | |
| 86 kSmi, | 85 kSmi, |
| 87 kInteger32, | 86 kInteger32, |
| 88 kDouble, | 87 kDouble, |
| 89 kHeapObject, | 88 kHeapObject, |
| 90 kTagged, | 89 kTagged, |
| 91 kExternal, | 90 kExternal, |
| 92 kNumRepresentations | 91 kNumRepresentations |
| 93 }; | 92 }; |
| 94 | 93 |
| 95 Representation() : kind_(kNone) { } | 94 Representation() : kind_(kNone) { } |
| 96 | 95 |
| 97 static Representation None() { return Representation(kNone); } | 96 static Representation None() { return Representation(kNone); } |
| 98 static Representation Tagged() { return Representation(kTagged); } | 97 static Representation Tagged() { return Representation(kTagged); } |
| 99 static Representation Byte() { return Representation(kByte); } | |
| 100 static Representation Smi() { return Representation(kSmi); } | 98 static Representation Smi() { return Representation(kSmi); } |
| 101 static Representation Integer32() { return Representation(kInteger32); } | 99 static Representation Integer32() { return Representation(kInteger32); } |
| 102 static Representation Double() { return Representation(kDouble); } | 100 static Representation Double() { return Representation(kDouble); } |
| 103 static Representation HeapObject() { return Representation(kHeapObject); } | 101 static Representation HeapObject() { return Representation(kHeapObject); } |
| 104 static Representation External() { return Representation(kExternal); } | 102 static Representation External() { return Representation(kExternal); } |
| 105 | 103 |
| 106 static Representation FromKind(Kind kind) { return Representation(kind); } | 104 static Representation FromKind(Kind kind) { return Representation(kind); } |
| 107 | 105 |
| 108 // TODO(rossberg): this should die eventually. | 106 // TODO(rossberg): this should die eventually. |
| 109 static Representation FromType(TypeInfo info); | 107 static Representation FromType(TypeInfo info); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 134 } | 132 } |
| 135 | 133 |
| 136 Representation generalize(Representation other) { | 134 Representation generalize(Representation other) { |
| 137 if (other.fits_into(*this)) return *this; | 135 if (other.fits_into(*this)) return *this; |
| 138 if (other.is_more_general_than(*this)) return other; | 136 if (other.is_more_general_than(*this)) return other; |
| 139 return Representation::Tagged(); | 137 return Representation::Tagged(); |
| 140 } | 138 } |
| 141 | 139 |
| 142 Kind kind() const { return static_cast<Kind>(kind_); } | 140 Kind kind() const { return static_cast<Kind>(kind_); } |
| 143 bool IsNone() const { return kind_ == kNone; } | 141 bool IsNone() const { return kind_ == kNone; } |
| 144 bool IsByte() const { return kind_ == kByte; } | |
| 145 bool IsTagged() const { return kind_ == kTagged; } | 142 bool IsTagged() const { return kind_ == kTagged; } |
| 146 bool IsSmi() const { return kind_ == kSmi; } | 143 bool IsSmi() const { return kind_ == kSmi; } |
| 147 bool IsSmiOrTagged() const { return IsSmi() || IsTagged(); } | 144 bool IsSmiOrTagged() const { return IsSmi() || IsTagged(); } |
| 148 bool IsInteger32() const { return kind_ == kInteger32; } | 145 bool IsInteger32() const { return kind_ == kInteger32; } |
| 149 bool IsSmiOrInteger32() const { return IsSmi() || IsInteger32(); } | 146 bool IsSmiOrInteger32() const { return IsSmi() || IsInteger32(); } |
| 150 bool IsDouble() const { return kind_ == kDouble; } | 147 bool IsDouble() const { return kind_ == kDouble; } |
| 151 bool IsHeapObject() const { return kind_ == kHeapObject; } | 148 bool IsHeapObject() const { return kind_ == kHeapObject; } |
| 152 bool IsExternal() const { return kind_ == kExternal; } | 149 bool IsExternal() const { return kind_ == kExternal; } |
| 153 bool IsSpecialization() const { | 150 bool IsSpecialization() const { |
| 154 return IsByte() || IsSmi() || IsInteger32() || IsDouble(); | 151 return kind_ == kInteger32 || kind_ == kDouble || kind_ == kSmi; |
| 155 } | 152 } |
| 156 const char* Mnemonic() const; | 153 const char* Mnemonic() const; |
| 157 | 154 |
| 158 private: | 155 private: |
| 159 explicit Representation(Kind k) : kind_(k) { } | 156 explicit Representation(Kind k) : kind_(k) { } |
| 160 | 157 |
| 161 // Make sure kind fits in int8. | 158 // Make sure kind fits in int8. |
| 162 STATIC_ASSERT(kNumRepresentations <= (1 << kBitsPerByte)); | 159 STATIC_ASSERT(kNumRepresentations <= (1 << kBitsPerByte)); |
| 163 | 160 |
| 164 int8_t kind_; | 161 int8_t kind_; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 PropertyDetails(int value, PropertyAttributes attributes) { | 269 PropertyDetails(int value, PropertyAttributes attributes) { |
| 273 value_ = AttributesField::update(value, attributes); | 270 value_ = AttributesField::update(value, attributes); |
| 274 } | 271 } |
| 275 | 272 |
| 276 uint32_t value_; | 273 uint32_t value_; |
| 277 }; | 274 }; |
| 278 | 275 |
| 279 } } // namespace v8::internal | 276 } } // namespace v8::internal |
| 280 | 277 |
| 281 #endif // V8_PROPERTY_DETAILS_H_ | 278 #endif // V8_PROPERTY_DETAILS_H_ |
| OLD | NEW |