OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 bool String::IsTwoByteRepresentation() { | 248 bool String::IsTwoByteRepresentation() { |
249 uint32_t type = map()->instance_type(); | 249 uint32_t type = map()->instance_type(); |
250 if ((type & kStringRepresentationMask) == kConsStringTag && | 250 if ((type & kStringRepresentationMask) == kConsStringTag && |
251 ConsString::cast(this)->second()->length() == 0) { | 251 ConsString::cast(this)->second()->length() == 0) { |
252 return ConsString::cast(this)->first()->IsTwoByteRepresentation(); | 252 return ConsString::cast(this)->first()->IsTwoByteRepresentation(); |
253 } | 253 } |
254 return (type & kStringEncodingMask) == kTwoByteStringTag; | 254 return (type & kStringEncodingMask) == kTwoByteStringTag; |
255 } | 255 } |
256 | 256 |
257 | 257 |
| 258 bool String::IsExternalTwoByteStringWithAsciiChars() { |
| 259 if (!IsExternalTwoByteString()) return false; |
| 260 const uc16* data = ExternalTwoByteString::cast(this)->resource()->data(); |
| 261 for (int i = 0, len = length(); i < len; i++) { |
| 262 if (data[i] > kMaxAsciiCharCode) return false; |
| 263 } |
| 264 return true; |
| 265 } |
| 266 |
| 267 |
258 bool StringShape::IsCons() { | 268 bool StringShape::IsCons() { |
259 return (type_ & kStringRepresentationMask) == kConsStringTag; | 269 return (type_ & kStringRepresentationMask) == kConsStringTag; |
260 } | 270 } |
261 | 271 |
262 | 272 |
263 bool StringShape::IsExternal() { | 273 bool StringShape::IsExternal() { |
264 return (type_ & kStringRepresentationMask) == kExternalStringTag; | 274 return (type_ & kStringRepresentationMask) == kExternalStringTag; |
265 } | 275 } |
266 | 276 |
267 | 277 |
(...skipping 2817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3085 #undef WRITE_INT_FIELD | 3095 #undef WRITE_INT_FIELD |
3086 #undef READ_SHORT_FIELD | 3096 #undef READ_SHORT_FIELD |
3087 #undef WRITE_SHORT_FIELD | 3097 #undef WRITE_SHORT_FIELD |
3088 #undef READ_BYTE_FIELD | 3098 #undef READ_BYTE_FIELD |
3089 #undef WRITE_BYTE_FIELD | 3099 #undef WRITE_BYTE_FIELD |
3090 | 3100 |
3091 | 3101 |
3092 } } // namespace v8::internal | 3102 } } // namespace v8::internal |
3093 | 3103 |
3094 #endif // V8_OBJECTS_INL_H_ | 3104 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |