OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include "allocation.h" | 8 #include "allocation.h" |
9 #include "assert-scope.h" | 9 #include "assert-scope.h" |
10 #include "builtins.h" | 10 #include "builtins.h" |
(...skipping 8780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8791 // For strings which are array indexes the hash value has the string length | 8791 // For strings which are array indexes the hash value has the string length |
8792 // mixed into the hash, mainly to avoid a hash value of zero which would be | 8792 // mixed into the hash, mainly to avoid a hash value of zero which would be |
8793 // the case for the string '0'. 24 bits are used for the array index value. | 8793 // the case for the string '0'. 24 bits are used for the array index value. |
8794 static const int kArrayIndexValueBits = 24; | 8794 static const int kArrayIndexValueBits = 24; |
8795 static const int kArrayIndexLengthBits = | 8795 static const int kArrayIndexLengthBits = |
8796 kBitsPerInt - kArrayIndexValueBits - kNofHashBitFields; | 8796 kBitsPerInt - kArrayIndexValueBits - kNofHashBitFields; |
8797 | 8797 |
8798 STATIC_ASSERT((kArrayIndexLengthBits > 0)); | 8798 STATIC_ASSERT((kArrayIndexLengthBits > 0)); |
8799 | 8799 |
8800 class ArrayIndexValueBits : public BitField<unsigned int, kNofHashBitFields, | 8800 class ArrayIndexValueBits : public BitField<unsigned int, kNofHashBitFields, |
8801 kArrayIndexValueBits> {}; | 8801 kArrayIndexValueBits> {}; // NOLINT |
8802 class ArrayIndexLengthBits : public BitField<unsigned int, | 8802 class ArrayIndexLengthBits : public BitField<unsigned int, |
8803 kNofHashBitFields + kArrayIndexValueBits, | 8803 kNofHashBitFields + kArrayIndexValueBits, |
8804 kArrayIndexLengthBits> {}; | 8804 kArrayIndexLengthBits> {}; // NOLINT |
8805 | 8805 |
8806 // Check that kMaxCachedArrayIndexLength + 1 is a power of two so we | 8806 // Check that kMaxCachedArrayIndexLength + 1 is a power of two so we |
8807 // could use a mask to test if the length of string is less than or equal to | 8807 // could use a mask to test if the length of string is less than or equal to |
8808 // kMaxCachedArrayIndexLength. | 8808 // kMaxCachedArrayIndexLength. |
8809 STATIC_ASSERT(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1)); | 8809 STATIC_ASSERT(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1)); |
8810 | 8810 |
8811 static const unsigned int kContainsCachedArrayIndexMask = | 8811 static const unsigned int kContainsCachedArrayIndexMask = |
8812 (~kMaxCachedArrayIndexLength << ArrayIndexLengthBits::kShift) | | 8812 (~kMaxCachedArrayIndexLength << ArrayIndexLengthBits::kShift) | |
8813 kIsNotArrayIndexMask; | 8813 kIsNotArrayIndexMask; |
8814 | 8814 |
(...skipping 2259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11074 } else { | 11074 } else { |
11075 value &= ~(1 << bit_position); | 11075 value &= ~(1 << bit_position); |
11076 } | 11076 } |
11077 return value; | 11077 return value; |
11078 } | 11078 } |
11079 }; | 11079 }; |
11080 | 11080 |
11081 } } // namespace v8::internal | 11081 } } // namespace v8::internal |
11082 | 11082 |
11083 #endif // V8_OBJECTS_H_ | 11083 #endif // V8_OBJECTS_H_ |
OLD | NEW |