Title: [221126] trunk/Source/_javascript_Core
Revision
221126
Author
[email protected]
Date
2017-08-23 19:11:02 -0700 (Wed, 23 Aug 2017)

Log Message

Fix Titzer bench on iOS.
https://bugs.webkit.org/show_bug.cgi?id=175917

Reviewed by Ryosuke Niwa.

Currently, Titzer bench doesn't run on iOS since the benchmark
allocates lots of physical pages that it never actually writes
to. We limited the total number wasm physical pages to the ram
size of the phone, which caused us to fail a memory
allocation. This patch changes it so we will allocate up to 3x ram
size, which seems to fix the problem.

* wasm/WasmMemory.cpp:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (221125 => 221126)


--- trunk/Source/_javascript_Core/ChangeLog	2017-08-24 01:07:43 UTC (rev 221125)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-08-24 02:11:02 UTC (rev 221126)
@@ -1,3 +1,19 @@
+2017-08-23  Keith Miller  <[email protected]>
+
+        Fix Titzer bench on iOS.
+        https://bugs.webkit.org/show_bug.cgi?id=175917
+
+        Reviewed by Ryosuke Niwa.
+
+        Currently, Titzer bench doesn't run on iOS since the benchmark
+        allocates lots of physical pages that it never actually writes
+        to. We limited the total number wasm physical pages to the ram
+        size of the phone, which caused us to fail a memory
+        allocation. This patch changes it so we will allocate up to 3x ram
+        size, which seems to fix the problem.
+
+        * wasm/WasmMemory.cpp:
+
 2017-08-23  Yusuke Suzuki  <[email protected]>
 
         Unreviewed, fix for test262

Modified: trunk/Source/_javascript_Core/wasm/WasmMemory.cpp (221125 => 221126)


--- trunk/Source/_javascript_Core/wasm/WasmMemory.cpp	2017-08-24 01:07:43 UTC (rev 221125)
+++ trunk/Source/_javascript_Core/wasm/WasmMemory.cpp	2017-08-24 02:11:02 UTC (rev 221126)
@@ -140,7 +140,12 @@
         }
         return false;
     }
-    
+
+    // We allow people to "commit" more wasm memory than there is on the system since most of the time
+    // people don't actually write to most of that memory. There is some chance that this gets us
+    // JetSammed but that's possible anyway.
+    inline size_t memoryLimit() const { return ramSize() * 3; }
+
     // FIXME: Ideally, bmalloc would have this kind of mechanism. Then, we would just forward to that
     // mechanism here.
     MemoryResult::Kind tryAllocatePhysicalBytes(size_t bytes)
@@ -147,12 +152,12 @@
     {
         MemoryResult::Kind result = [&] {
             auto holder = holdLock(m_lock);
-            if (m_physicalBytes + bytes > ramSize())
+            if (m_physicalBytes + bytes > memoryLimit())
                 return MemoryResult::SyncGCAndRetry;
             
             m_physicalBytes += bytes;
             
-            if (m_physicalBytes >= ramSize() / 2)
+            if (m_physicalBytes >= memoryLimit() / 2)
                 return MemoryResult::SuccessAndAsyncGC;
             
             return MemoryResult::Success;
@@ -177,7 +182,7 @@
     
     void dump(PrintStream& out) const
     {
-        out.print("memories =  ", m_memories.size(), "/", m_maxCount, ", bytes = ", m_physicalBytes, "/", ramSize());
+        out.print("virtual memories =  ", m_memories.size(), "/", m_maxCount, ", bytes = ", m_physicalBytes, "/", memoryLimit());
     }
     
 private:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to