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 6441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6452 // whether a hash code has been computed. If the hash code has been | 6452 // whether a hash code has been computed. If the hash code has been |
6453 // computed the 2nd bit tells whether the string can be used as an | 6453 // computed the 2nd bit tells whether the string can be used as an |
6454 // array index. | 6454 // array index. |
6455 static const int kHashNotComputedMask = 1; | 6455 static const int kHashNotComputedMask = 1; |
6456 static const int kIsNotArrayIndexMask = 1 << 1; | 6456 static const int kIsNotArrayIndexMask = 1 << 1; |
6457 static const int kNofHashBitFields = 2; | 6457 static const int kNofHashBitFields = 2; |
6458 | 6458 |
6459 // Shift constant retrieving hash code from hash field. | 6459 // Shift constant retrieving hash code from hash field. |
6460 static const int kHashShift = kNofHashBitFields; | 6460 static const int kHashShift = kNofHashBitFields; |
6461 | 6461 |
| 6462 // Only these bits are relevant in the hash, since the top two are shifted |
| 6463 // out. |
| 6464 static const uint32_t kHashBitMask = 0xffffffffu >> kHashShift; |
| 6465 |
6462 // Array index strings this short can keep their index in the hash | 6466 // Array index strings this short can keep their index in the hash |
6463 // field. | 6467 // field. |
6464 static const int kMaxCachedArrayIndexLength = 7; | 6468 static const int kMaxCachedArrayIndexLength = 7; |
6465 | 6469 |
6466 // For strings which are array indexes the hash value has the string length | 6470 // For strings which are array indexes the hash value has the string length |
6467 // mixed into the hash, mainly to avoid a hash value of zero which would be | 6471 // mixed into the hash, mainly to avoid a hash value of zero which would be |
6468 // the case for the string '0'. 24 bits are used for the array index value. | 6472 // the case for the string '0'. 24 bits are used for the array index value. |
6469 static const int kArrayIndexValueBits = 24; | 6473 static const int kArrayIndexValueBits = 24; |
6470 static const int kArrayIndexLengthBits = | 6474 static const int kArrayIndexLengthBits = |
6471 kBitsPerInt - kArrayIndexValueBits - kNofHashBitFields; | 6475 kBitsPerInt - kArrayIndexValueBits - kNofHashBitFields; |
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8011 } else { | 8015 } else { |
8012 value &= ~(1 << bit_position); | 8016 value &= ~(1 << bit_position); |
8013 } | 8017 } |
8014 return value; | 8018 return value; |
8015 } | 8019 } |
8016 }; | 8020 }; |
8017 | 8021 |
8018 } } // namespace v8::internal | 8022 } } // namespace v8::internal |
8019 | 8023 |
8020 #endif // V8_OBJECTS_H_ | 8024 #endif // V8_OBJECTS_H_ |
OLD | NEW |