| 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 3081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3092 | 3092 |
| 3093 // Limits on sizes of different types of strings. | 3093 // Limits on sizes of different types of strings. |
| 3094 static const int kMaxShortStringSize = 255; | 3094 static const int kMaxShortStringSize = 255; |
| 3095 static const int kMaxMediumStringSize = 65535; | 3095 static const int kMaxMediumStringSize = 65535; |
| 3096 | 3096 |
| 3097 static const int kMaxArrayIndexSize = 10; | 3097 static const int kMaxArrayIndexSize = 10; |
| 3098 | 3098 |
| 3099 // Max ascii char code. | 3099 // Max ascii char code. |
| 3100 static const int kMaxAsciiCharCode = unibrow::Utf8::kMaxOneByteChar; | 3100 static const int kMaxAsciiCharCode = unibrow::Utf8::kMaxOneByteChar; |
| 3101 | 3101 |
| 3102 // Minimum lenth for a cons or sliced string. | 3102 // Minimum length for a cons or sliced string. |
| 3103 static const int kMinNonFlatLength = 13; | 3103 static const int kMinNonFlatLength = 13; |
| 3104 | 3104 |
| 3105 // Mask constant for checking if a string has a computed hash code | 3105 // Mask constant for checking if a string has a computed hash code |
| 3106 // and if it is an array index. The least significant bit indicates | 3106 // and if it is an array index. The least significant bit indicates |
| 3107 // whether a hash code has been computed. If the hash code has been | 3107 // whether a hash code has been computed. If the hash code has been |
| 3108 // computed the 2nd bit tells whether the string can be used as an | 3108 // computed the 2nd bit tells whether the string can be used as an |
| 3109 // array index. | 3109 // array index. |
| 3110 static const int kHashComputedMask = 1; | 3110 static const int kHashComputedMask = 1; |
| 3111 static const int kIsArrayIndexMask = 1 << 1; | 3111 static const int kIsArrayIndexMask = 1 << 1; |
| 3112 static const int kNofLengthBitFields = 2; | 3112 static const int kNofLengthBitFields = 2; |
| 3113 | 3113 |
| 3114 // Array index strings this short can keep their index in the hash |
| 3115 // field. |
| 3116 static const int kMaxCachedArrayIndexLength = 6; |
| 3117 |
| 3114 // Shift constants for retriving length and hash code from | 3118 // Shift constants for retriving length and hash code from |
| 3115 // length/hash field. | 3119 // length/hash field. |
| 3116 static const int kHashShift = kNofLengthBitFields; | 3120 static const int kHashShift = kNofLengthBitFields; |
| 3117 static const int kShortLengthShift = 3 * kBitsPerByte; | 3121 static const int kShortLengthShift = 3 * kBitsPerByte; |
| 3118 static const int kMediumLengthShift = 2 * kBitsPerByte; | 3122 static const int kMediumLengthShift = 2 * kBitsPerByte; |
| 3119 static const int kLongLengthShift = kHashShift; | 3123 static const int kLongLengthShift = kHashShift; |
| 3120 | 3124 |
| 3121 | |
| 3122 // Limit for truncation in short printing. | 3125 // Limit for truncation in short printing. |
| 3123 static const int kMaxShortPrintLength = 1024; | 3126 static const int kMaxShortPrintLength = 1024; |
| 3124 | 3127 |
| 3125 // Support for regular expressions. | 3128 // Support for regular expressions. |
| 3126 const uc16* GetTwoByteData(); | 3129 const uc16* GetTwoByteData(); |
| 3127 const uc16* GetTwoByteData(unsigned start); | 3130 const uc16* GetTwoByteData(unsigned start); |
| 3128 | 3131 |
| 3129 // Support for StringInputBuffer | 3132 // Support for StringInputBuffer |
| 3130 static const unibrow::byte* ReadBlock(String* input, | 3133 static const unibrow::byte* ReadBlock(String* input, |
| 3131 unibrow::byte* util_buffer, | 3134 unibrow::byte* util_buffer, |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4051 } else { | 4054 } else { |
| 4052 value &= ~(1 << bit_position); | 4055 value &= ~(1 << bit_position); |
| 4053 } | 4056 } |
| 4054 return value; | 4057 return value; |
| 4055 } | 4058 } |
| 4056 }; | 4059 }; |
| 4057 | 4060 |
| 4058 } } // namespace v8::internal | 4061 } } // namespace v8::internal |
| 4059 | 4062 |
| 4060 #endif // V8_OBJECTS_H_ | 4063 #endif // V8_OBJECTS_H_ |
| OLD | NEW |