From a9f692eca8fb2420668da316870ce7d262fa2078 Mon Sep 17 00:00:00 2001 From: ulan Date: Fri, 5 Dec 2014 05:26:55 -0800 Subject: [PATCH] Fix %GetWeakSetValues to work correctly with GC. This fixes mjsunit/es6/mirror-collections failure in arm64 gc-stress bot. BUG= Review URL: https://codereview.chromium.org/783673002 Cr-Commit-Position: refs/heads/master@{#25687} --- src/runtime/runtime-collections.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/runtime/runtime-collections.cc b/src/runtime/runtime-collections.cc index e6a86d1..abdd056 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 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; -- 2.7.4