Ignore:
Timestamp:
Apr 30, 2018, 3:29:21 PM (7 years ago)
Author:
[email protected]
Message:

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:

  1. LinkBuffer now takes a MacroAssemblerCodePtr instead of a void* pointer.
  2. 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):

  • assembler/LinkBuffer.h:

(JSC::LinkBuffer::LinkBuffer):
(JSC::LinkBuffer::debugAddress):
(JSC::LinkBuffer::code):

  • assembler/MacroAssemblerCodeRef.h:

(JSC::MacroAssemblerCodeRef::MacroAssemblerCodeRef):

  • bytecode/InlineAccess.cpp:

(JSC::linkCodeInline):
(JSC::InlineAccess::rewireStubAsJump):

  • dfg/DFGJITCode.cpp:

(JSC::DFG::JITCode::findPC):

  • ftl/FTLJITCode.cpp:

(JSC::FTL::JITCode::findPC):

  • jit/ExecutableAllocator.cpp:

(JSC::FixedVMPoolExecutableAllocator::FixedVMPoolExecutableAllocator):
(JSC::FixedVMPoolExecutableAllocator::jitWriteThunkGenerator):
(JSC::ExecutableAllocator::allocate):

  • jit/ExecutableAllocator.h:

(JSC::isJITPC):
(JSC::performJITMemcpy):

  • jit/JIT.cpp:

(JSC::JIT::link):

  • jit/JITMathIC.h:

(JSC::isProfileEmpty):

  • runtime/JSCPtrTag.h:
  • wasm/WasmCallee.cpp:

(JSC::Wasm::Callee::Callee):

  • wasm/WasmFaultSignalHandler.cpp:

(JSC::Wasm::trapHandler):

Source/WTF:

  1. Introduce a MetaAllocatorPtr smart pointer to do pointer tagging.
  2. 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/MetaAllocator.h:

(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):

  • wtf/PtrTag.h:

Tools:

Update the test to match MetaAllocator changes in WTF.

  • TestWebKitAPI/Tests/WTF/MetaAllocator.cpp:

(TestWebKitAPI::TEST_F):
(WTF::tagForPtr):
(WTF::ptrTagName):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGJITCode.cpp

    r224550 r231175  
    11/*
    2  * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    230230    for (OSRExit& exit : osrExit) {
    231231        if (ExecutableMemoryHandle* handle = exit.m_code.executableMemory()) {
    232             if (handle->start() <= pc && pc < handle->end())
     232            if (handle->start().untaggedPtr() <= pc && pc < handle->end().untaggedPtr())
    233233                return std::optional<CodeOrigin>(exit.m_codeOriginForExitProfile);
    234234        }
Note: See TracChangeset for help on using the changeset viewer.