| 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 "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
| 10 #include "src/builtins.h" | 10 #include "src/builtins.h" |
| (...skipping 8987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8998 class ArrayIndexLengthBits : public BitField<unsigned int, | 8998 class ArrayIndexLengthBits : public BitField<unsigned int, |
| 8999 kNofHashBitFields + kArrayIndexValueBits, | 8999 kNofHashBitFields + kArrayIndexValueBits, |
| 9000 kArrayIndexLengthBits> {}; // NOLINT | 9000 kArrayIndexLengthBits> {}; // NOLINT |
| 9001 | 9001 |
| 9002 // Check that kMaxCachedArrayIndexLength + 1 is a power of two so we | 9002 // Check that kMaxCachedArrayIndexLength + 1 is a power of two so we |
| 9003 // could use a mask to test if the length of string is less than or equal to | 9003 // could use a mask to test if the length of string is less than or equal to |
| 9004 // kMaxCachedArrayIndexLength. | 9004 // kMaxCachedArrayIndexLength. |
| 9005 STATIC_ASSERT(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1)); | 9005 STATIC_ASSERT(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1)); |
| 9006 | 9006 |
| 9007 static const unsigned int kContainsCachedArrayIndexMask = | 9007 static const unsigned int kContainsCachedArrayIndexMask = |
| 9008 (~kMaxCachedArrayIndexLength << ArrayIndexLengthBits::kShift) | | 9008 (~static_cast<unsigned>(kMaxCachedArrayIndexLength) |
| 9009 << ArrayIndexLengthBits::kShift) | |
| 9009 kIsNotArrayIndexMask; | 9010 kIsNotArrayIndexMask; |
| 9010 | 9011 |
| 9011 // Value of empty hash field indicating that the hash is not computed. | 9012 // Value of empty hash field indicating that the hash is not computed. |
| 9012 static const int kEmptyHashField = | 9013 static const int kEmptyHashField = |
| 9013 kIsNotArrayIndexMask | kHashNotComputedMask; | 9014 kIsNotArrayIndexMask | kHashNotComputedMask; |
| 9014 | 9015 |
| 9015 protected: | 9016 protected: |
| 9016 static inline bool IsHashFieldComputed(uint32_t field); | 9017 static inline bool IsHashFieldComputed(uint32_t field); |
| 9017 | 9018 |
| 9018 private: | 9019 private: |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9082 class ArrayIndexLengthBits : public BitField<unsigned int, | 9083 class ArrayIndexLengthBits : public BitField<unsigned int, |
| 9083 kNofHashBitFields + kArrayIndexValueBits, | 9084 kNofHashBitFields + kArrayIndexValueBits, |
| 9084 kArrayIndexLengthBits> {}; // NOLINT | 9085 kArrayIndexLengthBits> {}; // NOLINT |
| 9085 | 9086 |
| 9086 // Check that kMaxCachedArrayIndexLength + 1 is a power of two so we | 9087 // Check that kMaxCachedArrayIndexLength + 1 is a power of two so we |
| 9087 // could use a mask to test if the length of string is less than or equal to | 9088 // could use a mask to test if the length of string is less than or equal to |
| 9088 // kMaxCachedArrayIndexLength. | 9089 // kMaxCachedArrayIndexLength. |
| 9089 STATIC_ASSERT(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1)); | 9090 STATIC_ASSERT(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1)); |
| 9090 | 9091 |
| 9091 static const unsigned int kContainsCachedArrayIndexMask = | 9092 static const unsigned int kContainsCachedArrayIndexMask = |
| 9092 (~kMaxCachedArrayIndexLength << ArrayIndexLengthBits::kShift) | | 9093 (~static_cast<unsigned>(kMaxCachedArrayIndexLength) |
| 9094 << ArrayIndexLengthBits::kShift) | |
| 9093 kIsNotArrayIndexMask; | 9095 kIsNotArrayIndexMask; |
| 9094 | 9096 |
| 9095 // Representation of the flat content of a String. | 9097 // Representation of the flat content of a String. |
| 9096 // A non-flat string doesn't have flat content. | 9098 // A non-flat string doesn't have flat content. |
| 9097 // A flat string has content that's encoded as a sequence of either | 9099 // A flat string has content that's encoded as a sequence of either |
| 9098 // ASCII chars or two-byte UC16. | 9100 // ASCII chars or two-byte UC16. |
| 9099 // Returned by String::GetFlatContent(). | 9101 // Returned by String::GetFlatContent(). |
| 9100 class FlatContent { | 9102 class FlatContent { |
| 9101 public: | 9103 public: |
| 9102 // Returns true if the string is flat and this structure contains content. | 9104 // Returns true if the string is flat and this structure contains content. |
| (...skipping 2162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11265 } else { | 11267 } else { |
| 11266 value &= ~(1 << bit_position); | 11268 value &= ~(1 << bit_position); |
| 11267 } | 11269 } |
| 11268 return value; | 11270 return value; |
| 11269 } | 11271 } |
| 11270 }; | 11272 }; |
| 11271 | 11273 |
| 11272 } } // namespace v8::internal | 11274 } } // namespace v8::internal |
| 11273 | 11275 |
| 11274 #endif // V8_OBJECTS_H_ | 11276 #endif // V8_OBJECTS_H_ |
| OLD | NEW |