OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 && HeapObject::cast(this)->map()->instance_type() >= FIRST_SPEC_OBJECT_TYPE; | 164 && HeapObject::cast(this)->map()->instance_type() >= FIRST_SPEC_OBJECT_TYPE; |
165 } | 165 } |
166 | 166 |
167 | 167 |
168 bool Object::IsSymbol() { | 168 bool Object::IsSymbol() { |
169 if (!this->IsHeapObject()) return false; | 169 if (!this->IsHeapObject()) return false; |
170 uint32_t type = HeapObject::cast(this)->map()->instance_type(); | 170 uint32_t type = HeapObject::cast(this)->map()->instance_type(); |
171 // Because the symbol tag is non-zero and no non-string types have the | 171 // Because the symbol tag is non-zero and no non-string types have the |
172 // symbol bit set we can test for symbols with a very simple test | 172 // symbol bit set we can test for symbols with a very simple test |
173 // operation. | 173 // operation. |
174 ASSERT(kSymbolTag != 0); | 174 STATIC_ASSERT(kSymbolTag != 0); |
175 ASSERT(kNotStringTag + kIsSymbolMask > LAST_TYPE); | 175 ASSERT(kNotStringTag + kIsSymbolMask > LAST_TYPE); |
176 return (type & kIsSymbolMask) != 0; | 176 return (type & kIsSymbolMask) != 0; |
177 } | 177 } |
178 | 178 |
179 | 179 |
180 bool Object::IsConsString() { | 180 bool Object::IsConsString() { |
181 if (!IsString()) return false; | 181 if (!IsString()) return false; |
182 return StringShape(String::cast(this)).IsCons(); | 182 return StringShape(String::cast(this)).IsCons(); |
183 } | 183 } |
184 | 184 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 249 |
250 StringShape::StringShape(InstanceType t) | 250 StringShape::StringShape(InstanceType t) |
251 : type_(static_cast<uint32_t>(t)) { | 251 : type_(static_cast<uint32_t>(t)) { |
252 set_valid(); | 252 set_valid(); |
253 ASSERT((type_ & kIsNotStringMask) == kStringTag); | 253 ASSERT((type_ & kIsNotStringMask) == kStringTag); |
254 } | 254 } |
255 | 255 |
256 | 256 |
257 bool StringShape::IsSymbol() { | 257 bool StringShape::IsSymbol() { |
258 ASSERT(valid()); | 258 ASSERT(valid()); |
259 ASSERT(kSymbolTag != 0); | 259 STATIC_ASSERT(kSymbolTag != 0); |
260 return (type_ & kIsSymbolMask) != 0; | 260 return (type_ & kIsSymbolMask) != 0; |
261 } | 261 } |
262 | 262 |
263 | 263 |
264 bool String::IsAsciiRepresentation() { | 264 bool String::IsAsciiRepresentation() { |
265 uint32_t type = map()->instance_type(); | 265 uint32_t type = map()->instance_type(); |
266 return (type & kStringEncodingMask) == kAsciiStringTag; | 266 return (type & kStringEncodingMask) == kAsciiStringTag; |
267 } | 267 } |
268 | 268 |
269 | 269 |
(...skipping 4409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4679 #undef WRITE_INT_FIELD | 4679 #undef WRITE_INT_FIELD |
4680 #undef READ_SHORT_FIELD | 4680 #undef READ_SHORT_FIELD |
4681 #undef WRITE_SHORT_FIELD | 4681 #undef WRITE_SHORT_FIELD |
4682 #undef READ_BYTE_FIELD | 4682 #undef READ_BYTE_FIELD |
4683 #undef WRITE_BYTE_FIELD | 4683 #undef WRITE_BYTE_FIELD |
4684 | 4684 |
4685 | 4685 |
4686 } } // namespace v8::internal | 4686 } } // namespace v8::internal |
4687 | 4687 |
4688 #endif // V8_OBJECTS_INL_H_ | 4688 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |