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); |