Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (286571 => 286572)
--- trunk/Source/_javascript_Core/ChangeLog 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-12-06 22:50:39 UTC (rev 286572)
@@ -1,3 +1,90 @@
+2021-12-06 Mark Lam <mark....@apple.com>
+
+ 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):
+
2021-12-06 Patrick Angle <pan...@apple.com>
Web Inspector: Support Cascade Layers in the Styles sidebar
Modified: trunk/Source/_javascript_Core/bytecode/AccessCase.cpp (286571 => 286572)
--- trunk/Source/_javascript_Core/bytecode/AccessCase.cpp 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/bytecode/AccessCase.cpp 2021-12-06 22:50:39 UTC (rev 286572)
@@ -2277,7 +2277,7 @@
size_t newSize = newStructure()->outOfLineCapacity() * sizeof(JSValue);
if (allocatingInline) {
- Allocator allocator = vm.jsValueGigacageAuxiliarySpace().allocatorFor(newSize, AllocatorForMode::AllocatorIfExists);
+ Allocator allocator = vm.jsValueGigacageAuxiliarySpace().allocatorForNonInline(newSize, AllocatorForMode::AllocatorIfExists);
jit.emitAllocate(scratchGPR, JITAllocator::constant(allocator), scratchGPR2, scratchGPR3, slowPath);
jit.addPtr(CCallHelpers::TrustedImm32(newSize + sizeof(IndexingHeader)), scratchGPR);
Modified: trunk/Source/_javascript_Core/bytecode/ObjectAllocationProfileInlines.h (286571 => 286572)
--- trunk/Source/_javascript_Core/bytecode/ObjectAllocationProfileInlines.h 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/bytecode/ObjectAllocationProfileInlines.h 2021-12-06 22:50:39 UTC (rev 286572)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -99,7 +99,7 @@
ASSERT(inlineCapacity <= JSFinalObject::maxInlineCapacity());
size_t allocationSize = JSFinalObject::allocationSize(inlineCapacity);
- Allocator allocator = subspaceFor<JSFinalObject>(vm)->allocatorForNonVirtual(allocationSize, AllocatorForMode::EnsureAllocator);
+ Allocator allocator = subspaceFor<JSFinalObject>(vm)->allocatorFor(allocationSize, AllocatorForMode::EnsureAllocator);
// Take advantage of extra inline capacity available in the size class.
if (allocator) {
Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (286571 => 286572)
--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp 2021-12-06 22:50:39 UTC (rev 286572)
@@ -120,7 +120,7 @@
VM& vm = this->vm();
if (size) {
- if (Allocator allocator = vm.jsValueGigacageAuxiliarySpace().allocatorForNonVirtual(size, AllocatorForMode::AllocatorIfExists)) {
+ if (Allocator allocator = vm.jsValueGigacageAuxiliarySpace().allocatorFor(size, AllocatorForMode::AllocatorIfExists)) {
m_jit.emitAllocate(storageGPR, JITAllocator::constant(allocator), scratchGPR, scratch2GPR, slowCases);
m_jit.addPtr(
@@ -135,9 +135,9 @@
Allocator allocator;
if (structure->typeInfo().type() == JSType::ArrayType)
- allocator = allocatorForNonVirtualConcurrently<JSArray>(vm, JSArray::allocationSize(inlineCapacity), AllocatorForMode::AllocatorIfExists);
+ allocator = allocatorForConcurrently<JSArray>(vm, JSArray::allocationSize(inlineCapacity), AllocatorForMode::AllocatorIfExists);
else
- allocator = allocatorForNonVirtualConcurrently<JSFinalObject>(vm, JSFinalObject::allocationSize(inlineCapacity), AllocatorForMode::AllocatorIfExists);
+ allocator = allocatorForConcurrently<JSFinalObject>(vm, JSFinalObject::allocationSize(inlineCapacity), AllocatorForMode::AllocatorIfExists);
if (allocator) {
emitAllocateJSObject(resultGPR, JITAllocator::constant(allocator), scratchGPR, TrustedImmPtr(structure), storageGPR, scratch2GPR, slowCases);
m_jit.emitInitializeInlineStorage(resultGPR, structure->inlineCapacity());
@@ -10737,7 +10737,7 @@
size_t size = initialOutOfLineCapacity * sizeof(JSValue);
- Allocator allocator = vm().jsValueGigacageAuxiliarySpace().allocatorForNonVirtual(size, AllocatorForMode::AllocatorIfExists);
+ Allocator allocator = vm().jsValueGigacageAuxiliarySpace().allocatorFor(size, AllocatorForMode::AllocatorIfExists);
if (!allocator || node->transition()->previous->couldHaveIndexingHeader()) {
SpeculateCellOperand base(this, node->child1());
@@ -10781,7 +10781,7 @@
size_t newSize = oldSize * outOfLineGrowthFactor;
ASSERT(newSize == node->transition()->next->outOfLineCapacity() * sizeof(JSValue));
- Allocator allocator = vm().jsValueGigacageAuxiliarySpace().allocatorForNonVirtual(newSize, AllocatorForMode::AllocatorIfExists);
+ Allocator allocator = vm().jsValueGigacageAuxiliarySpace().allocatorFor(newSize, AllocatorForMode::AllocatorIfExists);
if (!allocator || node->transition()->previous->couldHaveIndexingHeader()) {
SpeculateCellOperand base(this, node->child1());
@@ -14911,7 +14911,7 @@
RegisteredStructure structure = node->structure();
size_t allocationSize = JSFinalObject::allocationSize(structure->inlineCapacity());
- Allocator allocatorValue = allocatorForNonVirtualConcurrently<JSFinalObject>(vm(), allocationSize, AllocatorForMode::AllocatorIfExists);
+ Allocator allocatorValue = allocatorForConcurrently<JSFinalObject>(vm(), allocationSize, AllocatorForMode::AllocatorIfExists);
if (!allocatorValue)
slowPath.append(m_jit.jump());
else {
@@ -16003,7 +16003,7 @@
GPRReg scratch2GPR = scratch2.gpr();
CCallHelpers::JumpList slowPath;
- Allocator allocatorValue = allocatorForNonVirtualConcurrently<JSRopeString>(vm(), sizeof(JSRopeString), AllocatorForMode::AllocatorIfExists);
+ Allocator allocatorValue = allocatorForConcurrently<JSRopeString>(vm(), sizeof(JSRopeString), AllocatorForMode::AllocatorIfExists);
emitAllocateJSCell(resultGPR, JITAllocator::constant(allocatorValue), allocatorGPR, TrustedImmPtr(m_jit.graph().registerStructure(vm().stringStructure.get())), scratchGPR, slowPath);
// This puts nullptr for the first fiber. It makes visitChildren safe even if this JSRopeString is discarded due to the speculation failure in the following path.
Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp (286571 => 286572)
--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp 2021-12-06 22:50:39 UTC (rev 286572)
@@ -8747,7 +8747,7 @@
LBasicBlock slowPath = m_out.newBlock();
LBasicBlock continuation = m_out.newBlock();
- Allocator allocator = allocatorForNonVirtualConcurrently<JSRopeString>(vm(), sizeof(JSRopeString), AllocatorForMode::AllocatorIfExists);
+ Allocator allocator = allocatorForConcurrently<JSRopeString>(vm(), sizeof(JSRopeString), AllocatorForMode::AllocatorIfExists);
LValue result = allocateCell(
m_out.constIntPtr(allocator.localAllocator()), vm().stringStructure.get(), slowPath);
@@ -13881,9 +13881,9 @@
if (structure->outOfLineCapacity() || hasIndexedProperties(structure->indexingType())) {
Allocator cellAllocator;
if (structure->typeInfo().type() == JSType::ArrayType)
- cellAllocator = allocatorForNonVirtualConcurrently<JSArray>(vm(), JSArray::allocationSize(structure->inlineCapacity()), AllocatorForMode::AllocatorIfExists);
+ cellAllocator = allocatorForConcurrently<JSArray>(vm(), JSArray::allocationSize(structure->inlineCapacity()), AllocatorForMode::AllocatorIfExists);
else
- cellAllocator = allocatorForNonVirtualConcurrently<JSFinalObject>(vm(), JSFinalObject::allocationSize(structure->inlineCapacity()), AllocatorForMode::AllocatorIfExists);
+ cellAllocator = allocatorForConcurrently<JSFinalObject>(vm(), JSFinalObject::allocationSize(structure->inlineCapacity()), AllocatorForMode::AllocatorIfExists);
bool hasIndexingHeader = hasIndexedProperties(structure->indexingType());
unsigned indexingHeaderSize = 0;
@@ -15017,7 +15017,7 @@
LBasicBlock lastNext = m_out.insertNewBlocksBefore(slowPath);
size_t sizeInBytes = sizeInValues * sizeof(JSValue);
- Allocator allocator = vm().jsValueGigacageAuxiliarySpace().allocatorForNonVirtual(sizeInBytes, AllocatorForMode::AllocatorIfExists);
+ Allocator allocator = vm().jsValueGigacageAuxiliarySpace().allocatorFor(sizeInBytes, AllocatorForMode::AllocatorIfExists);
LValue startOfStorage = allocateHeapCell(
m_out.constIntPtr(allocator.localAllocator()), slowPath);
ValueFromBlock fastButterfly = m_out.anchor(
@@ -16852,7 +16852,7 @@
LValue allocateObject(
size_t size, StructureType structure, LValue butterfly, LBasicBlock slowPath)
{
- Allocator allocator = allocatorForNonVirtualConcurrently<ClassType>(vm(), size, AllocatorForMode::AllocatorIfExists);
+ Allocator allocator = allocatorForConcurrently<ClassType>(vm(), size, AllocatorForMode::AllocatorIfExists);
return allocateObject(
m_out.constIntPtr(allocator.localAllocator()), structure, butterfly, slowPath);
}
@@ -16873,7 +16873,7 @@
CompleteSubspace* actualSubspace = bitwise_cast<CompleteSubspace*>(subspace->asIntPtr());
size_t actualSize = size->asIntPtr();
- Allocator actualAllocator = actualSubspace->allocatorForNonVirtual(actualSize, AllocatorForMode::AllocatorIfExists);
+ Allocator actualAllocator = actualSubspace->allocatorFor(actualSize, AllocatorForMode::AllocatorIfExists);
if (!actualAllocator) {
LBasicBlock continuation = m_out.newBlock();
LBasicBlock lastNext = m_out.insertNewBlocksBefore(continuation);
@@ -16935,7 +16935,7 @@
LValue allocateObject(RegisteredStructure structure)
{
size_t allocationSize = JSFinalObject::allocationSize(structure.get()->inlineCapacity());
- Allocator allocator = allocatorForNonVirtualConcurrently<JSFinalObject>(vm(), allocationSize, AllocatorForMode::AllocatorIfExists);
+ Allocator allocator = allocatorForConcurrently<JSFinalObject>(vm(), allocationSize, AllocatorForMode::AllocatorIfExists);
// FIXME: If the allocator is null, we could simply emit a normal C call to the allocator
// instead of putting it on the slow path.
Modified: trunk/Source/_javascript_Core/heap/CompleteSubspace.cpp (286571 => 286572)
--- trunk/Source/_javascript_Core/heap/CompleteSubspace.cpp 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/heap/CompleteSubspace.cpp 2021-12-06 22:50:39 UTC (rev 286572)
@@ -45,16 +45,11 @@
{
}
-Allocator CompleteSubspace::allocatorFor(size_t size, AllocatorForMode mode)
+Allocator CompleteSubspace::allocatorForNonInline(size_t size, AllocatorForMode mode)
{
- return allocatorForNonVirtual(size, mode);
+ return allocatorFor(size, mode);
}
-void* CompleteSubspace::allocate(VM& vm, size_t size, GCDeferralContext* deferralContext, AllocationFailureMode failureMode)
-{
- return allocateNonVirtual(vm, size, deferralContext, failureMode);
-}
-
Allocator CompleteSubspace::allocatorForSlow(size_t size)
{
size_t index = MarkedSpace::sizeClassToIndex(size);
@@ -123,8 +118,8 @@
vm.verifyCanGC();
sanitizeStackForVM(vm);
-
- if (Allocator allocator = allocatorFor(size, AllocatorForMode::EnsureAllocator))
+
+ if (Allocator allocator = allocatorForNonInline(size, AllocatorForMode::EnsureAllocator))
return allocator.allocate(vm.heap, deferralContext, AllocationFailureMode::ReturnNull);
if (size <= Options::preciseAllocationCutoff()
Modified: trunk/Source/_javascript_Core/heap/CompleteSubspace.h (286571 => 286572)
--- trunk/Source/_javascript_Core/heap/CompleteSubspace.h 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/heap/CompleteSubspace.h 2021-12-06 22:50:39 UTC (rev 286572)
@@ -39,11 +39,10 @@
// FIXME: Currently subspaces speak of BlockDirectories as "allocators", but that's temporary.
// https://bugs.webkit.org/show_bug.cgi?id=181559
- Allocator allocatorFor(size_t, AllocatorForMode) final;
- Allocator allocatorForNonVirtual(size_t, AllocatorForMode);
-
- void* allocate(VM&, size_t, GCDeferralContext*, AllocationFailureMode) final;
- void* allocateNonVirtual(VM&, size_t, GCDeferralContext*, AllocationFailureMode);
+ Allocator allocatorFor(size_t, AllocatorForMode);
+ Allocator allocatorForNonInline(size_t, AllocatorForMode);
+
+ void* allocate(VM&, size_t, GCDeferralContext*, AllocationFailureMode);
void* reallocatePreciseAllocationNonVirtual(VM&, HeapCell*, size_t, GCDeferralContext*, AllocationFailureMode);
static ptrdiff_t offsetOfAllocatorForSizeStep() { return OBJECT_OFFSETOF(CompleteSubspace, m_allocatorForSizeStep); }
@@ -62,7 +61,7 @@
Vector<std::unique_ptr<LocalAllocator>> m_localAllocators;
};
-ALWAYS_INLINE Allocator CompleteSubspace::allocatorForNonVirtual(size_t size, AllocatorForMode mode)
+ALWAYS_INLINE Allocator CompleteSubspace::allocatorFor(size_t size, AllocatorForMode mode)
{
if (size <= MarkedSpace::largeCutoff) {
Allocator result = m_allocatorForSizeStep[MarkedSpace::sizeClassToIndex(size)];
Modified: trunk/Source/_javascript_Core/heap/CompleteSubspaceInlines.h (286571 => 286572)
--- trunk/Source/_javascript_Core/heap/CompleteSubspaceInlines.h 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/heap/CompleteSubspaceInlines.h 2021-12-06 22:50:39 UTC (rev 286572)
@@ -30,12 +30,12 @@
namespace JSC {
-ALWAYS_INLINE void* CompleteSubspace::allocateNonVirtual(VM& vm, size_t size, GCDeferralContext* deferralContext, AllocationFailureMode failureMode)
+ALWAYS_INLINE void* CompleteSubspace::allocate(VM& vm, size_t size, GCDeferralContext* deferralContext, AllocationFailureMode failureMode)
{
if constexpr (validateDFGDoesGC)
vm.verifyCanGC();
- if (Allocator allocator = allocatorForNonVirtual(size, AllocatorForMode::AllocatorIfExists))
+ if (Allocator allocator = allocatorFor(size, AllocatorForMode::AllocatorIfExists))
return allocator.allocate(vm.heap, deferralContext, failureMode);
return allocateSlow(vm, size, deferralContext, failureMode);
}
Modified: trunk/Source/_javascript_Core/heap/IsoSubspace.cpp (286571 => 286572)
--- trunk/Source/_javascript_Core/heap/IsoSubspace.cpp 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/heap/IsoSubspace.cpp 2021-12-06 22:50:39 UTC (rev 286572)
@@ -56,16 +56,6 @@
{
}
-Allocator IsoSubspace::allocatorFor(size_t size, AllocatorForMode mode)
-{
- return allocatorForNonVirtual(size, mode);
-}
-
-void* IsoSubspace::allocate(VM& vm, size_t size, GCDeferralContext* deferralContext, AllocationFailureMode failureMode)
-{
- return allocateNonVirtual(vm, size, deferralContext, failureMode);
-}
-
void IsoSubspace::didResizeBits(unsigned blockIndex)
{
m_cellSets.forEach(
Modified: trunk/Source/_javascript_Core/heap/IsoSubspace.h (286571 => 286572)
--- trunk/Source/_javascript_Core/heap/IsoSubspace.h 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/heap/IsoSubspace.h 2021-12-06 22:50:39 UTC (rev 286572)
@@ -42,11 +42,9 @@
size_t cellSize() { return m_directory.cellSize(); }
- Allocator allocatorFor(size_t, AllocatorForMode) override;
- Allocator allocatorForNonVirtual(size_t, AllocatorForMode);
+ Allocator allocatorFor(size_t, AllocatorForMode);
- void* allocate(VM&, size_t, GCDeferralContext*, AllocationFailureMode) override;
- void* allocateNonVirtual(VM&, size_t, GCDeferralContext*, AllocationFailureMode);
+ void* allocate(VM&, size_t, GCDeferralContext*, AllocationFailureMode);
void sweepLowerTierCell(PreciseAllocation*);
void clearIsoCellSetBit(PreciseAllocation*);
@@ -72,7 +70,7 @@
SentinelLinkedList<IsoCellSet, PackedRawSentinelNode<IsoCellSet>> m_cellSets;
};
-ALWAYS_INLINE Allocator IsoSubspace::allocatorForNonVirtual(size_t size, AllocatorForMode)
+ALWAYS_INLINE Allocator IsoSubspace::allocatorFor(size_t size, AllocatorForMode)
{
RELEASE_ASSERT(WTF::roundUpToMultipleOf<MarkedBlock::atomSize>(size) == cellSize());
return Allocator(&m_localAllocator);
Modified: trunk/Source/_javascript_Core/heap/IsoSubspaceInlines.h (286571 => 286572)
--- trunk/Source/_javascript_Core/heap/IsoSubspaceInlines.h 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/heap/IsoSubspaceInlines.h 2021-12-06 22:50:39 UTC (rev 286572)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,10 +27,10 @@
namespace JSC {
-ALWAYS_INLINE void* IsoSubspace::allocateNonVirtual(VM& vm, size_t size, GCDeferralContext* deferralContext, AllocationFailureMode failureMode)
+ALWAYS_INLINE void* IsoSubspace::allocate(VM& vm, size_t size, GCDeferralContext* deferralContext, AllocationFailureMode failureMode)
{
RELEASE_ASSERT(WTF::roundUpToMultipleOf<MarkedBlock::atomSize>(size) == cellSize());
- Allocator allocator = allocatorForNonVirtual(size, AllocatorForMode::MustAlreadyHaveAllocator);
+ Allocator allocator = allocatorFor(size, AllocatorForMode::MustAlreadyHaveAllocator);
void* result = allocator.allocate(vm.heap, deferralContext, failureMode);
return result;
}
Modified: trunk/Source/_javascript_Core/heap/Subspace.h (286571 => 286572)
--- trunk/Source/_javascript_Core/heap/Subspace.h 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/heap/Subspace.h 2021-12-06 22:50:39 UTC (rev 286572)
@@ -56,9 +56,6 @@
void finishSweep(MarkedBlock::Handle&, FreeList*);
void destroy(VM&, JSCell*);
- virtual Allocator allocatorFor(size_t, AllocatorForMode) = 0;
- virtual void* allocate(VM&, size_t, GCDeferralContext*, AllocationFailureMode) = 0;
-
void prepareForAllocation();
void didCreateFirstDirectory(BlockDirectory* directory) { m_directoryForEmptyAllocation = directory; }
@@ -115,13 +112,13 @@
BlockDirectory* m_firstDirectory { nullptr };
BlockDirectory* m_directoryForEmptyAllocation { nullptr }; // Uses the MarkedSpace linked list of blocks.
SentinelLinkedList<PreciseAllocation, PackedRawSentinelNode<PreciseAllocation>> m_preciseAllocations;
+
+ bool m_isIsoSubspace { false };
+ uint8_t m_remainingLowerTierCellCount { 0 };
+
Subspace* m_nextSubspaceInAlignedMemoryAllocator { nullptr };
CString m_name;
-
- bool m_isIsoSubspace { false };
-protected:
- uint8_t m_remainingLowerTierCellCount { 0 };
};
} // namespace JSC
Modified: trunk/Source/_javascript_Core/jit/AssemblyHelpers.h (286571 => 286572)
--- trunk/Source/_javascript_Core/jit/AssemblyHelpers.h 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/jit/AssemblyHelpers.h 2021-12-06 22:50:39 UTC (rev 286572)
@@ -1820,7 +1820,7 @@
VM& vm, GPRReg resultGPR, StructureType structure, StorageType storage, GPRReg scratchGPR1,
GPRReg scratchGPR2, JumpList& slowPath, size_t size)
{
- Allocator allocator = allocatorForNonVirtualConcurrently<ClassType>(vm, size, AllocatorForMode::AllocatorIfExists);
+ Allocator allocator = allocatorForConcurrently<ClassType>(vm, size, AllocatorForMode::AllocatorIfExists);
emitAllocateJSObject(resultGPR, JITAllocator::constant(allocator), scratchGPR1, structure, storage, scratchGPR2, slowPath);
}
Modified: trunk/Source/_javascript_Core/runtime/ButterflyInlines.h (286571 => 286572)
--- trunk/Source/_javascript_Core/runtime/ButterflyInlines.h 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/runtime/ButterflyInlines.h 2021-12-06 22:50:39 UTC (rev 286572)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -77,7 +77,7 @@
inline Butterfly* Butterfly::tryCreateUninitialized(VM& vm, JSObject*, size_t preCapacity, size_t propertyCapacity, bool hasIndexingHeader, size_t indexingPayloadSizeInBytes, GCDeferralContext* deferralContext)
{
size_t size = totalSize(preCapacity, propertyCapacity, hasIndexingHeader, indexingPayloadSizeInBytes);
- void* base = vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(vm, size, deferralContext, AllocationFailureMode::ReturnNull);
+ void* base = vm.jsValueGigacageAuxiliarySpace().allocate(vm, size, deferralContext, AllocationFailureMode::ReturnNull);
if (UNLIKELY(!base))
return nullptr;
@@ -89,7 +89,7 @@
inline Butterfly* Butterfly::createUninitialized(VM& vm, JSObject*, size_t preCapacity, size_t propertyCapacity, bool hasIndexingHeader, size_t indexingPayloadSizeInBytes)
{
size_t size = totalSize(preCapacity, propertyCapacity, hasIndexingHeader, indexingPayloadSizeInBytes);
- void* base = vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(vm, size, nullptr, AllocationFailureMode::Assert);
+ void* base = vm.jsValueGigacageAuxiliarySpace().allocate(vm, size, nullptr, AllocationFailureMode::Assert);
Butterfly* result = fromBase(base, preCapacity, propertyCapacity);
return result;
@@ -98,7 +98,7 @@
inline Butterfly* Butterfly::tryCreate(VM& vm, JSObject*, size_t preCapacity, size_t propertyCapacity, bool hasIndexingHeader, const IndexingHeader& indexingHeader, size_t indexingPayloadSizeInBytes)
{
size_t size = totalSize(preCapacity, propertyCapacity, hasIndexingHeader, indexingPayloadSizeInBytes);
- void* base = vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(vm, size, nullptr, AllocationFailureMode::ReturnNull);
+ void* base = vm.jsValueGigacageAuxiliarySpace().allocate(vm, size, nullptr, AllocationFailureMode::ReturnNull);
if (!base)
return nullptr;
Butterfly* result = fromBase(base, preCapacity, propertyCapacity);
@@ -174,7 +174,7 @@
void* theBase = base(0, propertyCapacity);
size_t oldSize = totalSize(0, propertyCapacity, hadIndexingHeader, oldIndexingPayloadSizeInBytes);
size_t newSize = totalSize(0, propertyCapacity, true, newIndexingPayloadSizeInBytes);
- void* newBase = vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(vm, newSize, nullptr, AllocationFailureMode::ReturnNull);
+ void* newBase = vm.jsValueGigacageAuxiliarySpace().allocate(vm, newSize, nullptr, AllocationFailureMode::ReturnNull);
if (!newBase)
return nullptr;
// FIXME: This probably shouldn't be a memcpy.
@@ -217,7 +217,7 @@
return fromBase(newBase, 0, propertyCapacity);
}
- void* newBase = vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(vm, newSize, &deferralContext, AllocationFailureMode::ReturnNull);
+ void* newBase = vm.jsValueGigacageAuxiliarySpace().allocate(vm, newSize, &deferralContext, AllocationFailureMode::ReturnNull);
if (!newBase)
return nullptr;
gcSafeMemcpy(static_cast<JSValue*>(newBase), static_cast<JSValue*>(theBase), oldSize);
Modified: trunk/Source/_javascript_Core/runtime/DirectArguments.cpp (286571 => 286572)
--- trunk/Source/_javascript_Core/runtime/DirectArguments.cpp 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/runtime/DirectArguments.cpp 2021-12-06 22:50:39 UTC (rev 286572)
@@ -123,7 +123,7 @@
putDirect(vm, vm.propertyNames->callee, m_callee.get(), static_cast<unsigned>(PropertyAttribute::DontEnum));
putDirect(vm, vm.propertyNames->iteratorSymbol, globalObject->arrayProtoValuesFunction(), static_cast<unsigned>(PropertyAttribute::DontEnum));
- void* backingStore = vm.gigacageAuxiliarySpace(m_mappedArguments.kind).allocateNonVirtual(vm, mappedArgumentsSize(), nullptr, AllocationFailureMode::ReturnNull);
+ void* backingStore = vm.gigacageAuxiliarySpace(m_mappedArguments.kind).allocate(vm, mappedArgumentsSize(), nullptr, AllocationFailureMode::ReturnNull);
if (UNLIKELY(!backingStore)) {
throwOutOfMemoryError(globalObject, scope);
return;
Modified: trunk/Source/_javascript_Core/runtime/GenericArgumentsInlines.h (286571 => 286572)
--- trunk/Source/_javascript_Core/runtime/GenericArgumentsInlines.h 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/runtime/GenericArgumentsInlines.h 2021-12-06 22:50:39 UTC (rev 286572)
@@ -276,7 +276,7 @@
RELEASE_ASSERT(!m_modifiedArgumentsDescriptor);
if (argsLength) {
- void* backingStore = vm.gigacageAuxiliarySpace(m_modifiedArgumentsDescriptor.kind).allocateNonVirtual(vm, WTF::roundUpToMultipleOf<8>(argsLength), nullptr, AllocationFailureMode::ReturnNull);
+ void* backingStore = vm.gigacageAuxiliarySpace(m_modifiedArgumentsDescriptor.kind).allocate(vm, WTF::roundUpToMultipleOf<8>(argsLength), nullptr, AllocationFailureMode::ReturnNull);
if (UNLIKELY(!backingStore)) {
throwOutOfMemoryError(globalObject, scope);
return;
Modified: trunk/Source/_javascript_Core/runtime/HashMapImpl.h (286571 => 286572)
--- trunk/Source/_javascript_Core/runtime/HashMapImpl.h 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/runtime/HashMapImpl.h 2021-12-06 22:50:39 UTC (rev 286572)
@@ -213,7 +213,7 @@
{
auto scope = DECLARE_THROW_SCOPE(vm);
size_t allocationSize = HashMapBuffer::allocationSize(capacity);
- void* data = "" allocationSize, nullptr, AllocationFailureMode::ReturnNull);
+ void* data = "" allocationSize, nullptr, AllocationFailureMode::ReturnNull);
if (!data) {
throwOutOfMemoryError(globalObject, scope);
return nullptr;
Modified: trunk/Source/_javascript_Core/runtime/JSArray.cpp (286571 => 286572)
--- trunk/Source/_javascript_Core/runtime/JSArray.cpp 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/runtime/JSArray.cpp 2021-12-06 22:50:39 UTC (rev 286572)
@@ -56,7 +56,7 @@
|| hasContiguous(indexingType));
unsigned vectorLength = Butterfly::optimalContiguousVectorLength(structure, initialLength);
- void* temp = vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(
+ void* temp = vm.jsValueGigacageAuxiliarySpace().allocate(
vm,
Butterfly::totalSize(0, outOfLineStorage, true, vectorLength * sizeof(EncodedJSValue)),
deferralContext, AllocationFailureMode::ReturnNull);
@@ -78,7 +78,7 @@
|| indexingType == ArrayWithArrayStorage);
static constexpr unsigned indexBias = 0;
unsigned vectorLength = ArrayStorage::optimalVectorLength(indexBias, structure, initialLength);
- void* temp = vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(
+ void* temp = vm.jsValueGigacageAuxiliarySpace().allocate(
vm,
Butterfly::totalSize(indexBias, outOfLineStorage, true, ArrayStorage::sizeFor(vectorLength)),
deferralContext, AllocationFailureMode::ReturnNull);
Modified: trunk/Source/_javascript_Core/runtime/JSArray.h (286571 => 286572)
--- trunk/Source/_javascript_Core/runtime/JSArray.h 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/runtime/JSArray.h 2021-12-06 22:50:39 UTC (rev 286572)
@@ -244,7 +244,7 @@
return nullptr;
unsigned vectorLength = Butterfly::optimalContiguousVectorLength(structure, vectorLengthHint);
- void* temp = vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(
+ void* temp = vm.jsValueGigacageAuxiliarySpace().allocate(
vm,
Butterfly::totalSize(0, outOfLineStorage, true, vectorLength * sizeof(EncodedJSValue)),
nullptr, AllocationFailureMode::ReturnNull);
Modified: trunk/Source/_javascript_Core/runtime/JSArrayBufferView.cpp (286571 => 286572)
--- trunk/Source/_javascript_Core/runtime/JSArrayBufferView.cpp 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/runtime/JSArrayBufferView.cpp 2021-12-06 22:50:39 UTC (rev 286572)
@@ -64,7 +64,7 @@
// Attempt GC allocation.
void* temp;
size_t size = sizeOf(length, elementSize);
- temp = vm.primitiveGigacageAuxiliarySpace().allocateNonVirtual(vm, size, nullptr, AllocationFailureMode::ReturnNull);
+ temp = vm.primitiveGigacageAuxiliarySpace().allocate(vm, size, nullptr, AllocationFailureMode::ReturnNull);
if (!temp)
return;
Modified: trunk/Source/_javascript_Core/runtime/JSBigInt.cpp (286571 => 286572)
--- trunk/Source/_javascript_Core/runtime/JSBigInt.cpp 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/runtime/JSBigInt.cpp 2021-12-06 22:50:39 UTC (rev 286572)
@@ -117,7 +117,7 @@
}
ASSERT(length <= maxLength);
- void* data = "" length * sizeof(Digit), nullptr, AllocationFailureMode::ReturnNull);
+ void* data = "" length * sizeof(Digit), nullptr, AllocationFailureMode::ReturnNull);
if (UNLIKELY(!data)) {
if (nullOrGlobalObjectForOOM) {
auto scope = DECLARE_THROW_SCOPE(vm);
Modified: trunk/Source/_javascript_Core/runtime/JSCellInlines.h (286571 => 286572)
--- trunk/Source/_javascript_Core/runtime/JSCellInlines.h 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/runtime/JSCellInlines.h 2021-12-06 22:50:39 UTC (rev 286572)
@@ -165,10 +165,10 @@
}
template<typename Type>
-inline Allocator allocatorForNonVirtualConcurrently(VM& vm, size_t allocationSize, AllocatorForMode mode)
+inline Allocator allocatorForConcurrently(VM& vm, size_t allocationSize, AllocatorForMode mode)
{
if (auto* subspace = subspaceForConcurrently<Type>(vm))
- return subspace->allocatorForNonVirtual(allocationSize, mode);
+ return subspace->allocatorFor(allocationSize, mode);
return { };
}
@@ -178,7 +178,7 @@
VM& vm = heap.vm();
ASSERT(deferralContext || heap.isDeferred() || !DisallowGC::isInEffectOnCurrentThread());
ASSERT(size >= sizeof(T));
- JSCell* result = static_cast<JSCell*>(subspaceFor<T>(vm)->allocateNonVirtual(vm, size, deferralContext, failureMode));
+ JSCell* result = static_cast<JSCell*>(subspaceFor<T>(vm)->allocate(vm, size, deferralContext, failureMode));
if (failureMode == AllocationFailureMode::ReturnNull && !result)
return nullptr;
#if ENABLE(GC_VALIDATION)
Modified: trunk/Source/_javascript_Core/runtime/JSPropertyNameEnumerator.cpp (286571 => 286572)
--- trunk/Source/_javascript_Core/runtime/JSPropertyNameEnumerator.cpp 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/runtime/JSPropertyNameEnumerator.cpp 2021-12-06 22:50:39 UTC (rev 286572)
@@ -38,7 +38,7 @@
unsigned propertyNamesBufferSizeInBytes = Checked<unsigned>(propertyNamesSize) * sizeof(WriteBarrier<JSString>);
WriteBarrier<JSString>* propertyNamesBuffer = nullptr;
if (propertyNamesBufferSizeInBytes) {
- propertyNamesBuffer = static_cast<WriteBarrier<JSString>*>(vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(vm, propertyNamesBufferSizeInBytes, nullptr, AllocationFailureMode::Assert));
+ propertyNamesBuffer = static_cast<WriteBarrier<JSString>*>(vm.jsValueGigacageAuxiliarySpace().allocate(vm, propertyNamesBufferSizeInBytes, nullptr, AllocationFailureMode::Assert));
for (unsigned i = 0; i < propertyNamesSize; ++i)
propertyNamesBuffer[i].clear();
}
Modified: trunk/Source/_javascript_Core/runtime/ScopedArguments.cpp (286571 => 286572)
--- trunk/Source/_javascript_Core/runtime/ScopedArguments.cpp 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/runtime/ScopedArguments.cpp 2021-12-06 22:50:39 UTC (rev 286572)
@@ -55,7 +55,7 @@
WriteBarrier<Unknown>* storage = nullptr;
if (totalLength > table->length()) {
Checked<unsigned> overflowLength = totalLength - table->length();
- storage = static_cast<WriteBarrier<Unknown>*>(vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(vm, overflowLength * sizeof(WriteBarrier<Unknown>), nullptr, AllocationFailureMode::Assert));
+ storage = static_cast<WriteBarrier<Unknown>*>(vm.jsValueGigacageAuxiliarySpace().allocate(vm, overflowLength * sizeof(WriteBarrier<Unknown>), nullptr, AllocationFailureMode::Assert));
}
ScopedArguments* result = new (
Modified: trunk/Source/_javascript_Core/runtime/StructureChain.cpp (286571 => 286572)
--- trunk/Source/_javascript_Core/runtime/StructureChain.cpp 2021-12-06 22:24:49 UTC (rev 286571)
+++ trunk/Source/_javascript_Core/runtime/StructureChain.cpp 2021-12-06 22:50:39 UTC (rev 286572)
@@ -48,7 +48,7 @@
++size;
++size; // Sentinel nullptr.
size_t bytes = Checked<size_t>(size) * sizeof(StructureID);
- void* vector = vm.jsValueGigacageAuxiliarySpace().allocateNonVirtual(vm, bytes, nullptr, AllocationFailureMode::Assert);
+ void* vector = vm.jsValueGigacageAuxiliarySpace().allocate(vm, bytes, nullptr, AllocationFailureMode::Assert);
static_assert(!StructureID().bits(), "Make sure the value we're going to memcpy below matches the default StructureID");
memset(vector, 0, bytes);
StructureChain* chain = new (NotNull, allocateCell<StructureChain>(vm)) StructureChain(vm, vm.structureChainStructure.get(), static_cast<StructureID*>(vector));