diff --git a/deps/v8z/include/v8-version.h b/deps/v8z/include/v8-version.h index cfd3fdb73a6e..6cd4ac3b448c 100644 --- a/deps/v8z/include/v8-version.h +++ b/deps/v8z/include/v8-version.h @@ -11,7 +11,7 @@ #define V8_MAJOR_VERSION 4 #define V8_MINOR_VERSION 5 #define V8_BUILD_NUMBER 103 -#define V8_PATCH_LEVEL 39 +#define V8_PATCH_LEVEL 40 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8z/src/objects.cc b/deps/v8z/src/objects.cc index 5cc43e35990a..d16c8e408c30 100644 --- a/deps/v8z/src/objects.cc +++ b/deps/v8z/src/objects.cc @@ -15213,6 +15213,19 @@ Handle ObjectHashTable::Put(Handle 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) { + for (size_t i = 0; i < 2; ++i) { + isolate->heap()->CollectAllGarbage( + Heap::kFinalizeIncrementalMarkingMask, "full object hash table"); + } + table->Rehash(isolate->factory()->undefined_value()); + } + } // Check whether the hash table should be extended. table = EnsureCapacity(table, 1, key);