Expand Up
@@ -1901,56 +1901,60 @@ class AssemblyHelpers : public MacroAssembler {
// that allocator is non-null; allocator can be null as a signal that we don't know what the
// value of allocatorGPR is. Additionally, if the allocator is not null, then there is no need
// to populate allocatorGPR - this code will ignore the contents of allocatorGPR.
void emitAllocateWithNonNullAllocator (GPRReg resultGPR, const JITAllocator& allocator, GPRReg allocatorGPR, GPRReg scratchGPR, JumpList& slowPath);
enum class SlowAllocationResult : uint8_t {
ClearToNull,
UndefinedBehavior,
};
void emitAllocateWithNonNullAllocator (GPRReg resultGPR, const JITAllocator&, GPRReg allocatorGPR, GPRReg scratchGPR, JumpList& slowPath, SlowAllocationResult = SlowAllocationResult::ClearToNull);
void emitAllocate (GPRReg resultGPR, const JITAllocator& allocator , GPRReg allocatorGPR, GPRReg scratchGPR, JumpList& slowPath);
void emitAllocate (GPRReg resultGPR, const JITAllocator&, GPRReg allocatorGPR, GPRReg scratchGPR, JumpList& slowPath, SlowAllocationResult = SlowAllocationResult::ClearToNull );
template <typename StructureType>
void emitAllocateJSCell (GPRReg resultGPR, const JITAllocator& allocator, GPRReg allocatorGPR, StructureType structure, GPRReg scratchGPR, JumpList& slowPath)
void emitAllocateJSCell (GPRReg resultGPR, const JITAllocator& allocator, GPRReg allocatorGPR, StructureType structure, GPRReg scratchGPR, JumpList& slowPath, SlowAllocationResult slowAllocationResult = SlowAllocationResult::ClearToNull )
{
emitAllocate (resultGPR, allocator, allocatorGPR, scratchGPR, slowPath);
emitAllocate (resultGPR, allocator, allocatorGPR, scratchGPR, slowPath, slowAllocationResult );
emitStoreStructureWithTypeInfo (structure, resultGPR, scratchGPR);
}
template <typename StructureType, typename StorageType>
void emitAllocateJSObject (GPRReg resultGPR, const JITAllocator& allocator, GPRReg allocatorGPR, StructureType structure, StorageType storage, GPRReg scratchGPR, JumpList& slowPath)
void emitAllocateJSObject (GPRReg resultGPR, const JITAllocator& allocator, GPRReg allocatorGPR, StructureType structure, StorageType storage, GPRReg scratchGPR, JumpList& slowPath, SlowAllocationResult slowAllocationResult = SlowAllocationResult::ClearToNull )
{
emitAllocateJSCell (resultGPR, allocator, allocatorGPR, structure, scratchGPR, slowPath);
emitAllocateJSCell (resultGPR, allocator, allocatorGPR, structure, scratchGPR, slowPath, slowAllocationResult );
storePtr (storage, Address (resultGPR, JSObject::butterflyOffset ()));
}
template <typename ClassType, typename StructureType, typename StorageType>
void emitAllocateJSObjectWithKnownSize (
VM& vm, GPRReg resultGPR, StructureType structure, StorageType storage, GPRReg scratchGPR1,
GPRReg scratchGPR2, JumpList& slowPath, size_t size)
GPRReg scratchGPR2, JumpList& slowPath, size_t size, SlowAllocationResult slowAllocationResult = SlowAllocationResult::ClearToNull )
{
Allocator allocator = allocatorForConcurrently<ClassType>(vm, size, AllocatorForMode::AllocatorIfExists);
emitAllocateJSObject (resultGPR, JITAllocator::constant (allocator), scratchGPR1, structure, storage, scratchGPR2, slowPath);
emitAllocateJSObject (resultGPR, JITAllocator::constant (allocator), scratchGPR1, structure, storage, scratchGPR2, slowPath, slowAllocationResult );
}
template <typename ClassType, typename StructureType, typename StorageType>
void emitAllocateJSObject (VM& vm, GPRReg resultGPR, StructureType structure, StorageType storage, GPRReg scratchGPR1, GPRReg scratchGPR2, JumpList& slowPath)
void emitAllocateJSObject (VM& vm, GPRReg resultGPR, StructureType structure, StorageType storage, GPRReg scratchGPR1, GPRReg scratchGPR2, JumpList& slowPath, SlowAllocationResult slowAllocationResult = SlowAllocationResult::ClearToNull )
{
emitAllocateJSObjectWithKnownSize<ClassType>(vm, resultGPR, structure, storage, scratchGPR1, scratchGPR2, slowPath, ClassType::allocationSize (0 ));
emitAllocateJSObjectWithKnownSize<ClassType>(vm, resultGPR, structure, storage, scratchGPR1, scratchGPR2, slowPath, ClassType::allocationSize (0 ), slowAllocationResult );
}
// allocationSize can be aliased with any of the other input GPRs. If it's not aliased then it
// won't be clobbered.
void emitAllocateVariableSized (GPRReg resultGPR, CompleteSubspace& subspace , GPRReg allocationSize, GPRReg scratchGPR1, GPRReg scratchGPR2, JumpList& slowPath);
void emitAllocateVariableSized (GPRReg resultGPR, CompleteSubspace&, GPRReg allocationSize, GPRReg scratchGPR1, GPRReg scratchGPR2, JumpList& slowPath, SlowAllocationResult = SlowAllocationResult::ClearToNull );
template <typename ClassType, typename StructureType>
void emitAllocateVariableSizedCell (VM& vm, GPRReg resultGPR, StructureType structure, GPRReg allocationSize, GPRReg scratchGPR1, GPRReg scratchGPR2, JumpList& slowPath)
void emitAllocateVariableSizedCell (VM& vm, GPRReg resultGPR, StructureType structure, GPRReg allocationSize, GPRReg scratchGPR1, GPRReg scratchGPR2, JumpList& slowPath, SlowAllocationResult slowAllocationResult = SlowAllocationResult::ClearToNull )
{
CompleteSubspace* subspace = subspaceForConcurrently<ClassType>(vm);
RELEASE_ASSERT_WITH_MESSAGE (subspace, " CompleteSubspace is always allocated" );
emitAllocateVariableSized (resultGPR, *subspace, allocationSize, scratchGPR1, scratchGPR2, slowPath);
emitAllocateVariableSized (resultGPR, *subspace, allocationSize, scratchGPR1, scratchGPR2, slowPath, slowAllocationResult );
emitStoreStructureWithTypeInfo (structure, resultGPR, scratchGPR2);
}
template <typename ClassType, typename StructureType>
void emitAllocateVariableSizedJSObject (VM& vm, GPRReg resultGPR, StructureType structure, GPRReg allocationSize, GPRReg scratchGPR1, GPRReg scratchGPR2, JumpList& slowPath)
void emitAllocateVariableSizedJSObject (VM& vm, GPRReg resultGPR, StructureType structure, GPRReg allocationSize, GPRReg scratchGPR1, GPRReg scratchGPR2, JumpList& slowPath, SlowAllocationResult slowAllocationResult = SlowAllocationResult::ClearToNull )
{
emitAllocateVariableSizedCell<ClassType>(vm, resultGPR, structure, allocationSize, scratchGPR1, scratchGPR2, slowPath);
emitAllocateVariableSizedCell<ClassType>(vm, resultGPR, structure, allocationSize, scratchGPR1, scratchGPR2, slowPath, slowAllocationResult );
storePtr (TrustedImmPtr (nullptr ), Address (resultGPR, JSObject::butterflyOffset ()));
}
Expand Down