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

Unified Diff: src/objects.cc

Issue 2129933002: If we can't rehash the backing store for weak sets & maps, do a last resort GC (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | 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 9f7524ccefb7a4dc85ae9ee1677840b14e8d1bad..c8892c6e9a84ac1da892fb15adc9b14c5893055d 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -17747,6 +17747,17 @@ Handle<ObjectHashTable> ObjectHashTable::Put(Handle<ObjectHashTable> table,
if ((table->NumberOfDeletedElements() << 1) > table->NumberOfElements()) {
table->Rehash(isolate->factory()->undefined_value());
}
+ // If we're out of luck, we didn't get a GC recently, and so rehashing
+ // isn't enough to avoid a crash.
+ int nof = table->NumberOfElements() + 1;
+ if (!table->HasSufficientCapacity(nof)) {
+ int capacity = ObjectHashTable::ComputeCapacity(nof * 2);
+ if (capacity > ObjectHashTable::kMaxCapacity) {
+ isolate->heap()->CollectAllAvailableGarbage(
Hannes Payer (out of office) 2016/07/07 14:26:45 I am not happy with this CL since it adds another
+ "last resort gc (object hash table)");
+ table->Rehash(isolate->factory()->undefined_value());
+ }
+ }
// Check whether the hash table should be extended.
table = EnsureCapacity(table, 1, key);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698