Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Unified Diff: src/objects.h

Issue 2630373002: [collections] Shuffle OrderedHashTable fields around for future optimization (Closed)
Patch Set: do the proper english thing Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/js/macros.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 783ed61fd37912461ff002431d19fa703f049c6b..189649836baaa79412a24d9a770b9ef9e13002ae 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -2874,10 +2874,12 @@ class FixedArray: public FixedArrayBase {
void CopyTo(int pos, FixedArray* dest, int dest_pos, int len);
// Garbage collection support.
- static int SizeFor(int length) { return kHeaderSize + length * kPointerSize; }
+ static constexpr int SizeFor(int length) {
+ return kHeaderSize + length * kPointerSize;
+ }
// Code Generation support.
- static int OffsetOfElementAt(int index) { return SizeFor(index); }
+ static constexpr int OffsetOfElementAt(int index) { return SizeFor(index); }
// Garbage collection support.
inline Object** RawFieldOfElementAt(int index);
@@ -4278,22 +4280,23 @@ class OrderedHashTable: public FixedArray {
static const int kNotFound = -1;
static const int kMinCapacity = 4;
- static const int kNumberOfBucketsIndex = 0;
- static const int kNumberOfElementsIndex = kNumberOfBucketsIndex + 1;
- static const int kNumberOfDeletedElementsIndex = kNumberOfElementsIndex + 1;
- static const int kHashTableStartIndex = kNumberOfDeletedElementsIndex + 1;
+ static const int kNumberOfElementsIndex = 0;
+ // The next table is stored at the same index as the nof elements.
static const int kNextTableIndex = kNumberOfElementsIndex;
-
- static const int kNumberOfBucketsOffset =
- kHeaderSize + kNumberOfBucketsIndex * kPointerSize;
- static const int kNumberOfElementsOffset =
- kHeaderSize + kNumberOfElementsIndex * kPointerSize;
- static const int kNumberOfDeletedElementsOffset =
- kHeaderSize + kNumberOfDeletedElementsIndex * kPointerSize;
- static const int kHashTableStartOffset =
- kHeaderSize + kHashTableStartIndex * kPointerSize;
- static const int kNextTableOffset =
- kHeaderSize + kNextTableIndex * kPointerSize;
+ static const int kNumberOfDeletedElementsIndex = kNumberOfElementsIndex + 1;
+ static const int kNumberOfBucketsIndex = kNumberOfDeletedElementsIndex + 1;
+ static const int kHashTableStartIndex = kNumberOfBucketsIndex + 1;
+
+ static constexpr const int kNumberOfElementsOffset =
+ FixedArray::OffsetOfElementAt(kNumberOfElementsIndex);
+ static constexpr const int kNextTableOffset =
+ FixedArray::OffsetOfElementAt(kNextTableIndex);
+ static constexpr const int kNumberOfDeletedElementsOffset =
+ FixedArray::OffsetOfElementAt(kNumberOfDeletedElementsIndex);
+ static constexpr const int kNumberOfBucketsOffset =
+ FixedArray::OffsetOfElementAt(kNumberOfBucketsIndex);
+ static constexpr const int kHashTableStartOffset =
+ FixedArray::OffsetOfElementAt(kHashTableStartIndex);
static const int kEntrySize = entrysize + 1;
static const int kChainOffset = entrysize;
« no previous file with comments | « src/js/macros.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698