Changeset 286572 in webkit


Ignore:
Timestamp:
Dec 6, 2021, 2:50:39 PM (3 years ago)
Author:
mark.lam@apple.com
Message:

Remove unneeded virtual allocator methods from Subspace.
https://bugs.webkit.org/show_bug.cgi?id=233891
rdar://86117970

Reviewed by Yusuke Suzuki.

Since the virtual allocate() and allocateFor() methods are now deleted, we can
also rename the inline allocateNonVirtual() and allocatorForNonVirtual() methods
to simply allocate() and allocateFor(). Similarly, rename
allocatorForNonVirtualConcurrently() to allocatorForConcurrently().

There are 2 places that still invokes the non-inline version of
CompleteSubspace::allocatorFor(). For this reason, we introduce a
CompleteSubsace::allocatorForNonInline() to keep the linkage the same. There's a
chance that the compiler/linker may already inline the method in 1 or both of
these places, but we'll offer allocatorForNonInline() to keep the code expressing
the same thing and let the compiler/linker decide whether to inline it or not just
as before.

This is purely a re-factoring patch. There are no behavior changes, except for
the removal of those 2 entries from the vtbls.

  • bytecode/AccessCase.cpp:

(JSC::AccessCase::generateImpl):

  • bytecode/ObjectAllocationProfileInlines.h:

(JSC::ObjectAllocationProfileBase<Derived>::initializeProfile):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::emitAllocateRawObject):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileMakeRope):
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):

  • heap/CompleteSubspace.cpp:

(JSC::CompleteSubspace::allocatorForNonInline):
(JSC::CompleteSubspace::tryAllocateSlow):
(JSC::CompleteSubspace::allocatorFor): Deleted.
(JSC::CompleteSubspace::allocate): Deleted.

  • heap/CompleteSubspace.h:

(JSC::CompleteSubspace::allocatorFor):
(JSC::CompleteSubspace::allocatorForNonVirtual): Deleted.

  • heap/CompleteSubspaceInlines.h:

(JSC::CompleteSubspace::allocate):
(JSC::CompleteSubspace::allocateNonVirtual): Deleted.

  • heap/IsoSubspace.cpp:

(JSC::IsoSubspace::allocatorFor): Deleted.
(JSC::IsoSubspace::allocate): Deleted.

  • heap/IsoSubspace.h:

(JSC::IsoSubspace::allocatorFor):
(JSC::IsoSubspace::allocatorForNonVirtual): Deleted.

  • heap/IsoSubspaceInlines.h:

(JSC::IsoSubspace::allocate):
(JSC::IsoSubspace::allocateNonVirtual): Deleted.

  • heap/Subspace.h:
  • jit/AssemblyHelpers.h:

(JSC::AssemblyHelpers::emitAllocateJSObjectWithKnownSize):

  • runtime/ButterflyInlines.h:

(JSC::Butterfly::tryCreateUninitialized):
(JSC::Butterfly::createUninitialized):
(JSC::Butterfly::tryCreate):
(JSC::Butterfly::growArrayRight):
(JSC::Butterfly::reallocArrayRightIfPossible):

  • runtime/DirectArguments.cpp:

(JSC::DirectArguments::overrideThings):

  • runtime/GenericArgumentsInlines.h:

(JSC::GenericArguments<Type>::initModifiedArgumentsDescriptor):

  • runtime/HashMapImpl.h:

(JSC::HashMapBuffer::create):

  • runtime/JSArray.cpp:

(JSC::JSArray::tryCreateUninitializedRestricted):

  • runtime/JSArray.h:

(JSC::JSArray::tryCreate):

  • runtime/JSArrayBufferView.cpp:

(JSC::JSArrayBufferView::ConstructionContext::ConstructionContext):

  • runtime/JSBigInt.cpp:

(JSC::JSBigInt::createWithLength):

  • runtime/JSCellInlines.h:

(JSC::allocatorForConcurrently):
(JSC::tryAllocateCellHelper):
(JSC::allocatorForNonVirtualConcurrently): Deleted.

  • runtime/JSPropertyNameEnumerator.cpp:

(JSC::JSPropertyNameEnumerator::create):

  • runtime/ScopedArguments.cpp:

(JSC::ScopedArguments::createUninitialized):

  • runtime/StructureChain.cpp:

(JSC::StructureChain::create):

Location:
trunk/Source/JavaScriptCore
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r286558 r286572  
     12021-12-06  Mark Lam  <mark.lam@apple.com>
     2
     3        Remove unneeded virtual allocator methods from Subspace.
     4        https://bugs.webkit.org/show_bug.cgi?id=233891
     5        rdar://86117970
     6
     7        Reviewed by Yusuke Suzuki.
     8
     9        Since the virtual allocate() and allocateFor() methods are now deleted, we can
     10        also rename the inline allocateNonVirtual() and allocatorForNonVirtual() methods
     11        to simply allocate() and allocateFor().  Similarly, rename
     12        allocatorForNonVirtualConcurrently() to allocatorForConcurrently().
     13
     14        There are 2 places that still invokes the non-inline version of
     15        CompleteSubspace::allocatorFor().  For this reason, we introduce a
     16        CompleteSubsace::allocatorForNonInline() to keep the linkage the same.  There's a
     17        chance that the compiler/linker may already inline the method in 1 or both of
     18        these places, but we'll offer allocatorForNonInline() to keep the code expressing
     19        the same thing and let the compiler/linker decide whether to inline it or not just
     20        as before.
     21
     22        This is purely a re-factoring patch.  There are no behavior changes, except for
     23        the removal of those 2 entries from the vtbls.
     24
     25        * bytecode/AccessCase.cpp:
     26        (JSC::AccessCase::generateImpl):
     27        * bytecode/ObjectAllocationProfileInlines.h:
     28        (JSC::ObjectAllocationProfileBase<Derived>::initializeProfile):
     29        * dfg/DFGSpeculativeJIT.cpp:
     30        (JSC::DFG::SpeculativeJIT::emitAllocateRawObject):
     31        * ftl/FTLLowerDFGToB3.cpp:
     32        (JSC::FTL::DFG::LowerDFGToB3::compileMakeRope):
     33        (JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
     34        * heap/CompleteSubspace.cpp:
     35        (JSC::CompleteSubspace::allocatorForNonInline):
     36        (JSC::CompleteSubspace::tryAllocateSlow):
     37        (JSC::CompleteSubspace::allocatorFor): Deleted.
     38        (JSC::CompleteSubspace::allocate): Deleted.
     39        * heap/CompleteSubspace.h:
     40        (JSC::CompleteSubspace::allocatorFor):
     41        (JSC::CompleteSubspace::allocatorForNonVirtual): Deleted.
     42        * heap/CompleteSubspaceInlines.h:
     43        (JSC::CompleteSubspace::allocate):
     44        (JSC::CompleteSubspace::allocateNonVirtual): Deleted.
     45        * heap/IsoSubspace.cpp:
     46        (JSC::IsoSubspace::allocatorFor): Deleted.
     47        (JSC::IsoSubspace::allocate): Deleted.
     48        * heap/IsoSubspace.h:
     49        (JSC::IsoSubspace::allocatorFor):
     50        (JSC::IsoSubspace::allocatorForNonVirtual): Deleted.
     51        * heap/IsoSubspaceInlines.h:
     52        (JSC::IsoSubspace::allocate):
     53        (JSC::IsoSubspace::allocateNonVirtual): Deleted.
     54        * heap/Subspace.h:
     55        * jit/AssemblyHelpers.h:
     56        (JSC::AssemblyHelpers::emitAllocateJSObjectWithKnownSize):
     57        * runtime/ButterflyInlines.h:
     58        (JSC::Butterfly::tryCreateUninitialized):
     59        (JSC::Butterfly::createUninitialized):
     60        (JSC::Butterfly::tryCreate):
     61        (JSC::Butterfly::growArrayRight):
     62        (JSC::Butterfly::reallocArrayRightIfPossible):
     63        * runtime/DirectArguments.cpp:
     64        (JSC::DirectArguments::overrideThings):
     65        * runtime/GenericArgumentsInlines.h:
     66        (JSC::GenericArguments<Type>::initModifiedArgumentsDescriptor):
     67        * runtime/HashMapImpl.h:
     68        (JSC::HashMapBuffer::create):
     69        * runtime/JSArray.cpp:
     70        (JSC::JSArray::tryCreateUninitializedRestricted):
     71        * runtime/JSArray.h:
     72        (JSC::JSArray::tryCreate):
     73        * runtime/JSArrayBufferView.cpp:
     74        (JSC::JSArrayBufferView::ConstructionContext::ConstructionContext):
     75        * runtime/JSBigInt.cpp:
     76        (JSC::JSBigInt::createWithLength):
     77        * runtime/JSCellInlines.h:
     78        (JSC::allocatorForConcurrently):
     79        (JSC::tryAllocateCellHelper):
     80        (JSC::allocatorForNonVirtualConcurrently): Deleted.
     81        * runtime/JSPropertyNameEnumerator.cpp:
     82        (JSC::JSPropertyNameEnumerator::create):
     83        * runtime/ScopedArguments.cpp:
     84        (JSC::ScopedArguments::createUninitialized):
     85        * runtime/StructureChain.cpp:
     86        (JSC::StructureChain::create):
     87
    1882021-12-06  Patrick Angle  <pangle@apple.com>
    289
  • trunk/Source/JavaScriptCore/bytecode/AccessCase.cpp

    r286347 r286572  
    22782278
    22792279            if (allocatingInline) {
    2280                 Allocator allocator = vm.jsValueGigacageAuxiliarySpace().allocatorFor(newSize, AllocatorForMode::AllocatorIfExists);
     2280                Allocator allocator = vm.jsValueGigacageAuxiliarySpace().allocatorForNonInline(newSize, AllocatorForMode::AllocatorIfExists);
    22812281
    22822282                jit.emitAllocate(scratchGPR, JITAllocator::constant(allocator), scratchGPR2, scratchGPR3, slowPath);
  • trunk/Source/JavaScriptCore/bytecode/ObjectAllocationProfileInlines.h

    r271269 r286572  
    11/*
    2  * Copyright (C) 2017-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    100100
    101101    size_t allocationSize = JSFinalObject::allocationSize(inlineCapacity);
    102     Allocator allocator = subspaceFor<JSFinalObject>(vm)->allocatorForNonVirtual(allocationSize, AllocatorForMode::EnsureAllocator);
     102    Allocator allocator = subspaceFor<JSFinalObject>(vm)->allocatorFor(allocationSize, AllocatorForMode::EnsureAllocator);
    103103
    104104    // Take advantage of extra inline capacity available in the size class.
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r286347 r286572  
    121121    VM& vm = this->vm();
    122122    if (size) {
    123         if (Allocator allocator = vm.jsValueGigacageAuxiliarySpace().allocatorForNonVirtual(size, AllocatorForMode::AllocatorIfExists)) {
     123        if (Allocator allocator = vm.jsValueGigacageAuxiliarySpace().allocatorFor(size, AllocatorForMode::AllocatorIfExists)) {
    124124            m_jit.emitAllocate(storageGPR, JITAllocator::constant(allocator), scratchGPR, scratch2GPR, slowCases);
    125125           
     
    136136    Allocator allocator;
    137137    if (structure->typeInfo().type() == JSType::ArrayType)
    138         allocator = allocatorForNonVirtualConcurrently<JSArray>(vm, JSArray::allocationSize(inlineCapacity), AllocatorForMode::AllocatorIfExists);
     138        allocator = allocatorForConcurrently<JSArray>(vm, JSArray::allocationSize(inlineCapacity), AllocatorForMode::AllocatorIfExists);
    139139    else
    140         allocator = allocatorForNonVirtualConcurrently<JSFinalObject>(vm, JSFinalObject::allocationSize(inlineCapacity), AllocatorForMode::AllocatorIfExists);
     140        allocator = allocatorForConcurrently<JSFinalObject>(vm, JSFinalObject::allocationSize(inlineCapacity), AllocatorForMode::AllocatorIfExists);
    141141    if (allocator) {
    142142        emitAllocateJSObject(resultGPR, JITAllocator::constant(allocator), scratchGPR, TrustedImmPtr(structure), storageGPR, scratch2GPR, slowCases);
     
    1073810738    size_t size = initialOutOfLineCapacity * sizeof(JSValue);
    1073910739
    10740     Allocator allocator = vm().jsValueGigacageAuxiliarySpace().allocatorForNonVirtual(size, AllocatorForMode::AllocatorIfExists);
     10740    Allocator allocator = vm().jsValueGigacageAuxiliarySpace().allocatorFor(size, AllocatorForMode::AllocatorIfExists);
    1074110741
    1074210742    if (!allocator || node->transition()->previous->couldHaveIndexingHeader()) {
     
    1078210782    ASSERT(newSize == node->transition()->next->outOfLineCapacity() * sizeof(JSValue));
    1078310783   
    10784     Allocator allocator = vm().jsValueGigacageAuxiliarySpace().allocatorForNonVirtual(newSize, AllocatorForMode::AllocatorIfExists);
     10784    Allocator allocator = vm().jsValueGigacageAuxiliarySpace().allocatorFor(newSize, AllocatorForMode::AllocatorIfExists);
    1078510785
    1078610786    if (!allocator || node->transition()->previous->couldHaveIndexingHeader()) {
     
    1491214912    RegisteredStructure structure = node->structure();
    1491314913    size_t allocationSize = JSFinalObject::allocationSize(structure->inlineCapacity());
    14914     Allocator allocatorValue = allocatorForNonVirtualConcurrently<JSFinalObject>(vm(), allocationSize, AllocatorForMode::AllocatorIfExists);
     14914    Allocator allocatorValue = allocatorForConcurrently<JSFinalObject>(vm(), allocationSize, AllocatorForMode::AllocatorIfExists);
    1491514915    if (!allocatorValue)
    1491614916        slowPath.append(m_jit.jump());
     
    1600416004
    1600516005    CCallHelpers::JumpList slowPath;
    16006     Allocator allocatorValue = allocatorForNonVirtualConcurrently<JSRopeString>(vm(), sizeof(JSRopeString), AllocatorForMode::AllocatorIfExists);
     16006    Allocator allocatorValue = allocatorForConcurrently<JSRopeString>(vm(), sizeof(JSRopeString), AllocatorForMode::AllocatorIfExists);
    1600716007    emitAllocateJSCell(resultGPR, JITAllocator::constant(allocatorValue), allocatorGPR, TrustedImmPtr(m_jit.graph().registerStructure(vm().stringStructure.get())), scratchGPR, slowPath);
    1600816008
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r286502 r286572  
    87488748        LBasicBlock continuation = m_out.newBlock();
    87498749       
    8750         Allocator allocator = allocatorForNonVirtualConcurrently<JSRopeString>(vm(), sizeof(JSRopeString), AllocatorForMode::AllocatorIfExists);
     8750        Allocator allocator = allocatorForConcurrently<JSRopeString>(vm(), sizeof(JSRopeString), AllocatorForMode::AllocatorIfExists);
    87518751       
    87528752        LValue result = allocateCell(
     
    1388213882                Allocator cellAllocator;
    1388313883                if (structure->typeInfo().type() == JSType::ArrayType)
    13884                     cellAllocator = allocatorForNonVirtualConcurrently<JSArray>(vm(), JSArray::allocationSize(structure->inlineCapacity()), AllocatorForMode::AllocatorIfExists);
     13884                    cellAllocator = allocatorForConcurrently<JSArray>(vm(), JSArray::allocationSize(structure->inlineCapacity()), AllocatorForMode::AllocatorIfExists);
    1388513885                else
    13886                     cellAllocator = allocatorForNonVirtualConcurrently<JSFinalObject>(vm(), JSFinalObject::allocationSize(structure->inlineCapacity()), AllocatorForMode::AllocatorIfExists);
     13886                    cellAllocator = allocatorForConcurrently<JSFinalObject>(vm(), JSFinalObject::allocationSize(structure->inlineCapacity()), AllocatorForMode::AllocatorIfExists);
    1388713887
    1388813888                bool hasIndexingHeader = hasIndexedProperties(structure->indexingType());
     
    1501815018
    1501915019        size_t sizeInBytes = sizeInValues * sizeof(JSValue);
    15020         Allocator allocator = vm().jsValueGigacageAuxiliarySpace().allocatorForNonVirtual(sizeInBytes, AllocatorForMode::AllocatorIfExists);
     15020        Allocator allocator = vm().jsValueGigacageAuxiliarySpace().allocatorFor(sizeInBytes, AllocatorForMode::AllocatorIfExists);
    1502115021        LValue startOfStorage = allocateHeapCell(
    1502215022            m_out.constIntPtr(allocator.localAllocator()), slowPath);
     
    1685316853        size_t size, StructureType structure, LValue butterfly, LBasicBlock slowPath)
    1685416854    {
    16855         Allocator allocator = allocatorForNonVirtualConcurrently<ClassType>(vm(), size, AllocatorForMode::AllocatorIfExists);
     16855        Allocator allocator = allocatorForConcurrently<ClassType>(vm(), size, AllocatorForMode::AllocatorIfExists);
    1685616856        return allocateObject(
    1685716857            m_out.constIntPtr(allocator.localAllocator()), structure, butterfly, slowPath);
     
    1687416874            size_t actualSize = size->asIntPtr();
    1687516875
    16876             Allocator actualAllocator = actualSubspace->allocatorForNonVirtual(actualSize, AllocatorForMode::AllocatorIfExists);
     16876            Allocator actualAllocator = actualSubspace->allocatorFor(actualSize, AllocatorForMode::AllocatorIfExists);
    1687716877            if (!actualAllocator) {
    1687816878                LBasicBlock continuation = m_out.newBlock();
     
    1693616936    {
    1693716937        size_t allocationSize = JSFinalObject::allocationSize(structure.get()->inlineCapacity());
    16938         Allocator allocator = allocatorForNonVirtualConcurrently<JSFinalObject>(vm(), allocationSize, AllocatorForMode::AllocatorIfExists);
     16938        Allocator allocator = allocatorForConcurrently<JSFinalObject>(vm(), allocationSize, AllocatorForMode::AllocatorIfExists);
    1693916939       
    1694016940        // FIXME: If the allocator is null, we could simply emit a normal C call to the allocator
  • trunk/Source/JavaScriptCore/heap/CompleteSubspace.cpp

    r286042 r286572  
    4646}
    4747
    48 Allocator CompleteSubspace::allocatorFor(size_t size, AllocatorForMode mode)
    49 {
    50     return allocatorForNonVirtual(size, mode);
    51 }
    52 
    53 void* CompleteSubspace::allocate(VM& vm, size_t size, GCDeferralContext* deferralContext, AllocationFailureMode failureMode)
    54 {
    55     return allocateNonVirtual(vm, size, deferralContext, failureMode);
     48Allocator CompleteSubspace::allocatorForNonInline(size_t size, AllocatorForMode mode)
     49{
     50    return allocatorFor(size, mode);
    5651}
    5752
     
    124119
    125120    sanitizeStackForVM(vm);
    126    
    127     if (Allocator allocator = allocatorFor(size, AllocatorForMode::EnsureAllocator))
     121
     122    if (Allocator allocator = allocatorForNonInline(size, AllocatorForMode::EnsureAllocator))
    128123        return allocator.allocate(vm.heap, deferralContext, AllocationFailureMode::ReturnNull);
    129124   
  • trunk/Source/JavaScriptCore/heap/CompleteSubspace.h

    r286042 r286572  
    4040    // FIXME: Currently subspaces speak of BlockDirectories as "allocators", but that's temporary.
    4141    // https://bugs.webkit.org/show_bug.cgi?id=181559
    42     Allocator allocatorFor(size_t, AllocatorForMode) final;
    43     Allocator allocatorForNonVirtual(size_t, AllocatorForMode);
    44    
    45     void* allocate(VM&, size_t, GCDeferralContext*, AllocationFailureMode) final;
    46     void* allocateNonVirtual(VM&, size_t, GCDeferralContext*, AllocationFailureMode);
     42    Allocator allocatorFor(size_t, AllocatorForMode);
     43    Allocator allocatorForNonInline(size_t, AllocatorForMode);
     44
     45    void* allocate(VM&, size_t, GCDeferralContext*, AllocationFailureMode);
    4746    void* reallocatePreciseAllocationNonVirtual(VM&, HeapCell*, size_t, GCDeferralContext*, AllocationFailureMode);
    4847   
     
    6362};
    6463
    65 ALWAYS_INLINE Allocator CompleteSubspace::allocatorForNonVirtual(size_t size, AllocatorForMode mode)
     64ALWAYS_INLINE Allocator CompleteSubspace::allocatorFor(size_t size, AllocatorForMode mode)
    6665{
    6766    if (size <= MarkedSpace::largeCutoff) {
  • trunk/Source/JavaScriptCore/heap/CompleteSubspaceInlines.h

    r285636 r286572  
    3131namespace JSC {
    3232
    33 ALWAYS_INLINE void* CompleteSubspace::allocateNonVirtual(VM& vm, size_t size, GCDeferralContext* deferralContext, AllocationFailureMode failureMode)
     33ALWAYS_INLINE void* CompleteSubspace::allocate(VM& vm, size_t size, GCDeferralContext* deferralContext, AllocationFailureMode failureMode)
    3434{
    3535    if constexpr (validateDFGDoesGC)
    3636        vm.verifyCanGC();
    3737
    38     if (Allocator allocator = allocatorForNonVirtual(size, AllocatorForMode::AllocatorIfExists))
     38    if (Allocator allocator = allocatorFor(size, AllocatorForMode::AllocatorIfExists))
    3939        return allocator.allocate(vm.heap, deferralContext, failureMode);
    4040    return allocateSlow(vm, size, deferralContext, failureMode);
  • trunk/Source/JavaScriptCore/heap/IsoSubspace.cpp

    r286391 r286572  
    5555IsoSubspace::~IsoSubspace()
    5656{
    57 }
    58 
    59 Allocator IsoSubspace::allocatorFor(size_t size, AllocatorForMode mode)
    60 {
    61     return allocatorForNonVirtual(size, mode);
    62 }
    63 
    64 void* IsoSubspace::allocate(VM& vm, size_t size, GCDeferralContext* deferralContext, AllocationFailureMode failureMode)
    65 {
    66     return allocateNonVirtual(vm, size, deferralContext, failureMode);
    6757}
    6858
  • trunk/Source/JavaScriptCore/heap/IsoSubspace.h

    r286345 r286572  
    4343    size_t cellSize() { return m_directory.cellSize(); }
    4444
    45     Allocator allocatorFor(size_t, AllocatorForMode) override;
    46     Allocator allocatorForNonVirtual(size_t, AllocatorForMode);
     45    Allocator allocatorFor(size_t, AllocatorForMode);
    4746
    48     void* allocate(VM&, size_t, GCDeferralContext*, AllocationFailureMode) override;
    49     void* allocateNonVirtual(VM&, size_t, GCDeferralContext*, AllocationFailureMode);
     47    void* allocate(VM&, size_t, GCDeferralContext*, AllocationFailureMode);
    5048
    5149    void sweepLowerTierCell(PreciseAllocation*);
     
    7371};
    7472
    75 ALWAYS_INLINE Allocator IsoSubspace::allocatorForNonVirtual(size_t size, AllocatorForMode)
     73ALWAYS_INLINE Allocator IsoSubspace::allocatorFor(size_t size, AllocatorForMode)
    7674{
    7775    RELEASE_ASSERT(WTF::roundUpToMultipleOf<MarkedBlock::atomSize>(size) == cellSize());
  • trunk/Source/JavaScriptCore/heap/IsoSubspaceInlines.h

    r258479 r286572  
    11/*
    2  * Copyright (C) 2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2828namespace JSC {
    2929
    30 ALWAYS_INLINE void* IsoSubspace::allocateNonVirtual(VM& vm, size_t size, GCDeferralContext* deferralContext, AllocationFailureMode failureMode)
     30ALWAYS_INLINE void* IsoSubspace::allocate(VM& vm, size_t size, GCDeferralContext* deferralContext, AllocationFailureMode failureMode)
    3131{
    3232    RELEASE_ASSERT(WTF::roundUpToMultipleOf<MarkedBlock::atomSize>(size) == cellSize());
    33     Allocator allocator = allocatorForNonVirtual(size, AllocatorForMode::MustAlreadyHaveAllocator);
     33    Allocator allocator = allocatorFor(size, AllocatorForMode::MustAlreadyHaveAllocator);
    3434    void* result = allocator.allocate(vm.heap, deferralContext, failureMode);
    3535    return result;
  • trunk/Source/JavaScriptCore/heap/Subspace.h

    r286042 r286572  
    5757    void destroy(VM&, JSCell*);
    5858
    59     virtual Allocator allocatorFor(size_t, AllocatorForMode) = 0;
    60     virtual void* allocate(VM&, size_t, GCDeferralContext*, AllocationFailureMode) = 0;
    61    
    6259    void prepareForAllocation();
    6360   
     
    116113    BlockDirectory* m_directoryForEmptyAllocation { nullptr }; // Uses the MarkedSpace linked list of blocks.
    117114    SentinelLinkedList<PreciseAllocation, PackedRawSentinelNode<PreciseAllocation>> m_preciseAllocations;
     115
     116    bool m_isIsoSubspace { false };
     117    uint8_t m_remainingLowerTierCellCount { 0 };
     118
    118119    Subspace* m_nextSubspaceInAlignedMemoryAllocator { nullptr };
    119120
    120121    CString m_name;
    121 
    122     bool m_isIsoSubspace { false };
    123 protected:
    124     uint8_t m_remainingLowerTierCellCount { 0 };
    125122};
    126123
  • trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h

    r286502 r286572  
    18211821        GPRReg scratchGPR2, JumpList& slowPath, size_t size)
    18221822    {
    1823         Allocator allocator = allocatorForNonVirtualConcurrently<ClassType>(vm, size, AllocatorForMode::AllocatorIfExists);
     1823        Allocator allocator = allocatorForConcurrently<ClassType>(vm, size, AllocatorForMode::AllocatorIfExists);
    18241824        emitAllocateJSObject(resultGPR, JITAllocator::constant(allocator), scratchGPR1, structure, storage, scratchGPR2, slowPath);
    18251825    }
  • trunk/Source/JavaScriptCore/runtime/ButterflyInlines.h

    r286347 r286572  
    11/*
    2  * Copyright (C) 2012-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    7878{
    7979    size_t size = totalSize(preCapacity, propertyCapacity, hasIndexingHeader, indexingPayloadSizeInBytes);
    80     void* base = vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(vm, size, deferralContext, AllocationFailureMode::ReturnNull);
     80    void* base = vm.jsValueGigacageAuxiliarySpace().allocate(vm, size, deferralContext, AllocationFailureMode::ReturnNull);
    8181    if (UNLIKELY(!base))
    8282        return nullptr;
     
    9090{
    9191    size_t size = totalSize(preCapacity, propertyCapacity, hasIndexingHeader, indexingPayloadSizeInBytes);
    92     void* base = vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(vm, size, nullptr, AllocationFailureMode::Assert);
     92    void* base = vm.jsValueGigacageAuxiliarySpace().allocate(vm, size, nullptr, AllocationFailureMode::Assert);
    9393    Butterfly* result = fromBase(base, preCapacity, propertyCapacity);
    9494
     
    9999{
    100100    size_t size = totalSize(preCapacity, propertyCapacity, hasIndexingHeader, indexingPayloadSizeInBytes);
    101     void* base = vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(vm, size, nullptr, AllocationFailureMode::ReturnNull);
     101    void* base = vm.jsValueGigacageAuxiliarySpace().allocate(vm, size, nullptr, AllocationFailureMode::ReturnNull);
    102102    if (!base)
    103103        return nullptr;
     
    175175    size_t oldSize = totalSize(0, propertyCapacity, hadIndexingHeader, oldIndexingPayloadSizeInBytes);
    176176    size_t newSize = totalSize(0, propertyCapacity, true, newIndexingPayloadSizeInBytes);
    177     void* newBase = vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(vm, newSize, nullptr, AllocationFailureMode::ReturnNull);
     177    void* newBase = vm.jsValueGigacageAuxiliarySpace().allocate(vm, newSize, nullptr, AllocationFailureMode::ReturnNull);
    178178    if (!newBase)
    179179        return nullptr;
     
    218218    }
    219219
    220     void* newBase = vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(vm, newSize, &deferralContext, AllocationFailureMode::ReturnNull);
     220    void* newBase = vm.jsValueGigacageAuxiliarySpace().allocate(vm, newSize, &deferralContext, AllocationFailureMode::ReturnNull);
    221221    if (!newBase)
    222222        return nullptr;
  • trunk/Source/JavaScriptCore/runtime/DirectArguments.cpp

    r285730 r286572  
    124124    putDirect(vm, vm.propertyNames->iteratorSymbol, globalObject->arrayProtoValuesFunction(), static_cast<unsigned>(PropertyAttribute::DontEnum));
    125125   
    126     void* backingStore = vm.gigacageAuxiliarySpace(m_mappedArguments.kind).allocateNonVirtual(vm, mappedArgumentsSize(), nullptr, AllocationFailureMode::ReturnNull);
     126    void* backingStore = vm.gigacageAuxiliarySpace(m_mappedArguments.kind).allocate(vm, mappedArgumentsSize(), nullptr, AllocationFailureMode::ReturnNull);
    127127    if (UNLIKELY(!backingStore)) {
    128128        throwOutOfMemoryError(globalObject, scope);
  • trunk/Source/JavaScriptCore/runtime/GenericArgumentsInlines.h

    r278589 r286572  
    277277
    278278    if (argsLength) {
    279         void* backingStore = vm.gigacageAuxiliarySpace(m_modifiedArgumentsDescriptor.kind).allocateNonVirtual(vm, WTF::roundUpToMultipleOf<8>(argsLength), nullptr, AllocationFailureMode::ReturnNull);
     279        void* backingStore = vm.gigacageAuxiliarySpace(m_modifiedArgumentsDescriptor.kind).allocate(vm, WTF::roundUpToMultipleOf<8>(argsLength), nullptr, AllocationFailureMode::ReturnNull);
    280280        if (UNLIKELY(!backingStore)) {
    281281            throwOutOfMemoryError(globalObject, scope);
  • trunk/Source/JavaScriptCore/runtime/HashMapImpl.h

    r286347 r286572  
    214214        auto scope = DECLARE_THROW_SCOPE(vm);
    215215        size_t allocationSize = HashMapBuffer::allocationSize(capacity);
    216         void* data = vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(vm, allocationSize, nullptr, AllocationFailureMode::ReturnNull);
     216        void* data = vm.jsValueGigacageAuxiliarySpace().allocate(vm, allocationSize, nullptr, AllocationFailureMode::ReturnNull);
    217217        if (!data) {
    218218            throwOutOfMemoryError(globalObject, scope);
  • trunk/Source/JavaScriptCore/runtime/JSArray.cpp

    r286347 r286572  
    5757
    5858        unsigned vectorLength = Butterfly::optimalContiguousVectorLength(structure, initialLength);
    59         void* temp = vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(
     59        void* temp = vm.jsValueGigacageAuxiliarySpace().allocate(
    6060            vm,
    6161            Butterfly::totalSize(0, outOfLineStorage, true, vectorLength * sizeof(EncodedJSValue)),
     
    7979        static constexpr unsigned indexBias = 0;
    8080        unsigned vectorLength = ArrayStorage::optimalVectorLength(indexBias, structure, initialLength);
    81         void* temp = vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(
     81        void* temp = vm.jsValueGigacageAuxiliarySpace().allocate(
    8282            vm,
    8383            Butterfly::totalSize(indexBias, outOfLineStorage, true, ArrayStorage::sizeFor(vectorLength)),
  • trunk/Source/JavaScriptCore/runtime/JSArray.h

    r286347 r286572  
    245245
    246246        unsigned vectorLength = Butterfly::optimalContiguousVectorLength(structure, vectorLengthHint);
    247         void* temp = vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(
     247        void* temp = vm.jsValueGigacageAuxiliarySpace().allocate(
    248248            vm,
    249249            Butterfly::totalSize(0, outOfLineStorage, true, vectorLength * sizeof(EncodedJSValue)),
  • trunk/Source/JavaScriptCore/runtime/JSArrayBufferView.cpp

    r286347 r286572  
    6565        void* temp;
    6666        size_t size = sizeOf(length, elementSize);
    67         temp = vm.primitiveGigacageAuxiliarySpace().allocateNonVirtual(vm, size, nullptr, AllocationFailureMode::ReturnNull);
     67        temp = vm.primitiveGigacageAuxiliarySpace().allocate(vm, size, nullptr, AllocationFailureMode::ReturnNull);
    6868        if (!temp)
    6969            return;
  • trunk/Source/JavaScriptCore/runtime/JSBigInt.cpp

    r286347 r286572  
    118118
    119119    ASSERT(length <= maxLength);
    120     void* data = vm.primitiveGigacageAuxiliarySpace().allocateNonVirtual(vm, length * sizeof(Digit), nullptr, AllocationFailureMode::ReturnNull);
     120    void* data = vm.primitiveGigacageAuxiliarySpace().allocate(vm, length * sizeof(Digit), nullptr, AllocationFailureMode::ReturnNull);
    121121    if (UNLIKELY(!data)) {
    122122        if (nullOrGlobalObjectForOOM) {
  • trunk/Source/JavaScriptCore/runtime/JSCellInlines.h

    r286345 r286572  
    166166
    167167template<typename Type>
    168 inline Allocator allocatorForNonVirtualConcurrently(VM& vm, size_t allocationSize, AllocatorForMode mode)
     168inline Allocator allocatorForConcurrently(VM& vm, size_t allocationSize, AllocatorForMode mode)
    169169{
    170170    if (auto* subspace = subspaceForConcurrently<Type>(vm))
    171         return subspace->allocatorForNonVirtual(allocationSize, mode);
     171        return subspace->allocatorFor(allocationSize, mode);
    172172    return { };
    173173}
     
    179179    ASSERT(deferralContext || heap.isDeferred() || !DisallowGC::isInEffectOnCurrentThread());
    180180    ASSERT(size >= sizeof(T));
    181     JSCell* result = static_cast<JSCell*>(subspaceFor<T>(vm)->allocateNonVirtual(vm, size, deferralContext, failureMode));
     181    JSCell* result = static_cast<JSCell*>(subspaceFor<T>(vm)->allocate(vm, size, deferralContext, failureMode));
    182182    if (failureMode == AllocationFailureMode::ReturnNull && !result)
    183183        return nullptr;
  • trunk/Source/JavaScriptCore/runtime/JSPropertyNameEnumerator.cpp

    r286347 r286572  
    3939    WriteBarrier<JSString>* propertyNamesBuffer = nullptr;
    4040    if (propertyNamesBufferSizeInBytes) {
    41         propertyNamesBuffer = static_cast<WriteBarrier<JSString>*>(vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(vm, propertyNamesBufferSizeInBytes, nullptr, AllocationFailureMode::Assert));
     41        propertyNamesBuffer = static_cast<WriteBarrier<JSString>*>(vm.jsValueGigacageAuxiliarySpace().allocate(vm, propertyNamesBufferSizeInBytes, nullptr, AllocationFailureMode::Assert));
    4242        for (unsigned i = 0; i < propertyNamesSize; ++i)
    4343            propertyNamesBuffer[i].clear();
  • trunk/Source/JavaScriptCore/runtime/ScopedArguments.cpp

    r286347 r286572  
    5656    if (totalLength > table->length()) {
    5757        Checked<unsigned> overflowLength = totalLength - table->length();
    58         storage = static_cast<WriteBarrier<Unknown>*>(vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(vm, overflowLength * sizeof(WriteBarrier<Unknown>), nullptr, AllocationFailureMode::Assert));
     58        storage = static_cast<WriteBarrier<Unknown>*>(vm.jsValueGigacageAuxiliarySpace().allocate(vm, overflowLength * sizeof(WriteBarrier<Unknown>), nullptr, AllocationFailureMode::Assert));
    5959    }
    6060
  • trunk/Source/JavaScriptCore/runtime/StructureChain.cpp

    r286387 r286572  
    4949    ++size; // Sentinel nullptr.
    5050    size_t bytes = Checked<size_t>(size) * sizeof(StructureID);
    51     void* vector = vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(vm, bytes, nullptr, AllocationFailureMode::Assert);
     51    void* vector = vm.jsValueGigacageAuxiliarySpace().allocate(vm, bytes, nullptr, AllocationFailureMode::Assert);
    5252    static_assert(!StructureID().bits(), "Make sure the value we're going to memcpy below matches the default StructureID");
    5353    memset(vector, 0, bytes);
Note: See TracChangeset for help on using the changeset viewer.