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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) const { | 102 bool Equals(const Representation& other) const { |
103 return kind_ == other.kind_; | 103 return kind_ == other.kind_; |
104 } | 104 } |
105 | 105 |
| 106 bool IsCompatibleForLoad(const Representation& other) const { |
| 107 return (IsDouble() && other.IsDouble()) || |
| 108 (!IsDouble() && !other.IsDouble()); |
| 109 } |
| 110 |
106 bool is_more_general_than(const Representation& other) const { | 111 bool is_more_general_than(const Representation& other) const { |
107 ASSERT(kind_ != kExternal); | 112 ASSERT(kind_ != kExternal); |
108 ASSERT(other.kind_ != kExternal); | 113 ASSERT(other.kind_ != kExternal); |
109 return kind_ > other.kind_; | 114 return kind_ > other.kind_; |
110 } | 115 } |
111 | 116 |
112 bool fits_into(const Representation& other) const { | 117 bool fits_into(const Representation& other) const { |
113 return other.is_more_general_than(*this) || other.Equals(*this); | 118 return other.is_more_general_than(*this) || other.Equals(*this); |
114 } | 119 } |
115 | 120 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 value_ = RepresentationField::update( | 246 value_ = RepresentationField::update( |
242 value, EncodeRepresentation(representation)); | 247 value, EncodeRepresentation(representation)); |
243 } | 248 } |
244 | 249 |
245 uint32_t value_; | 250 uint32_t value_; |
246 }; | 251 }; |
247 | 252 |
248 } } // namespace v8::internal | 253 } } // namespace v8::internal |
249 | 254 |
250 #endif // V8_PROPERTY_DETAILS_H_ | 255 #endif // V8_PROPERTY_DETAILS_H_ |
OLD | NEW |