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

Unified Diff: src/runtime/runtime-collections.cc

Issue 1091253002: Fix GC-induced DCHECK failure in Runtime_GetWeakMapEntries (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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/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;
« 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