Title: [214018] trunk/Source/_javascript_Core
Revision
214018
Author
sbar...@apple.com
Date
2017-03-15 16:17:15 -0700 (Wed, 15 Mar 2017)

Log Message

WebAssembly: When we GC to try to get a fast memory, we should call collectAllGarbage(), not collectSync()
https://bugs.webkit.org/show_bug.cgi?id=169704

Reviewed by Mark Lam.

We weren't always sweeping the memory needed to free
the WasmMemory we wanted to use. collectAllGarbage()
will do this if the JS objects wrapping WasmMemory
are dead.

This patch also moves the increment of the allocatedFastMemories
integer to be thread safe.

* wasm/WasmMemory.cpp:
(JSC::Wasm::tryGetFastMemory):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (214017 => 214018)


--- trunk/Source/_javascript_Core/ChangeLog	2017-03-15 22:56:21 UTC (rev 214017)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-03-15 23:17:15 UTC (rev 214018)
@@ -1,3 +1,21 @@
+2017-03-15  Saam Barati  <sbar...@apple.com>
+
+        WebAssembly: When we GC to try to get a fast memory, we should call collectAllGarbage(), not collectSync()
+        https://bugs.webkit.org/show_bug.cgi?id=169704
+
+        Reviewed by Mark Lam.
+
+        We weren't always sweeping the memory needed to free
+        the WasmMemory we wanted to use. collectAllGarbage()
+        will do this if the JS objects wrapping WasmMemory
+        are dead.
+
+        This patch also moves the increment of the allocatedFastMemories
+        integer to be thread safe.
+
+        * wasm/WasmMemory.cpp:
+        (JSC::Wasm::tryGetFastMemory):
+
 2017-03-15  Mark Lam  <mark....@apple.com>
 
         Fix exception scope verification failures in jsc.cpp.

Modified: trunk/Source/_javascript_Core/wasm/WasmMemory.cpp (214017 => 214018)


--- trunk/Source/_javascript_Core/wasm/WasmMemory.cpp	2017-03-15 22:56:21 UTC (rev 214017)
+++ trunk/Source/_javascript_Core/wasm/WasmMemory.cpp	2017-03-15 23:17:15 UTC (rev 214018)
@@ -119,7 +119,7 @@
     // If we have allocated all the fast memories... too bad.
     if (allocatedFastMemories == maxFastMemories) {
         // There is a reasonable chance that another module has died but has not been collected yet. Don't lose hope yet!
-        vm.heap.collectSync();
+        vm.heap.collectAllGarbage();
         return dequeFastMemory();
     }
 
@@ -126,8 +126,8 @@
     if (mmapBytes(fastMemoryMappedBytes, memory)) {
         mappedCapacity = fastMemoryMappedBytes;
         mode = Memory::Signaling;
+        LockHolder locker(memoryLock);
         allocatedFastMemories++;
-        LockHolder locker(memoryLock);
         auto result = activeFastMemories(locker).add(memory);
         ASSERT_UNUSED(result, result.isNewEntry);
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to