Changeset 220470 in webkit


Ignore:
Timestamp:
Aug 9, 2017 11:24:25 AM (7 years ago)
Author:
jmarcell@apple.com
Message:

Cherry-pick r220346. rdar://problem/33805219

Location:
branches/safari-604.1.38.1-branch/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-604.1.38.1-branch/Source/JavaScriptCore/ChangeLog

    r220172 r220470  
     12017-08-09  Jason Marcell  <jmarcell@apple.com>
     2
     3        Cherry-pick r220346. rdar://problem/33805219
     4
     5    2017-08-07  Commit Queue  <commit-queue@webkit.org>
     6
     7            Unreviewed, rolling out r220144.
     8            https://bugs.webkit.org/show_bug.cgi?id=175276
     9
     10            "It did not actually speed things up in the way I expected"
     11            (Requested by saamyjoon on #webkit).
     12
     13            Reverted changeset:
     14
     15            "On memory-constrained iOS devices, reduce the rate at which
     16            the JS heap grows before a GC to try to keep more memory
     17            available for the system"
     18            https://bugs.webkit.org/show_bug.cgi?id=175041
     19            http://trac.webkit.org/changeset/220144
     20
    1212017-08-02  Jason Marcell  <jmarcell@apple.com>
    222
  • branches/safari-604.1.38.1-branch/Source/JavaScriptCore/heap/Heap.cpp

    r220172 r220470  
    7272#if PLATFORM(IOS)
    7373#include <bmalloc/bmalloc.h>
    74 #include <sys/sysctl.h>
    7574#endif
    7675#include <wtf/CurrentTime.h>
     
    117116}
    118117
     118size_t proportionalHeapSize(size_t heapSize, size_t ramSize)
     119{
    119120#if PLATFORM(IOS)
    120 static bool useAggressiveGCTrigger()
    121 {
    122     static bool useAggressiveGCTrigger;
    123     static std::once_flag once;
    124     std::call_once(once, [] {
    125         useAggressiveGCTrigger = false;
    126 
    127         if (Options::forceAggressiveGCTrigger()) {
    128             useAggressiveGCTrigger = true;
    129             return;
    130         }
    131 
    132         uint64_t memSizeInBytes;
    133         size_t sizeofMemSize = sizeof(memSizeInBytes);
    134         if (sysctlbyname("hw.memsize", &memSizeInBytes, &sizeofMemSize, nullptr, 0))
    135             return;
    136         useAggressiveGCTrigger = memSizeInBytes <= 1 * GB;
    137     });
    138 
    139     return useAggressiveGCTrigger;
    140 }
    141 #endif
    142 
    143 size_t proportionalHeapSize(size_t heapSize, size_t ramSize)
    144 {
    145 #if PLATFORM(IOS)
    146     if (useAggressiveGCTrigger()) {
    147         double memoryUsed = bmalloc::api::percentAvailableMemoryInUse();
    148         double result = ((1 - memoryUsed) / Options::aggressiveGCTriggerScalingValue()) + 1;
    149         return heapSize * std::max(std::min(result, Options::aggressiveGCTriggerMaxMultiplier()), Options::aggressiveGCTriggerMinMultiplier());
    150     }
    151 
    152121    size_t memoryFootprint = bmalloc::api::memoryFootprint();
    153122    if (memoryFootprint < ramSize * Options::smallHeapRAMFraction())
  • branches/safari-604.1.38.1-branch/Source/JavaScriptCore/runtime/Options.h

    r220172 r220470  
    211211    v(double, mediumHeapGrowthFactor, 1.5, Normal, nullptr) \
    212212    v(double, largeHeapGrowthFactor, 1.24, Normal, nullptr) \
    213     v(bool, forceAggressiveGCTrigger, false, Normal, "If true, on iOS, we will use a different formula for proportionalHeapSize().") \
    214     v(double, aggressiveGCTriggerMinMultiplier, 1.07, Normal, "This is the minimum we must grow by for proportionalHeapSize() when doing aggressive triggering.") \
    215     v(double, aggressiveGCTriggerMaxMultiplier, 2.0, Normal,  "This is the maximum we can grow by for proportionalHeapSize() when doing aggressive triggering.") \
    216     v(double, aggressiveGCTriggerScalingValue, 3.5, Normal, "This scales the above formula. A larger number is more aggressive in limiting heap growth. A smaller number is more permissive in allowing heap growth.") \
    217213    v(double, criticalGCMemoryThreshold, 0.80, Normal, "percent memory in use the GC considers critical.  The collector is much more aggressive above this threshold") \
    218214    v(double, minimumMutatorUtilization, 0, Normal, nullptr) \
Note: See TracChangeset for help on using the changeset viewer.