Changeset 233773 in webkit


Ignore:
Timestamp:
Jul 12, 2018, 11:27:26 AM (7 years ago)
Author:
msaboff@apple.com
Message:

Disable IsoHeaps when Gigacage is off
https://bugs.webkit.org/show_bug.cgi?id=187160

Reviewed by Saam Barati.

Relanding change sets 233547 and 233550 with the added fix that Gigacage is also
enabled for DumpRenderTree.

Updated determineMallocFallbackState to base enabling of Iso Heaps on Gigacage
being enabled. We do this because if Gigacage is disabled, it may be due to lack
of address space.

To work around a compiler issue uncovered by the change above, I added explicit
instantiation of PerThread's static variables. Defined the same explicit
instantiated static variables with export scope in the new file PerThread.cpp
to eliminate separate variables allocations in each linked framework / library.

  • CMakeLists.txt:
  • bmalloc.xcodeproj/project.pbxproj:
  • bmalloc/IsoTLS.cpp:

(bmalloc::IsoTLS::determineMallocFallbackState):

  • bmalloc/PerThread.cpp: Added.
  • bmalloc/PerThread.h:
  • bmalloc/ProcessCheck.mm:

(bmalloc::gigacageEnabledForProcess):

Location:
trunk/Source/bmalloc
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/bmalloc/CMakeLists.txt

    r233673 r233773  
    2828    bmalloc/ObjectType.cpp
    2929    bmalloc/PerProcess.cpp
     30    bmalloc/PerThread.cpp
    3031    bmalloc/Scavenger.cpp
    3132    bmalloc/VMHeap.cpp
  • trunk/Source/bmalloc/ChangeLog

    r233673 r233773  
     12019-07-12  Michael Saboff  <msaboff@apple.com>
     2
     3        Disable IsoHeaps when Gigacage is off
     4        https://bugs.webkit.org/show_bug.cgi?id=187160
     5
     6        Reviewed by Saam Barati.
     7
     8        Relanding change sets 233547 and 233550 with the added fix that Gigacage is also
     9        enabled for DumpRenderTree.
     10
     11        Updated determineMallocFallbackState to base enabling of Iso Heaps on Gigacage
     12        being enabled.  We do this because if Gigacage is disabled, it may be due to lack
     13        of address space.
     14
     15        To work around a compiler issue uncovered by the change above, I added explicit
     16        instantiation of PerThread's static variables.  Defined the same explicit
     17        instantiated static variables with export scope in the new file PerThread.cpp
     18        to eliminate separate variables allocations in each linked framework / library.
     19
     20        * CMakeLists.txt:
     21        * bmalloc.xcodeproj/project.pbxproj:
     22        * bmalloc/IsoTLS.cpp:
     23        (bmalloc::IsoTLS::determineMallocFallbackState):
     24        * bmalloc/PerThread.cpp: Added.
     25        * bmalloc/PerThread.h:
     26        * bmalloc/ProcessCheck.mm:
     27        (bmalloc::gigacageEnabledForProcess):
     28
    1292018-07-09  Commit Queue  <commit-queue@webkit.org>
    230
  • trunk/Source/bmalloc/bmalloc.xcodeproj/project.pbxproj

    r233673 r233773  
    132132                4426E2811C838EE0008EB042 /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 4426E27F1C838EE0008EB042 /* Logging.h */; settings = {ATTRIBUTES = (Private, ); }; };
    133133                4426E2831C839547008EB042 /* BSoftLinking.h in Headers */ = {isa = PBXBuildFile; fileRef = 4426E2821C839547008EB042 /* BSoftLinking.h */; };
     134                6543DDB420EEAEF3003B23D8 /* PerThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6543DDB320EEAEF3003B23D8 /* PerThread.cpp */; };
    134135                6599C5CC1EC3F15900A2F7BB /* AvailableMemory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6599C5CA1EC3F15900A2F7BB /* AvailableMemory.cpp */; };
    135136                6599C5CD1EC3F15900A2F7BB /* AvailableMemory.h in Headers */ = {isa = PBXBuildFile; fileRef = 6599C5CB1EC3F15900A2F7BB /* AvailableMemory.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    293294                4426E27F1C838EE0008EB042 /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = bmalloc/Logging.h; sourceTree = "<group>"; };
    294295                4426E2821C839547008EB042 /* BSoftLinking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BSoftLinking.h; path = bmalloc/darwin/BSoftLinking.h; sourceTree = "<group>"; };
     296                6543DDB320EEAEF3003B23D8 /* PerThread.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = PerThread.cpp; path = bmalloc/PerThread.cpp; sourceTree = "<group>"; };
    295297                6599C5CA1EC3F15900A2F7BB /* AvailableMemory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AvailableMemory.cpp; path = bmalloc/AvailableMemory.cpp; sourceTree = "<group>"; };
    296298                6599C5CB1EC3F15900A2F7BB /* AvailableMemory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AvailableMemory.h; path = bmalloc/AvailableMemory.h; sourceTree = "<group>"; };
     
    537539                                14446A0717A61FA400F9EA1D /* PerProcess.h */,
    538540                                144469FD17A61F1F00F9EA1D /* PerThread.h */,
     541                                6543DDB320EEAEF3003B23D8 /* PerThread.cpp */,
    539542                                145F6878179E3A4400D65598 /* Range.h */,
    540543                                148EFAE61D6B953B008E721E /* ScopeExit.h */,
     
    785788                                14F271C718EA3990008C152F /* Heap.cpp in Sources */,
    786789                                0FD557331F7EDB7B00B1F0A3 /* HeapKind.cpp in Sources */,
     790                                6543DDB420EEAEF3003B23D8 /* PerThread.cpp in Sources */,
    787791                                0F7EB83B1F9541B000F1ABCB /* IsoHeapImpl.cpp in Sources */,
    788792                                0F5549EF1FB54704007FF75A /* IsoPage.cpp in Sources */,
  • trunk/Source/bmalloc/bmalloc/IsoTLS.cpp

    r233673 r233773  
    2828#include "DebugHeap.h"
    2929#include "Environment.h"
     30#include "Gigacage.h"
    3031#include "IsoTLSEntryInlines.h"
    3132#include "IsoTLSInlines.h"
     
    202203            if (s_mallocFallbackState != MallocFallbackState::Undecided)
    203204                return;
    204            
     205
     206#if GIGACAGE_ENABLED
     207            if (!Gigacage::shouldBeEnabled()) {
     208                s_mallocFallbackState = MallocFallbackState::FallBackToMalloc;
     209                return;
     210            }
    205211            const char* env = getenv("bmalloc_IsoHeap");
    206212            if (env && (!strcasecmp(env, "false") || !strcasecmp(env, "no") || !strcmp(env, "0")))
     
    208214            else
    209215                s_mallocFallbackState = MallocFallbackState::DoNotFallBack;
     216#else
     217            s_mallocFallbackState = MallocFallbackState::FallBackToMalloc;
     218#endif
    210219        });
    211220}
  • trunk/Source/bmalloc/bmalloc/PerThread.h

    r233673 r233773  
    11/*
    2  * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    109109};
    110110
    111 template<typename T> bool PerThreadStorage<T>::s_didInitialize;
    112 template<typename T> pthread_key_t PerThreadStorage<T>::s_key;
    113 template<typename T> std::once_flag PerThreadStorage<T>::s_onceFlag;
     111class Cache;
     112class Heap;
     113
     114template<> bool PerThreadStorage<PerHeapKind<Cache>>::s_didInitialize;
     115template<> pthread_key_t PerThreadStorage<PerHeapKind<Cache>>::s_key;
     116template<> std::once_flag PerThreadStorage<PerHeapKind<Cache>>::s_onceFlag;
     117
     118template<> bool PerThreadStorage<PerHeapKind<Heap>>::s_didInitialize;
     119template<> pthread_key_t PerThreadStorage<PerHeapKind<Heap>>::s_key;
     120template<> std::once_flag PerThreadStorage<PerHeapKind<Heap>>::s_onceFlag;
    114121
    115122#endif
  • trunk/Source/bmalloc/bmalloc/ProcessCheck.mm

    r233216 r233773  
    4747    NSString *processName = [[NSProcessInfo processInfo] processName];
    4848    bool isOptInBinary = [processName isEqualToString:@"jsc"]
     49        || [processName isEqualToString:@"DumpRenderTree"]
    4950        || [processName isEqualToString:@"wasm"]
    5051        || [processName hasPrefix:@"test"];
Note: See TracChangeset for help on using the changeset viewer.