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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 | 92 |
93 static Representation None() { return Representation(kNone); } | 93 static Representation None() { return Representation(kNone); } |
94 static Representation Tagged() { return Representation(kTagged); } | 94 static Representation Tagged() { return Representation(kTagged); } |
95 static Representation Smi() { return Representation(kSmi); } | 95 static Representation Smi() { return Representation(kSmi); } |
96 static Representation Integer32() { return Representation(kInteger32); } | 96 static Representation Integer32() { return Representation(kInteger32); } |
97 static Representation Double() { return Representation(kDouble); } | 97 static Representation Double() { return Representation(kDouble); } |
98 static Representation External() { return Representation(kExternal); } | 98 static Representation External() { return Representation(kExternal); } |
99 | 99 |
100 static Representation FromKind(Kind kind) { return Representation(kind); } | 100 static Representation FromKind(Kind kind) { return Representation(kind); } |
101 | 101 |
102 bool Equals(const Representation& other) { | 102 bool Equals(const Representation& other) const { |
103 return kind_ == other.kind_; | 103 return kind_ == other.kind_; |
104 } | 104 } |
105 | 105 |
106 bool is_more_general_than(const Representation& other) { | 106 bool is_more_general_than(const Representation& other) const { |
107 ASSERT(kind_ != kExternal); | 107 ASSERT(kind_ != kExternal); |
108 ASSERT(other.kind_ != kExternal); | 108 ASSERT(other.kind_ != kExternal); |
109 return kind_ > other.kind_; | 109 return kind_ > other.kind_; |
110 } | 110 } |
111 | 111 |
112 bool fits(const Representation& other) const { | |
danno
2013/05/02 14:26:41
how about "fits_in"? Easier to read e.g. (if this-
Toon Verwaest
2013/05/02 15:15:57
Done.
| |
113 return other.is_more_general_than(*this) || other.Equals(*this); | |
114 } | |
115 | |
112 Representation generalize(Representation other) { | 116 Representation generalize(Representation other) { |
113 if (is_more_general_than(other)) { | 117 if (is_more_general_than(other)) { |
114 return *this; | 118 return *this; |
115 } else { | 119 } else { |
116 return other; | 120 return other; |
117 } | 121 } |
118 } | 122 } |
119 | 123 |
120 Kind kind() const { return static_cast<Kind>(kind_); } | 124 Kind kind() const { return static_cast<Kind>(kind_); } |
121 bool IsNone() const { return kind_ == kNone; } | 125 bool IsNone() const { return kind_ == kNone; } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
237 value_ = RepresentationField::update( | 241 value_ = RepresentationField::update( |
238 value, EncodeRepresentation(representation)); | 242 value, EncodeRepresentation(representation)); |
239 } | 243 } |
240 | 244 |
241 uint32_t value_; | 245 uint32_t value_; |
242 }; | 246 }; |
243 | 247 |
244 } } // namespace v8::internal | 248 } } // namespace v8::internal |
245 | 249 |
246 #endif // V8_PROPERTY_DETAILS_H_ | 250 #endif // V8_PROPERTY_DETAILS_H_ |
OLD | NEW |