Apply PtrTags to the MetaAllocator and friends.
https://bugs.webkit.org/show_bug.cgi?id=185110
<rdar://problem/39533895>
Reviewed by Saam Barati.
Source/JavaScriptCore:
- LinkBuffer now takes a MacroAssemblerCodePtr instead of a void* pointer.
- Apply pointer tagging to the boundary pointers of the FixedExecutableMemoryPool,
and add a sanity check to verify that allocated code buffers are within those
bounds.
- assembler/LinkBuffer.cpp:
(JSC::LinkBuffer::finalizeCodeWithoutDisassemblyImpl):
(JSC::LinkBuffer::copyCompactAndLinkCode):
(JSC::LinkBuffer::linkCode):
(JSC::LinkBuffer::allocate):
(JSC::LinkBuffer::LinkBuffer):
(JSC::LinkBuffer::debugAddress):
(JSC::LinkBuffer::code):
- assembler/MacroAssemblerCodeRef.h:
(JSC::MacroAssemblerCodeRef::MacroAssemblerCodeRef):
- bytecode/InlineAccess.cpp:
(JSC::linkCodeInline):
(JSC::InlineAccess::rewireStubAsJump):
(JSC::DFG::JITCode::findPC):
(JSC::FTL::JITCode::findPC):
- jit/ExecutableAllocator.cpp:
(JSC::FixedVMPoolExecutableAllocator::FixedVMPoolExecutableAllocator):
(JSC::FixedVMPoolExecutableAllocator::jitWriteThunkGenerator):
(JSC::ExecutableAllocator::allocate):
- jit/ExecutableAllocator.h:
(JSC::isJITPC):
(JSC::performJITMemcpy):
(JSC::JIT::link):
(JSC::isProfileEmpty):
- runtime/JSCPtrTag.h:
- wasm/WasmCallee.cpp:
(JSC::Wasm::Callee::Callee):
- wasm/WasmFaultSignalHandler.cpp:
(JSC::Wasm::trapHandler):
Source/WTF:
- Introduce a MetaAllocatorPtr smart pointer to do pointer tagging.
- Use MetaAllocatorPtr in MetaAllocator and MetaAllocatorHandle.
- WTF.xcodeproj/project.pbxproj:
- wtf/CMakeLists.txt:
- wtf/MetaAllocator.cpp:
(WTF::MetaAllocator::release):
(WTF::MetaAllocatorHandle::MetaAllocatorHandle):
(WTF::MetaAllocatorHandle::shrink):
(WTF::MetaAllocatorHandle::dump const):
(WTF::MetaAllocator::allocate):
(WTF::MetaAllocator::findAndRemoveFreeSpace):
(WTF::MetaAllocator::addFreeSpaceFromReleasedHandle):
(WTF::MetaAllocator::addFreshFreeSpace):
(WTF::MetaAllocator::debugFreeSpaceSize):
(WTF::MetaAllocator::addFreeSpace):
(WTF::MetaAllocator::allocFreeSpaceNode):
(WTF::MetaAllocatorTracker::find):
(WTF::MetaAllocator::FreeSpaceNode::FreeSpaceNode):
(WTF::MetaAllocator::FreeSpaceNode::sizeInBytes):
(WTF::MetaAllocator::FreeSpaceNode::key):
- wtf/MetaAllocatorHandle.h:
(WTF::MetaAllocatorHandle::start const):
(WTF::MetaAllocatorHandle::end const):
(WTF::MetaAllocatorHandle::startAsInteger const):
(WTF::MetaAllocatorHandle::endAsInteger const):
(WTF::MetaAllocatorHandle::sizeInBytes const):
(WTF::MetaAllocatorHandle::containsIntegerAddress const):
(WTF::MetaAllocatorHandle::key):
- wtf/MetaAllocatorPtr.h: Added.
(WTF::MetaAllocatorPtr::MetaAllocatorPtr):
(WTF::MetaAllocatorPtr:: const):
(WTF::MetaAllocatorPtr::operator bool const):
(WTF::MetaAllocatorPtr::operator! const):
(WTF::MetaAllocatorPtr::operator== const):
(WTF::MetaAllocatorPtr::operator!= const):
(WTF::MetaAllocatorPtr::operator+ const):
(WTF::MetaAllocatorPtr::operator- const):
(WTF::MetaAllocatorPtr::operator+=):
(WTF::MetaAllocatorPtr::operator-=):
(WTF::MetaAllocatorPtr::isEmptyValue const):
(WTF::MetaAllocatorPtr::isDeletedValue const):
(WTF::MetaAllocatorPtr::hash const):
(WTF::MetaAllocatorPtr::emptyValue):
(WTF::MetaAllocatorPtr::deletedValue):
(WTF::MetaAllocatorPtrHash::hash):
(WTF::MetaAllocatorPtrHash::equal):
Tools:
Update the test to match MetaAllocator changes in WTF.
- TestWebKitAPI/Tests/WTF/MetaAllocator.cpp:
(TestWebKitAPI::TEST_F):
(WTF::tagForPtr):
(WTF::ptrTagName):