| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 4052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4063 void StringPrint(); | 4063 void StringPrint(); |
| 4064 void StringVerify(); | 4064 void StringVerify(); |
| 4065 #endif | 4065 #endif |
| 4066 inline bool IsFlat(); | 4066 inline bool IsFlat(); |
| 4067 | 4067 |
| 4068 // Layout description. | 4068 // Layout description. |
| 4069 static const int kLengthOffset = HeapObject::kHeaderSize; | 4069 static const int kLengthOffset = HeapObject::kHeaderSize; |
| 4070 static const int kSize = kLengthOffset + kIntSize; | 4070 static const int kSize = kLengthOffset + kIntSize; |
| 4071 // Notice: kSize is not pointer-size aligned if pointers are 64-bit. | 4071 // Notice: kSize is not pointer-size aligned if pointers are 64-bit. |
| 4072 | 4072 |
| 4073 // Limits on sizes of different types of strings. | 4073 // Maximum number of characters to consider when trying to convert a string |
| 4074 static const int kMaxShortStringSize = 63; | 4074 // value into an array index. |
| 4075 static const int kMaxMediumStringSize = 16383; | |
| 4076 | |
| 4077 static const int kMaxArrayIndexSize = 10; | 4075 static const int kMaxArrayIndexSize = 10; |
| 4078 | 4076 |
| 4079 // Max ascii char code. | 4077 // Max ascii char code. |
| 4080 static const int kMaxAsciiCharCode = unibrow::Utf8::kMaxOneByteChar; | 4078 static const int kMaxAsciiCharCode = unibrow::Utf8::kMaxOneByteChar; |
| 4081 static const unsigned kMaxAsciiCharCodeU = unibrow::Utf8::kMaxOneByteChar; | 4079 static const unsigned kMaxAsciiCharCodeU = unibrow::Utf8::kMaxOneByteChar; |
| 4082 static const int kMaxUC16CharCode = 0xffff; | 4080 static const int kMaxUC16CharCode = 0xffff; |
| 4083 | 4081 |
| 4084 // Minimum length for a cons or sliced string. | 4082 // Minimum length for a cons or sliced string. |
| 4085 static const int kMinNonFlatLength = 13; | 4083 static const int kMinNonFlatLength = 13; |
| 4086 | 4084 |
| 4087 // Mask constant for checking if a string has a computed hash code | 4085 // Mask constant for checking if a string has a computed hash code |
| 4088 // and if it is an array index. The least significant bit indicates | 4086 // and if it is an array index. The least significant bit indicates |
| 4089 // whether a hash code has been computed. If the hash code has been | 4087 // whether a hash code has been computed. If the hash code has been |
| 4090 // computed the 2nd bit tells whether the string can be used as an | 4088 // computed the 2nd bit tells whether the string can be used as an |
| 4091 // array index. | 4089 // array index. |
| 4092 static const int kHashComputedMask = 1; | 4090 static const int kHashComputedMask = 1; |
| 4093 static const int kIsArrayIndexMask = 1 << 1; | 4091 static const int kIsArrayIndexMask = 1 << 1; |
| 4094 static const int kNofLengthBitFields = 2; | 4092 static const int kNofLengthBitFields = 2; |
| 4095 | 4093 |
| 4096 // Array index strings this short can keep their index in the hash | 4094 // Array index strings this short can keep their index in the hash |
| 4097 // field. | 4095 // field. |
| 4098 static const int kMaxCachedArrayIndexLength = 7; | 4096 static const int kMaxCachedArrayIndexLength = 7; |
| 4099 | 4097 |
| 4100 // Shift constants for retriving length and hash code from | 4098 // Shift constants for retrieving length and hash code from |
| 4101 // length/hash field. | 4099 // length/hash field. |
| 4102 static const int kHashShift = kNofLengthBitFields; | 4100 static const int kHashShift = kNofLengthBitFields; |
| 4103 static const int kShortLengthShift = kHashShift + kShortStringTag; | 4101 static const int kShortLengthShift = kHashShift + kShortStringTag; |
| 4104 static const int kMediumLengthShift = kHashShift + kMediumStringTag; | 4102 static const int kMediumLengthShift = kHashShift + kMediumStringTag; |
| 4105 static const int kLongLengthShift = kHashShift + kLongStringTag; | 4103 static const int kLongLengthShift = kHashShift + kLongStringTag; |
| 4106 // Maximal string length that can be stored in the hash/length field. | 4104 |
| 4105 // Maximal string length that can be stored in the hash/length field for |
| 4106 // different types of strings. |
| 4107 static const int kMaxShortSize = (1 << (32 - kShortLengthShift)) - 1; |
| 4108 static const int kMaxMediumSize = (1 << (32 - kMediumLengthShift)) - 1; |
| 4107 static const int kMaxLength = (1 << (32 - kLongLengthShift)) - 1; | 4109 static const int kMaxLength = (1 << (32 - kLongLengthShift)) - 1; |
| 4108 | 4110 |
| 4109 // Limit for truncation in short printing. | 4111 // Limit for truncation in short printing. |
| 4110 static const int kMaxShortPrintLength = 1024; | 4112 static const int kMaxShortPrintLength = 1024; |
| 4111 | 4113 |
| 4112 // Support for regular expressions. | 4114 // Support for regular expressions. |
| 4113 const uc16* GetTwoByteData(); | 4115 const uc16* GetTwoByteData(); |
| 4114 const uc16* GetTwoByteData(unsigned start); | 4116 const uc16* GetTwoByteData(unsigned start); |
| 4115 | 4117 |
| 4116 // Support for StringInputBuffer | 4118 // Support for StringInputBuffer |
| (...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5144 } else { | 5146 } else { |
| 5145 value &= ~(1 << bit_position); | 5147 value &= ~(1 << bit_position); |
| 5146 } | 5148 } |
| 5147 return value; | 5149 return value; |
| 5148 } | 5150 } |
| 5149 }; | 5151 }; |
| 5150 | 5152 |
| 5151 } } // namespace v8::internal | 5153 } } // namespace v8::internal |
| 5152 | 5154 |
| 5153 #endif // V8_OBJECTS_H_ | 5155 #endif // V8_OBJECTS_H_ |
| OLD | NEW |