| Index: src/runtime/runtime-collections.cc
 | 
| diff --git a/src/runtime/runtime-collections.cc b/src/runtime/runtime-collections.cc
 | 
| index bacd1c606f9b7046867a5a9f26035d23059f6ec6..e5f3ba1cfb71bd76badc67e2295951537ef2dd39 100644
 | 
| --- a/src/runtime/runtime-collections.cc
 | 
| +++ b/src/runtime/runtime-collections.cc
 | 
| @@ -266,6 +266,11 @@ RUNTIME_FUNCTION(Runtime_GetWeakMapEntries) {
 | 
|    }
 | 
|    Handle<FixedArray> entries =
 | 
|        isolate->factory()->NewFixedArray(max_entries * 2);
 | 
| +  // Allocation can cause GC can delete weak elements. Reload.
 | 
| +  if (max_entries > table->NumberOfElements()) {
 | 
| +    max_entries = table->NumberOfElements();
 | 
| +  }
 | 
| +
 | 
|    {
 | 
|      DisallowHeapAllocation no_gc;
 | 
|      int count = 0;
 | 
| 
 |