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

Unified Diff: src/objects.h

Issue 796503002: Create optimized versions of the Map/Set clear method (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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/hydrogen-instructions.h ('k') | src/objects.cc » ('j') | 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 cc93bde592a5d7151821892bb084ee5b280f1e44..67184ff06b063b8be8250580231df5b3d8ae230a 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -3921,6 +3921,7 @@ class OrderedHashTable: public FixedArray {
static const int kNumberOfElementsIndex = kNumberOfBucketsIndex + 1;
static const int kNumberOfDeletedElementsIndex = kNumberOfElementsIndex + 1;
static const int kHashTableStartIndex = kNumberOfDeletedElementsIndex + 1;
+ static const int kNextTableIndex = kNumberOfElementsIndex;
static const int kNumberOfBucketsOffset =
kHeaderSize + kNumberOfBucketsIndex * kPointerSize;
@@ -3930,12 +3931,19 @@ class OrderedHashTable: public FixedArray {
kHeaderSize + kNumberOfDeletedElementsIndex * kPointerSize;
static const int kHashTableStartOffset =
kHeaderSize + kHashTableStartIndex * kPointerSize;
+ static const int kNextTableOffset =
+ kHeaderSize + kNextTableIndex * kPointerSize;
static const int kEntrySize = entrysize + 1;
static const int kChainOffset = entrysize;
static const int kLoadFactor = 2;
+ // NumberOfDeletedElements is set to kClearedTableSentinel when
+ // the table is cleared, which allows iterator transitions to
+ // optimize that case.
+ static const int kClearedTableSentinel = -1;
+
private:
static Handle<Derived> Rehash(Handle<Derived> table, int new_capacity);
@@ -3977,7 +3985,6 @@ class OrderedHashTable: public FixedArray {
return set(kRemovedHolesIndex + index, Smi::FromInt(removed_index));
}
- static const int kNextTableIndex = kNumberOfElementsIndex;
static const int kRemovedHolesIndex = kHashTableStartIndex;
static const int kMaxCapacity =
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698