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 8776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8787 // For strings which are array indexes the hash value has the string length | 8787 // For strings which are array indexes the hash value has the string length |
8788 // mixed into the hash, mainly to avoid a hash value of zero which would be | 8788 // mixed into the hash, mainly to avoid a hash value of zero which would be |
8789 // the case for the string '0'. 24 bits are used for the array index value. | 8789 // the case for the string '0'. 24 bits are used for the array index value. |
8790 static const int kArrayIndexValueBits = 24; | 8790 static const int kArrayIndexValueBits = 24; |
8791 static const int kArrayIndexLengthBits = | 8791 static const int kArrayIndexLengthBits = |
8792 kBitsPerInt - kArrayIndexValueBits - kNofHashBitFields; | 8792 kBitsPerInt - kArrayIndexValueBits - kNofHashBitFields; |
8793 | 8793 |
8794 STATIC_ASSERT((kArrayIndexLengthBits > 0)); | 8794 STATIC_ASSERT((kArrayIndexLengthBits > 0)); |
8795 | 8795 |
8796 class ArrayIndexValueBits : public BitField<unsigned int, kNofHashBitFields, | 8796 class ArrayIndexValueBits : public BitField<unsigned int, kNofHashBitFields, |
8797 kArrayIndexValueBits> {}; | 8797 kArrayIndexValueBits> {} |
rafaelw
2014/05/27 23:48:43
These aren't a part of this change. git-cl was com
| |
8798 class ArrayIndexLengthBits : public BitField<unsigned int, | 8798 class ArrayIndexLengthBits : public BitField<unsigned int, |
8799 kNofHashBitFields + kArrayIndexValueBits, | 8799 kNofHashBitFields + kArrayIndexValueBits, |
8800 kArrayIndexLengthBits> {}; | 8800 kArrayIndexLengthBits> {} |
8801 | 8801 |
8802 // Check that kMaxCachedArrayIndexLength + 1 is a power of two so we | 8802 // Check that kMaxCachedArrayIndexLength + 1 is a power of two so we |
8803 // could use a mask to test if the length of string is less than or equal to | 8803 // could use a mask to test if the length of string is less than or equal to |
8804 // kMaxCachedArrayIndexLength. | 8804 // kMaxCachedArrayIndexLength. |
8805 STATIC_ASSERT(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1)); | 8805 STATIC_ASSERT(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1)); |
8806 | 8806 |
8807 static const unsigned int kContainsCachedArrayIndexMask = | 8807 static const unsigned int kContainsCachedArrayIndexMask = |
8808 (~kMaxCachedArrayIndexLength << ArrayIndexLengthBits::kShift) | | 8808 (~kMaxCachedArrayIndexLength << ArrayIndexLengthBits::kShift) | |
8809 kIsNotArrayIndexMask; | 8809 kIsNotArrayIndexMask; |
8810 | 8810 |
(...skipping 2257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11068 } else { | 11068 } else { |
11069 value &= ~(1 << bit_position); | 11069 value &= ~(1 << bit_position); |
11070 } | 11070 } |
11071 return value; | 11071 return value; |
11072 } | 11072 } |
11073 }; | 11073 }; |
11074 | 11074 |
11075 } } // namespace v8::internal | 11075 } } // namespace v8::internal |
11076 | 11076 |
11077 #endif // V8_OBJECTS_H_ | 11077 #endif // V8_OBJECTS_H_ |
OLD | NEW |