Changeset 204917 in webkit


Ignore:
Timestamp:
Aug 24, 2016 12:23:47 PM (8 years ago)
Author:
akling@apple.com
Message:

Source/bmalloc:
Add bmalloc::api::isEnabled().
<https://webkit.org/b/160534>

Reviewed by Joseph Pecoraro.

  • bmalloc/bmalloc.h:

(bmalloc::api::isEnabled):

Source/WebCore:
Leaks bot hits an assertion in ResourceUsageThread::platformThreadBody
<https://webkit.org/b/160534>

Reviewed by Joseph Pecoraro.

Use the correct malloc bucket when bmalloc is disabled (which is the case on leaks bots.)

  • page/cocoa/ResourceUsageThreadCocoa.mm:

(WebCore::ResourceUsageThread::platformThreadBody):

Source/WTF:
Add WTF::isFastMallocEnabled().
<https://webkit.org/b/160534>

Reviewed by Joseph Pecoraro.

  • wtf/FastMalloc.cpp:

(WTF::isFastMallocEnabled):

  • wtf/FastMalloc.h:
Location:
trunk/Source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r204916 r204917  
     12016-08-24  Andreas Kling  <akling@apple.com>
     2
     3        Add WTF::isFastMallocEnabled().
     4        <https://webkit.org/b/160534>
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        * wtf/FastMalloc.cpp:
     9        (WTF::isFastMallocEnabled):
     10        * wtf/FastMalloc.h:
     11
    1122016-08-23  Anders Carlsson  <andersca@apple.com>
    213
  • trunk/Source/WTF/wtf/FastMalloc.cpp

    r204912 r204917  
    8282namespace WTF {
    8383
     84bool isFastMallocEnabled()
     85{
     86    return false;
     87}
     88
    8489size_t fastMallocGoodSize(size_t bytes)
    8590{
     
    188193
    189194namespace WTF {
     195
     196bool isFastMallocEnabled()
     197{
     198    return bmalloc::api::isEnabled();
     199}
    190200
    191201void* fastMalloc(size_t size)
  • trunk/Source/WTF/wtf/FastMalloc.h

    r204912 r204917  
    3838    mutable void* m_data;
    3939};
     40
     41WTF_EXPORT_PRIVATE bool isFastMallocEnabled();
    4042
    4143// These functions call CRASH() if an allocation fails.
     
    100102} // namespace WTF
    101103
     104using WTF::isFastMallocEnabled;
    102105using WTF::fastCalloc;
    103106using WTF::fastFree;
  • trunk/Source/WebCore/ChangeLog

    r204912 r204917  
     12016-08-24  Andreas Kling  <akling@apple.com>
     2
     3        Leaks bot hits an assertion in ResourceUsageThread::platformThreadBody
     4        <https://webkit.org/b/160534>
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        Use the correct malloc bucket when bmalloc is disabled (which is the case on leaks bots.)
     9
     10        * page/cocoa/ResourceUsageThreadCocoa.mm:
     11        (WebCore::ResourceUsageThread::platformThreadBody):
     12
    1132016-08-24  Filip Pizlo  <fpizlo@apple.com>
    214
  • trunk/Source/WebCore/page/cocoa/ResourceUsageThreadCocoa.mm

    r202394 r204917  
    228228    data.categories[MemoryCategory::GCOwned].externalSize = currentGCOwnedExternal;
    229229
    230     // Subtract known subchunks from the bmalloc bucket.
    231     // FIXME: Handle running with bmalloc disabled.
    232     size_t currentGCOwnedGenerallyInBmalloc = currentGCOwnedExtra - currentGCOwnedExternal;
    233     ASSERT(currentGCOwnedGenerallyInBmalloc < data.categories[MemoryCategory::bmalloc].dirtySize);
    234     data.categories[MemoryCategory::bmalloc].dirtySize -= currentGCHeapCapacity + currentGCOwnedGenerallyInBmalloc;
     230    // Subtract known subchunks from the appropriate malloc bucket.
     231    size_t currentGCOwnedGenerallyInMalloc = currentGCOwnedExtra - currentGCOwnedExternal;
     232    if (isFastMallocEnabled()) {
     233        RELEASE_ASSERT(currentGCOwnedGenerallyInMalloc < data.categories[MemoryCategory::bmalloc].dirtySize);
     234        data.categories[MemoryCategory::bmalloc].dirtySize -= currentGCHeapCapacity + currentGCOwnedGenerallyInMalloc;
     235    } else {
     236        RELEASE_ASSERT(currentGCOwnedGenerallyInMalloc < data.categories[MemoryCategory::LibcMalloc].dirtySize);
     237        data.categories[MemoryCategory::LibcMalloc].dirtySize -= currentGCHeapCapacity + currentGCOwnedGenerallyInMalloc;
     238    }
    235239
    236240    data.totalExternalSize = currentGCOwnedExternal;
  • trunk/Source/bmalloc/ChangeLog

    r204912 r204917  
     12016-08-24  Andreas Kling  <akling@apple.com>
     2
     3        Add bmalloc::api::isEnabled().
     4        <https://webkit.org/b/160534>
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        * bmalloc/bmalloc.h:
     9        (bmalloc::api::isEnabled):
     10
    1112016-08-24  Filip Pizlo  <fpizlo@apple.com>
    212
  • trunk/Source/bmalloc/bmalloc/bmalloc.h

    r204912 r204917  
    7474}
    7575
     76inline bool isEnabled()
     77{
     78    std::unique_lock<StaticMutex> lock(PerProcess<Heap>::mutex());
     79    return PerProcess<Heap>::getFastCase()->environment().isBmallocEnabled();
     80}
     81
    7682} // namespace api
    7783} // namespace bmalloc
Note: See TracChangeset for help on using the changeset viewer.