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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 case kTwoByteStringTag: | 334 case kTwoByteStringTag: |
335 return true; | 335 return true; |
336 default: // Cons or sliced string. Need to go deeper. | 336 default: // Cons or sliced string. Need to go deeper. |
337 return GetUnderlying()->IsTwoByteRepresentation(); | 337 return GetUnderlying()->IsTwoByteRepresentation(); |
338 } | 338 } |
339 } | 339 } |
340 | 340 |
341 | 341 |
342 bool String::HasOnlyAsciiChars() { | 342 bool String::HasOnlyAsciiChars() { |
343 uint32_t type = map()->instance_type(); | 343 uint32_t type = map()->instance_type(); |
| 344 #ifndef ENABLE_LATIN_1 |
| 345 return (type & kStringEncodingMask) == kOneByteStringTag || |
| 346 (type & kAsciiDataHintMask) == kAsciiDataHintTag; |
| 347 #else |
344 return (type & kAsciiDataHintMask) == kAsciiDataHintTag; | 348 return (type & kAsciiDataHintMask) == kAsciiDataHintTag; |
| 349 #endif |
345 } | 350 } |
346 | 351 |
347 | 352 |
348 bool String::IsOneByteConvertible() { | 353 bool String::IsOneByteConvertible() { |
349 return HasOnlyAsciiChars() || IsOneByteRepresentation(); | 354 return HasOnlyAsciiChars() || IsOneByteRepresentation(); |
350 } | 355 } |
351 | 356 |
352 | 357 |
353 bool StringShape::IsCons() { | 358 bool StringShape::IsCons() { |
354 return (type_ & kStringRepresentationMask) == kConsStringTag; | 359 return (type_ & kStringRepresentationMask) == kConsStringTag; |
(...skipping 5432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5787 #undef WRITE_UINT32_FIELD | 5792 #undef WRITE_UINT32_FIELD |
5788 #undef READ_SHORT_FIELD | 5793 #undef READ_SHORT_FIELD |
5789 #undef WRITE_SHORT_FIELD | 5794 #undef WRITE_SHORT_FIELD |
5790 #undef READ_BYTE_FIELD | 5795 #undef READ_BYTE_FIELD |
5791 #undef WRITE_BYTE_FIELD | 5796 #undef WRITE_BYTE_FIELD |
5792 | 5797 |
5793 | 5798 |
5794 } } // namespace v8::internal | 5799 } } // namespace v8::internal |
5795 | 5800 |
5796 #endif // V8_OBJECTS_INL_H_ | 5801 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |