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

Unified Diff: src/objects.cc

Issue 1944303002: Version 5.0.71.45 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@5.0
Patch Set: Created 4 years, 7 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 | « include/v8-version.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index a60b2d5428862053378864cb9b92ffee547e0bc5..c6d826218d0716b403f0c9a6bbbf6c315ba6d74d 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -16501,6 +16501,16 @@ void HeapSortPairs(FixedArray* content, FixedArray* numbers, int len) {
}
}
}
+ // Wipe deleted entries.
+ Heap* heap = GetHeap();
+ Object* the_hole = heap->the_hole_value();
+ Object* undefined = heap->undefined_value();
+ for (uint32_t current = 0; current < capacity; current++) {
+ if (get(EntryToIndex(current)) == the_hole) {
+ set(EntryToIndex(current), undefined);
+ }
+ }
+ SetNumberOfDeletedElements(0);
}
@@ -18709,6 +18719,12 @@ Handle<ObjectHashTable> ObjectHashTable::Put(Handle<ObjectHashTable> table,
return table;
}
+ // Rehash if more than 25% of the entries are deleted entries.
+ // TODO(jochen): Consider to shrink the fixed array in place.
+ if ((table->NumberOfDeletedElements() << 1) > table->NumberOfElements()) {
+ table->Rehash(isolate->factory()->undefined_value());
+ }
+
// Check whether the hash table should be extended.
table = EnsureCapacity(table, 1, key);
table->AddEntry(table->FindInsertionEntry(hash), *key, *value);
« no previous file with comments | « include/v8-version.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698