| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 <iosfwd> | 8 #include <iosfwd> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 2856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2867 | 2867 |
| 2868 inline void FillWithHoles(int from, int to); | 2868 inline void FillWithHoles(int from, int to); |
| 2869 | 2869 |
| 2870 // Shrink length and insert filler objects. | 2870 // Shrink length and insert filler objects. |
| 2871 void Shrink(int length); | 2871 void Shrink(int length); |
| 2872 | 2872 |
| 2873 // Copy a sub array from the receiver to dest. | 2873 // Copy a sub array from the receiver to dest. |
| 2874 void CopyTo(int pos, FixedArray* dest, int dest_pos, int len); | 2874 void CopyTo(int pos, FixedArray* dest, int dest_pos, int len); |
| 2875 | 2875 |
| 2876 // Garbage collection support. | 2876 // Garbage collection support. |
| 2877 static int SizeFor(int length) { return kHeaderSize + length * kPointerSize; } | 2877 static constexpr int SizeFor(int length) { |
| 2878 return kHeaderSize + length * kPointerSize; |
| 2879 } |
| 2878 | 2880 |
| 2879 // Code Generation support. | 2881 // Code Generation support. |
| 2880 static int OffsetOfElementAt(int index) { return SizeFor(index); } | 2882 static constexpr int OffsetOfElementAt(int index) { return SizeFor(index); } |
| 2881 | 2883 |
| 2882 // Garbage collection support. | 2884 // Garbage collection support. |
| 2883 inline Object** RawFieldOfElementAt(int index); | 2885 inline Object** RawFieldOfElementAt(int index); |
| 2884 | 2886 |
| 2885 DECLARE_CAST(FixedArray) | 2887 DECLARE_CAST(FixedArray) |
| 2886 | 2888 |
| 2887 // Maximal allowed size, in bytes, of a single FixedArray. | 2889 // Maximal allowed size, in bytes, of a single FixedArray. |
| 2888 // Prevents overflowing size computations, as well as extreme memory | 2890 // Prevents overflowing size computations, as well as extreme memory |
| 2889 // consumption. | 2891 // consumption. |
| 2890 static const int kMaxSize = 128 * MB * kPointerSize; | 2892 static const int kMaxSize = 128 * MB * kPointerSize; |
| (...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4271 } | 4273 } |
| 4272 | 4274 |
| 4273 // When the table is obsolete we store the indexes of the removed holes. | 4275 // When the table is obsolete we store the indexes of the removed holes. |
| 4274 int RemovedIndexAt(int index) { | 4276 int RemovedIndexAt(int index) { |
| 4275 return Smi::cast(get(kRemovedHolesIndex + index))->value(); | 4277 return Smi::cast(get(kRemovedHolesIndex + index))->value(); |
| 4276 } | 4278 } |
| 4277 | 4279 |
| 4278 static const int kNotFound = -1; | 4280 static const int kNotFound = -1; |
| 4279 static const int kMinCapacity = 4; | 4281 static const int kMinCapacity = 4; |
| 4280 | 4282 |
| 4281 static const int kNumberOfBucketsIndex = 0; | 4283 static const int kNumberOfElementsIndex = 0; |
| 4282 static const int kNumberOfElementsIndex = kNumberOfBucketsIndex + 1; | 4284 // The next table is stored at the same index as the nof elements. |
| 4285 static const int kNextTableIndex = kNumberOfElementsIndex; |
| 4283 static const int kNumberOfDeletedElementsIndex = kNumberOfElementsIndex + 1; | 4286 static const int kNumberOfDeletedElementsIndex = kNumberOfElementsIndex + 1; |
| 4284 static const int kHashTableStartIndex = kNumberOfDeletedElementsIndex + 1; | 4287 static const int kNumberOfBucketsIndex = kNumberOfDeletedElementsIndex + 1; |
| 4285 static const int kNextTableIndex = kNumberOfElementsIndex; | 4288 static const int kHashTableStartIndex = kNumberOfBucketsIndex + 1; |
| 4286 | 4289 |
| 4287 static const int kNumberOfBucketsOffset = | 4290 static constexpr const int kNumberOfElementsOffset = |
| 4288 kHeaderSize + kNumberOfBucketsIndex * kPointerSize; | 4291 FixedArray::OffsetOfElementAt(kNumberOfElementsIndex); |
| 4289 static const int kNumberOfElementsOffset = | 4292 static constexpr const int kNextTableOffset = |
| 4290 kHeaderSize + kNumberOfElementsIndex * kPointerSize; | 4293 FixedArray::OffsetOfElementAt(kNextTableIndex); |
| 4291 static const int kNumberOfDeletedElementsOffset = | 4294 static constexpr const int kNumberOfDeletedElementsOffset = |
| 4292 kHeaderSize + kNumberOfDeletedElementsIndex * kPointerSize; | 4295 FixedArray::OffsetOfElementAt(kNumberOfDeletedElementsIndex); |
| 4293 static const int kHashTableStartOffset = | 4296 static constexpr const int kNumberOfBucketsOffset = |
| 4294 kHeaderSize + kHashTableStartIndex * kPointerSize; | 4297 FixedArray::OffsetOfElementAt(kNumberOfBucketsIndex); |
| 4295 static const int kNextTableOffset = | 4298 static constexpr const int kHashTableStartOffset = |
| 4296 kHeaderSize + kNextTableIndex * kPointerSize; | 4299 FixedArray::OffsetOfElementAt(kHashTableStartIndex); |
| 4297 | 4300 |
| 4298 static const int kEntrySize = entrysize + 1; | 4301 static const int kEntrySize = entrysize + 1; |
| 4299 static const int kChainOffset = entrysize; | 4302 static const int kChainOffset = entrysize; |
| 4300 | 4303 |
| 4301 static const int kLoadFactor = 2; | 4304 static const int kLoadFactor = 2; |
| 4302 | 4305 |
| 4303 // NumberOfDeletedElements is set to kClearedTableSentinel when | 4306 // NumberOfDeletedElements is set to kClearedTableSentinel when |
| 4304 // the table is cleared, which allows iterator transitions to | 4307 // the table is cleared, which allows iterator transitions to |
| 4305 // optimize that case. | 4308 // optimize that case. |
| 4306 static const int kClearedTableSentinel = -1; | 4309 static const int kClearedTableSentinel = -1; |
| (...skipping 7390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11697 } | 11700 } |
| 11698 }; | 11701 }; |
| 11699 | 11702 |
| 11700 | 11703 |
| 11701 } // NOLINT, false-positive due to second-order macros. | 11704 } // NOLINT, false-positive due to second-order macros. |
| 11702 } // NOLINT, false-positive due to second-order macros. | 11705 } // NOLINT, false-positive due to second-order macros. |
| 11703 | 11706 |
| 11704 #include "src/objects/object-macros-undef.h" | 11707 #include "src/objects/object-macros-undef.h" |
| 11705 | 11708 |
| 11706 #endif // V8_OBJECTS_H_ | 11709 #endif // V8_OBJECTS_H_ |
| OLD | NEW |