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

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

Issue 783673002: Fix %GetWeakSetValues to work correctly with GC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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 e6a86d114a7f8d04828f0c049deaa93bc3c14491..abdd056998e70f5903d887789f9a4ca40b2258a4 100644
--- a/src/runtime/runtime-collections.cc
+++ b/src/runtime/runtime-collections.cc
@@ -394,6 +394,10 @@ RUNTIME_FUNCTION(Runtime_GetWeakSetValues) {
max_values = table->NumberOfElements();
}
Handle<FixedArray> values = isolate->factory()->NewFixedArray(max_values);
+ // Recompute max_values because GC could have removed elements from the table.
+ if (max_values > table->NumberOfElements()) {
+ max_values = 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