Changeset 221126 in webkit


Ignore:
Timestamp:
Aug 23, 2017 7:11:02 PM (7 years ago)
Author:
keith_miller@apple.com
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:
Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r221125 r221126  
     12017-08-23  Keith Miller  <keith_miller@apple.com>
     2
     3        Fix Titzer bench on iOS.
     4        https://bugs.webkit.org/show_bug.cgi?id=175917
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Currently, Titzer bench doesn't run on iOS since the benchmark
     9        allocates lots of physical pages that it never actually writes
     10        to. We limited the total number wasm physical pages to the ram
     11        size of the phone, which caused us to fail a memory
     12        allocation. This patch changes it so we will allocate up to 3x ram
     13        size, which seems to fix the problem.
     14
     15        * wasm/WasmMemory.cpp:
     16
    1172017-08-23  Yusuke Suzuki  <utatane.tea@gmail.com>
    218
  • trunk/Source/JavaScriptCore/wasm/WasmMemory.cpp

    r220401 r221126  
    141141        return false;
    142142    }
    143    
     143
     144    // We allow people to "commit" more wasm memory than there is on the system since most of the time
     145    // people don't actually write to most of that memory. There is some chance that this gets us
     146    // JetSammed but that's possible anyway.
     147    inline size_t memoryLimit() const { return ramSize() * 3; }
     148
    144149    // FIXME: Ideally, bmalloc would have this kind of mechanism. Then, we would just forward to that
    145150    // mechanism here.
     
    148153        MemoryResult::Kind result = [&] {
    149154            auto holder = holdLock(m_lock);
    150             if (m_physicalBytes + bytes > ramSize())
     155            if (m_physicalBytes + bytes > memoryLimit())
    151156                return MemoryResult::SyncGCAndRetry;
    152157           
    153158            m_physicalBytes += bytes;
    154159           
    155             if (m_physicalBytes >= ramSize() / 2)
     160            if (m_physicalBytes >= memoryLimit() / 2)
    156161                return MemoryResult::SuccessAndAsyncGC;
    157162           
     
    178183    void dump(PrintStream& out) const
    179184    {
    180         out.print("memories =  ", m_memories.size(), "/", m_maxCount, ", bytes = ", m_physicalBytes, "/", ramSize());
     185        out.print("virtual memories =  ", m_memories.size(), "/", m_maxCount, ", bytes = ", m_physicalBytes, "/", memoryLimit());
    181186    }
    182187   
Note: See TracChangeset for help on using the changeset viewer.