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