haikuwebkit/Source/WTF/wtf/PtrTag.h

575 lines
18 KiB
C
Raw Permalink Normal View History

[Re-landing] Prepare LLInt code to support pointer profiling. https://bugs.webkit.org/show_bug.cgi?id=183387 <rdar://problem/38199678> Reviewed by JF Bastien. Source/JavaScriptCore: 1. Introduced PtrTag enums for supporting pointer profiling later. 2. Also introduced tagging, untagging, retagging, and tag removal placeholder template functions for the same purpose. 3. Prepare the offlineasm for supporting pointer profiling later. 4. Tagged some pointers in LLInt asm code. Currently, these should have no effect on behavior. 5. Removed returnToThrowForThrownException() because it is not used anywhere. 6. Added the offlineasm folder to JavaScriptCore Xcode project so that it's easier to view and edit these files in Xcode. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/LLIntCallLinkInfo.h: (JSC::LLIntCallLinkInfo::unlink): * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntData.h: * llint/LLIntExceptions.cpp: (JSC::LLInt::returnToThrowForThrownException): Deleted. * llint/LLIntExceptions.h: * llint/LLIntOfflineAsmConfig.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: (JSC::LLInt::isLLIntPC): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::handleHostCall): (JSC::LLInt::setUpCall): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * offlineasm/ast.rb: * offlineasm/instructions.rb: * offlineasm/risc.rb: * runtime/PtrTag.h: Added. (JSC::uniquePtrTagID): (JSC::ptrTag): (JSC::tagCodePtr): (JSC::untagCodePtr): (JSC::retagCodePtr): (JSC::removeCodePtrTag): Source/WTF: * wtf/Platform.h: Canonical link: https://commits.webkit.org/199183@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-03-09 21:35:17 +00:00
/*
Implement a more efficient tagCFunction() tool. https://bugs.webkit.org/show_bug.cgi?id=210254 Reviewed by Keith Miller. Source/JavaScriptCore: Putting tagCFunction() to use. * b3/B3LowerMacros.cpp: * b3/B3LowerMacrosAfterOptimizations.cpp: * b3/B3MathExtras.cpp: * b3/B3ReduceLoopStrength.cpp: (JSC::B3::ReduceLoopStrength::reduceByteCopyLoopsToMemcpy): * b3/B3ReduceStrength.cpp: * b3/testb3_5.cpp: (testCallSimple): (testCallRare): (testCallRareLive): (testCallSimplePure): (testCallFunctionWithHellaArguments): (testCallFunctionWithHellaArguments2): (testCallFunctionWithHellaArguments3): (testCallSimpleDouble): (testCallSimpleFloat): (testCallFunctionWithHellaDoubleArguments): (testCallFunctionWithHellaFloatArguments): (testLinearScanWithCalleeOnStack): * b3/testb3_6.cpp: (testInterpreter): * b3/testb3_7.cpp: (testLICMPure): (testLICMPureSideExits): (testLICMPureWritesPinned): (testLICMPureWrites): (testLICMReadsLocalState): (testLICMReadsPinned): (testLICMReads): (testLICMPureNotBackwardsDominant): (testLICMPureFoiledByChild): (testLICMPureNotBackwardsDominantFoiledByChild): (testLICMExitsSideways): (testLICMWritesLocalState): (testLICMWrites): (testLICMFence): (testLICMWritesPinned): (testLICMControlDependent): (testLICMControlDependentNotBackwardsDominant): (testLICMControlDependentSideExits): (testLICMReadsPinnedWritesPinned): (testLICMReadsWritesDifferentHeaps): (testLICMReadsWritesOverlappingHeaps): (testLICMDefaultCall): (testShuffleDoesntTrashCalleeSaves): * dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::emitRestoreArguments): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::handleExitCounts): (JSC::DFG::osrWriteBarrier): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread): (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs): (JSC::FTL::DFG::LowerDFGToB3::compileCallEval): * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileStub): * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::callExceptionFuzz): * jit/CCallHelpers.cpp: (JSC::CCallHelpers::ensureShadowChickenPacket): * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::throwExceptionFromCallSlowPathGenerator): (JSC::slowPathFor): (JSC::nativeForGenerator): (JSC::boundFunctionCallGenerator): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::addTableGet): (JSC::Wasm::B3IRGenerator::addTableSet): (JSC::Wasm::B3IRGenerator::addRefFunc): (JSC::Wasm::B3IRGenerator::addTableSize): (JSC::Wasm::B3IRGenerator::addTableGrow): (JSC::Wasm::B3IRGenerator::addTableFill): (JSC::Wasm::B3IRGenerator::addGrowMemory): (JSC::Wasm::B3IRGenerator::setGlobal): (JSC::Wasm::B3IRGenerator::emitWriteBarrierForJSWrapper): (JSC::Wasm::B3IRGenerator::addOp<OpType::I32Popcnt>): (JSC::Wasm::B3IRGenerator::addOp<OpType::I64Popcnt>): * wasm/WasmThunks.cpp: (JSC::Wasm::triggerOMGEntryTierUpThunkGenerator): Source/WTF: The current tagCFunctionPtr() tool does some extra work that is not needed if we are tagging a known function and not a potentially arbitrary pointer. For example, 1. it doesn't need to do a null check. 2. it doesn't need to authenticate the function address. 3. The RELEASE_ASSERT used to enforce that authentication can also go away. We should only use tagCFunction() (instead of tagCFunctionPtr()) if we know for certain that we're operating on a C/C++ function, and not some arbitrary pointer. * wtf/PtrTag.h: (WTF::tagCFunction): Canonical link: https://commits.webkit.org/223146@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259786 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-09 09:27:40 +00:00
* Copyright (C) 2018-2020 Apple Inc. All rights reserved.
[Re-landing] Prepare LLInt code to support pointer profiling. https://bugs.webkit.org/show_bug.cgi?id=183387 <rdar://problem/38199678> Reviewed by JF Bastien. Source/JavaScriptCore: 1. Introduced PtrTag enums for supporting pointer profiling later. 2. Also introduced tagging, untagging, retagging, and tag removal placeholder template functions for the same purpose. 3. Prepare the offlineasm for supporting pointer profiling later. 4. Tagged some pointers in LLInt asm code. Currently, these should have no effect on behavior. 5. Removed returnToThrowForThrownException() because it is not used anywhere. 6. Added the offlineasm folder to JavaScriptCore Xcode project so that it's easier to view and edit these files in Xcode. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/LLIntCallLinkInfo.h: (JSC::LLIntCallLinkInfo::unlink): * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntData.h: * llint/LLIntExceptions.cpp: (JSC::LLInt::returnToThrowForThrownException): Deleted. * llint/LLIntExceptions.h: * llint/LLIntOfflineAsmConfig.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: (JSC::LLInt::isLLIntPC): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::handleHostCall): (JSC::LLInt::setUpCall): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * offlineasm/ast.rb: * offlineasm/instructions.rb: * offlineasm/risc.rb: * runtime/PtrTag.h: Added. (JSC::uniquePtrTagID): (JSC::ptrTag): (JSC::tagCodePtr): (JSC::untagCodePtr): (JSC::retagCodePtr): (JSC::removeCodePtrTag): Source/WTF: * wtf/Platform.h: Canonical link: https://commits.webkit.org/199183@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-03-09 21:35:17 +00:00
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
#include <wtf/Assertions.h>
#include <wtf/DataLog.h>
[Re-landing] Prepare LLInt code to support pointer profiling. https://bugs.webkit.org/show_bug.cgi?id=183387 <rdar://problem/38199678> Reviewed by JF Bastien. Source/JavaScriptCore: 1. Introduced PtrTag enums for supporting pointer profiling later. 2. Also introduced tagging, untagging, retagging, and tag removal placeholder template functions for the same purpose. 3. Prepare the offlineasm for supporting pointer profiling later. 4. Tagged some pointers in LLInt asm code. Currently, these should have no effect on behavior. 5. Removed returnToThrowForThrownException() because it is not used anywhere. 6. Added the offlineasm folder to JavaScriptCore Xcode project so that it's easier to view and edit these files in Xcode. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/LLIntCallLinkInfo.h: (JSC::LLIntCallLinkInfo::unlink): * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntData.h: * llint/LLIntExceptions.cpp: (JSC::LLInt::returnToThrowForThrownException): Deleted. * llint/LLIntExceptions.h: * llint/LLIntOfflineAsmConfig.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: (JSC::LLInt::isLLIntPC): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::handleHostCall): (JSC::LLInt::setUpCall): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * offlineasm/ast.rb: * offlineasm/instructions.rb: * offlineasm/risc.rb: * runtime/PtrTag.h: Added. (JSC::uniquePtrTagID): (JSC::ptrTag): (JSC::tagCodePtr): (JSC::untagCodePtr): (JSC::retagCodePtr): (JSC::removeCodePtrTag): Source/WTF: * wtf/Platform.h: Canonical link: https://commits.webkit.org/199183@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-03-09 21:35:17 +00:00
Push the definition of PtrTag down to the WTF layer. https://bugs.webkit.org/show_bug.cgi?id=184976 <rdar://problem/39723901> Reviewed by Saam Barati. Source/JavaScriptCore: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/ARM64Assembler.h: * assembler/AbstractMacroAssembler.h: * assembler/MacroAssemblerCodeRef.cpp: * assembler/MacroAssemblerCodeRef.h: * b3/B3MathExtras.cpp: * bytecode/LLIntCallLinkInfo.h: * disassembler/Disassembler.h: * ftl/FTLJITCode.cpp: * interpreter/InterpreterInlines.h: * jit/ExecutableAllocator.h: * jit/JITOperations.cpp: * jit/ThunkGenerator.h: * jit/ThunkGenerators.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: * runtime/JSCPtrTag.h: Added. * runtime/NativeFunction.h: * runtime/PtrTag.h: Removed. * runtime/VMTraps.cpp: Source/WebCore: No new tests needed. This is covered by existing tests. * cssjit/CSSPtrTag.h: * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): Source/WTF: This is in preparation for doing pointer profiling at the WTF layer as well. Also deleted an unused ptrTag() function. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h. (WTF::makePtrTagHash): (JSC::ptrTagName): Deleted. (JSC::tagForPtr): Deleted. (JSC::ptrTag): Deleted. (JSC::tagCodePtr): Deleted. (JSC::untagCodePtr): Deleted. (JSC::retagCodePtr): Deleted. (JSC::removeCodePtrTag): Deleted. (JSC::tagCFunctionPtr): Deleted. (JSC::untagCFunctionPtr): Deleted. (JSC::assertIsCFunctionPtr): Deleted. (JSC::assertIsNullOrCFunctionPtr): Deleted. (JSC::assertIsNotTagged): Deleted. (JSC::assertIsTagged): Deleted. (JSC::assertIsNullOrTagged): Deleted. (JSC::assertIsTaggedWith): Deleted. (JSC::assertIsNullOrTaggedWith): Deleted. Canonical link: https://commits.webkit.org/200497@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-25 22:31:13 +00:00
namespace WTF {
[Re-landing] Prepare LLInt code to support pointer profiling. https://bugs.webkit.org/show_bug.cgi?id=183387 <rdar://problem/38199678> Reviewed by JF Bastien. Source/JavaScriptCore: 1. Introduced PtrTag enums for supporting pointer profiling later. 2. Also introduced tagging, untagging, retagging, and tag removal placeholder template functions for the same purpose. 3. Prepare the offlineasm for supporting pointer profiling later. 4. Tagged some pointers in LLInt asm code. Currently, these should have no effect on behavior. 5. Removed returnToThrowForThrownException() because it is not used anywhere. 6. Added the offlineasm folder to JavaScriptCore Xcode project so that it's easier to view and edit these files in Xcode. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/LLIntCallLinkInfo.h: (JSC::LLIntCallLinkInfo::unlink): * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntData.h: * llint/LLIntExceptions.cpp: (JSC::LLInt::returnToThrowForThrownException): Deleted. * llint/LLIntExceptions.h: * llint/LLIntOfflineAsmConfig.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: (JSC::LLInt::isLLIntPC): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::handleHostCall): (JSC::LLInt::setUpCall): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * offlineasm/ast.rb: * offlineasm/instructions.rb: * offlineasm/risc.rb: * runtime/PtrTag.h: Added. (JSC::uniquePtrTagID): (JSC::ptrTag): (JSC::tagCodePtr): (JSC::untagCodePtr): (JSC::retagCodePtr): (JSC::removeCodePtrTag): Source/WTF: * wtf/Platform.h: Canonical link: https://commits.webkit.org/199183@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-03-09 21:35:17 +00:00
Push the definition of PtrTag down to the WTF layer. https://bugs.webkit.org/show_bug.cgi?id=184976 <rdar://problem/39723901> Reviewed by Saam Barati. Source/JavaScriptCore: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/ARM64Assembler.h: * assembler/AbstractMacroAssembler.h: * assembler/MacroAssemblerCodeRef.cpp: * assembler/MacroAssemblerCodeRef.h: * b3/B3MathExtras.cpp: * bytecode/LLIntCallLinkInfo.h: * disassembler/Disassembler.h: * ftl/FTLJITCode.cpp: * interpreter/InterpreterInlines.h: * jit/ExecutableAllocator.h: * jit/JITOperations.cpp: * jit/ThunkGenerator.h: * jit/ThunkGenerators.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: * runtime/JSCPtrTag.h: Added. * runtime/NativeFunction.h: * runtime/PtrTag.h: Removed. * runtime/VMTraps.cpp: Source/WebCore: No new tests needed. This is covered by existing tests. * cssjit/CSSPtrTag.h: * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): Source/WTF: This is in preparation for doing pointer profiling at the WTF layer as well. Also deleted an unused ptrTag() function. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h. (WTF::makePtrTagHash): (JSC::ptrTagName): Deleted. (JSC::tagForPtr): Deleted. (JSC::ptrTag): Deleted. (JSC::tagCodePtr): Deleted. (JSC::untagCodePtr): Deleted. (JSC::retagCodePtr): Deleted. (JSC::removeCodePtrTag): Deleted. (JSC::tagCFunctionPtr): Deleted. (JSC::untagCFunctionPtr): Deleted. (JSC::assertIsCFunctionPtr): Deleted. (JSC::assertIsNullOrCFunctionPtr): Deleted. (JSC::assertIsNotTagged): Deleted. (JSC::assertIsTagged): Deleted. (JSC::assertIsNullOrTagged): Deleted. (JSC::assertIsTaggedWith): Deleted. (JSC::assertIsNullOrTaggedWith): Deleted. Canonical link: https://commits.webkit.org/200497@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-25 22:31:13 +00:00
#define FOR_EACH_BASE_WTF_PTRTAG(v) \
v(NoPtrTag) \
v(CFunctionPtrTag) \
Push the definition of PtrTag down to the WTF layer. https://bugs.webkit.org/show_bug.cgi?id=184976 <rdar://problem/39723901> Reviewed by Saam Barati. Source/JavaScriptCore: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/ARM64Assembler.h: * assembler/AbstractMacroAssembler.h: * assembler/MacroAssemblerCodeRef.cpp: * assembler/MacroAssemblerCodeRef.h: * b3/B3MathExtras.cpp: * bytecode/LLIntCallLinkInfo.h: * disassembler/Disassembler.h: * ftl/FTLJITCode.cpp: * interpreter/InterpreterInlines.h: * jit/ExecutableAllocator.h: * jit/JITOperations.cpp: * jit/ThunkGenerator.h: * jit/ThunkGenerators.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: * runtime/JSCPtrTag.h: Added. * runtime/NativeFunction.h: * runtime/PtrTag.h: Removed. * runtime/VMTraps.cpp: Source/WebCore: No new tests needed. This is covered by existing tests. * cssjit/CSSPtrTag.h: * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): Source/WTF: This is in preparation for doing pointer profiling at the WTF layer as well. Also deleted an unused ptrTag() function. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h. (WTF::makePtrTagHash): (JSC::ptrTagName): Deleted. (JSC::tagForPtr): Deleted. (JSC::ptrTag): Deleted. (JSC::tagCodePtr): Deleted. (JSC::untagCodePtr): Deleted. (JSC::retagCodePtr): Deleted. (JSC::removeCodePtrTag): Deleted. (JSC::tagCFunctionPtr): Deleted. (JSC::untagCFunctionPtr): Deleted. (JSC::assertIsCFunctionPtr): Deleted. (JSC::assertIsNullOrCFunctionPtr): Deleted. (JSC::assertIsNotTagged): Deleted. (JSC::assertIsTagged): Deleted. (JSC::assertIsNullOrTagged): Deleted. (JSC::assertIsTaggedWith): Deleted. (JSC::assertIsNullOrTaggedWith): Deleted. Canonical link: https://commits.webkit.org/200497@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-25 22:31:13 +00:00
#define FOR_EACH_ADDITIONAL_WTF_PTRTAG(v) \
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): Canonical link: https://commits.webkit.org/200634@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231175 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-30 22:29:21 +00:00
v(FreeSpacePtrTag) \
v(HandleMemoryPtrTag) \
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
v(PlatformRegistersLRPtrTag) \
v(PlatformRegistersPCPtrTag) \
Push the definition of PtrTag down to the WTF layer. https://bugs.webkit.org/show_bug.cgi?id=184976 <rdar://problem/39723901> Reviewed by Saam Barati. Source/JavaScriptCore: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/ARM64Assembler.h: * assembler/AbstractMacroAssembler.h: * assembler/MacroAssemblerCodeRef.cpp: * assembler/MacroAssemblerCodeRef.h: * b3/B3MathExtras.cpp: * bytecode/LLIntCallLinkInfo.h: * disassembler/Disassembler.h: * ftl/FTLJITCode.cpp: * interpreter/InterpreterInlines.h: * jit/ExecutableAllocator.h: * jit/JITOperations.cpp: * jit/ThunkGenerator.h: * jit/ThunkGenerators.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: * runtime/JSCPtrTag.h: Added. * runtime/NativeFunction.h: * runtime/PtrTag.h: Removed. * runtime/VMTraps.cpp: Source/WebCore: No new tests needed. This is covered by existing tests. * cssjit/CSSPtrTag.h: * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): Source/WTF: This is in preparation for doing pointer profiling at the WTF layer as well. Also deleted an unused ptrTag() function. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h. (WTF::makePtrTagHash): (JSC::ptrTagName): Deleted. (JSC::tagForPtr): Deleted. (JSC::ptrTag): Deleted. (JSC::tagCodePtr): Deleted. (JSC::untagCodePtr): Deleted. (JSC::retagCodePtr): Deleted. (JSC::removeCodePtrTag): Deleted. (JSC::tagCFunctionPtr): Deleted. (JSC::untagCFunctionPtr): Deleted. (JSC::assertIsCFunctionPtr): Deleted. (JSC::assertIsNullOrCFunctionPtr): Deleted. (JSC::assertIsNotTagged): Deleted. (JSC::assertIsTagged): Deleted. (JSC::assertIsNullOrTagged): Deleted. (JSC::assertIsTaggedWith): Deleted. (JSC::assertIsNullOrTaggedWith): Deleted. Canonical link: https://commits.webkit.org/200497@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-25 22:31:13 +00:00
#define FOR_EACH_WTF_PTRTAG(v) \
FOR_EACH_BASE_WTF_PTRTAG(v) \
FOR_EACH_ADDITIONAL_WTF_PTRTAG(v) \
[Re-landing] Prepare LLInt code to support pointer profiling. https://bugs.webkit.org/show_bug.cgi?id=183387 <rdar://problem/38199678> Reviewed by JF Bastien. Source/JavaScriptCore: 1. Introduced PtrTag enums for supporting pointer profiling later. 2. Also introduced tagging, untagging, retagging, and tag removal placeholder template functions for the same purpose. 3. Prepare the offlineasm for supporting pointer profiling later. 4. Tagged some pointers in LLInt asm code. Currently, these should have no effect on behavior. 5. Removed returnToThrowForThrownException() because it is not used anywhere. 6. Added the offlineasm folder to JavaScriptCore Xcode project so that it's easier to view and edit these files in Xcode. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/LLIntCallLinkInfo.h: (JSC::LLIntCallLinkInfo::unlink): * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntData.h: * llint/LLIntExceptions.cpp: (JSC::LLInt::returnToThrowForThrownException): Deleted. * llint/LLIntExceptions.h: * llint/LLIntOfflineAsmConfig.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: (JSC::LLInt::isLLIntPC): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::handleHostCall): (JSC::LLInt::setUpCall): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * offlineasm/ast.rb: * offlineasm/instructions.rb: * offlineasm/risc.rb: * runtime/PtrTag.h: Added. (JSC::uniquePtrTagID): (JSC::ptrTag): (JSC::tagCodePtr): (JSC::untagCodePtr): (JSC::retagCodePtr): (JSC::removeCodePtrTag): Source/WTF: * wtf/Platform.h: Canonical link: https://commits.webkit.org/199183@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-03-09 21:35:17 +00:00
enum PtrTag : uintptr_t {
NoPtrTag,
CFunctionPtrTag,
Push the definition of PtrTag down to the WTF layer. https://bugs.webkit.org/show_bug.cgi?id=184976 <rdar://problem/39723901> Reviewed by Saam Barati. Source/JavaScriptCore: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/ARM64Assembler.h: * assembler/AbstractMacroAssembler.h: * assembler/MacroAssemblerCodeRef.cpp: * assembler/MacroAssemblerCodeRef.h: * b3/B3MathExtras.cpp: * bytecode/LLIntCallLinkInfo.h: * disassembler/Disassembler.h: * ftl/FTLJITCode.cpp: * interpreter/InterpreterInlines.h: * jit/ExecutableAllocator.h: * jit/JITOperations.cpp: * jit/ThunkGenerator.h: * jit/ThunkGenerators.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: * runtime/JSCPtrTag.h: Added. * runtime/NativeFunction.h: * runtime/PtrTag.h: Removed. * runtime/VMTraps.cpp: Source/WebCore: No new tests needed. This is covered by existing tests. * cssjit/CSSPtrTag.h: * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): Source/WTF: This is in preparation for doing pointer profiling at the WTF layer as well. Also deleted an unused ptrTag() function. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h. (WTF::makePtrTagHash): (JSC::ptrTagName): Deleted. (JSC::tagForPtr): Deleted. (JSC::ptrTag): Deleted. (JSC::tagCodePtr): Deleted. (JSC::untagCodePtr): Deleted. (JSC::retagCodePtr): Deleted. (JSC::removeCodePtrTag): Deleted. (JSC::tagCFunctionPtr): Deleted. (JSC::untagCFunctionPtr): Deleted. (JSC::assertIsCFunctionPtr): Deleted. (JSC::assertIsNullOrCFunctionPtr): Deleted. (JSC::assertIsNotTagged): Deleted. (JSC::assertIsTagged): Deleted. (JSC::assertIsNullOrTagged): Deleted. (JSC::assertIsTaggedWith): Deleted. (JSC::assertIsNullOrTaggedWith): Deleted. Canonical link: https://commits.webkit.org/200497@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-25 22:31:13 +00:00
};
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
enum class PtrTagCallerType : uint8_t { Native, JIT, None };
enum class PtrTagCalleeType : uint8_t { Native, JIT, };
template<PtrTag tag, typename PtrType>
ALWAYS_INLINE static PtrType tagNativeCodePtrImpl(PtrType ptr)
{
#if CPU(ARM64E)
if constexpr (tag == NoPtrTag)
return ptr;
if constexpr (tag == CFunctionPtrTag)
return ptrauth_sign_unauthenticated(ptr, ptrauth_key_function_pointer, 0);
return ptrauth_sign_unauthenticated(ptr, ptrauth_key_process_dependent_code, tag);
#else
return ptr;
#endif
}
template<PtrTag tag, typename PtrType>
ALWAYS_INLINE static PtrType untagNativeCodePtrImpl(PtrType ptr)
{
#if CPU(ARM64E)
if constexpr (tag == NoPtrTag)
return ptr;
if constexpr (tag == CFunctionPtrTag)
return __builtin_ptrauth_auth(ptr, ptrauth_key_function_pointer, 0);
return __builtin_ptrauth_auth(ptr, ptrauth_key_process_dependent_code, tag);
#else
return ptr;
#endif
}
template<PtrTag passedTag>
struct PtrTagTraits {
static constexpr PtrTag tag = passedTag;
static constexpr PtrTagCallerType callerType = PtrTagCallerType::Native;
static constexpr PtrTagCalleeType calleeType = PtrTagCalleeType::Native;
static constexpr bool isSpecialized = false;
template<typename PtrType>
ALWAYS_INLINE static PtrType tagCodePtr(PtrType ptr)
{
return tagNativeCodePtrImpl<tag>(ptr);
}
template<typename PtrType>
ALWAYS_INLINE static PtrType untagCodePtr(PtrType ptr)
{
return untagNativeCodePtrImpl<tag>(ptr);
}
};
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
#if CPU(ARM64E)
#define WTF_PTRTAG_HASH(tag) ptrauth_string_discriminator(#tag)
#else // not CPU(ARM64E)
Push the definition of PtrTag down to the WTF layer. https://bugs.webkit.org/show_bug.cgi?id=184976 <rdar://problem/39723901> Reviewed by Saam Barati. Source/JavaScriptCore: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/ARM64Assembler.h: * assembler/AbstractMacroAssembler.h: * assembler/MacroAssemblerCodeRef.cpp: * assembler/MacroAssemblerCodeRef.h: * b3/B3MathExtras.cpp: * bytecode/LLIntCallLinkInfo.h: * disassembler/Disassembler.h: * ftl/FTLJITCode.cpp: * interpreter/InterpreterInlines.h: * jit/ExecutableAllocator.h: * jit/JITOperations.cpp: * jit/ThunkGenerator.h: * jit/ThunkGenerators.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: * runtime/JSCPtrTag.h: Added. * runtime/NativeFunction.h: * runtime/PtrTag.h: Removed. * runtime/VMTraps.cpp: Source/WebCore: No new tests needed. This is covered by existing tests. * cssjit/CSSPtrTag.h: * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): Source/WTF: This is in preparation for doing pointer profiling at the WTF layer as well. Also deleted an unused ptrTag() function. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h. (WTF::makePtrTagHash): (JSC::ptrTagName): Deleted. (JSC::tagForPtr): Deleted. (JSC::ptrTag): Deleted. (JSC::tagCodePtr): Deleted. (JSC::untagCodePtr): Deleted. (JSC::retagCodePtr): Deleted. (JSC::removeCodePtrTag): Deleted. (JSC::tagCFunctionPtr): Deleted. (JSC::untagCFunctionPtr): Deleted. (JSC::assertIsCFunctionPtr): Deleted. (JSC::assertIsNullOrCFunctionPtr): Deleted. (JSC::assertIsNotTagged): Deleted. (JSC::assertIsTagged): Deleted. (JSC::assertIsNullOrTagged): Deleted. (JSC::assertIsTaggedWith): Deleted. (JSC::assertIsNullOrTaggedWith): Deleted. Canonical link: https://commits.webkit.org/200497@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-25 22:31:13 +00:00
template<size_t N>
constexpr uintptr_t makePtrTagHash(const char (&str)[N])
{
uintptr_t result = 134775813;
for (size_t i = 0; i < N; ++i)
result += ((result * str[i]) ^ (result >> 16));
Push the definition of PtrTag down to the WTF layer. https://bugs.webkit.org/show_bug.cgi?id=184976 <rdar://problem/39723901> Reviewed by Saam Barati. Source/JavaScriptCore: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/ARM64Assembler.h: * assembler/AbstractMacroAssembler.h: * assembler/MacroAssemblerCodeRef.cpp: * assembler/MacroAssemblerCodeRef.h: * b3/B3MathExtras.cpp: * bytecode/LLIntCallLinkInfo.h: * disassembler/Disassembler.h: * ftl/FTLJITCode.cpp: * interpreter/InterpreterInlines.h: * jit/ExecutableAllocator.h: * jit/JITOperations.cpp: * jit/ThunkGenerator.h: * jit/ThunkGenerators.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: * runtime/JSCPtrTag.h: Added. * runtime/NativeFunction.h: * runtime/PtrTag.h: Removed. * runtime/VMTraps.cpp: Source/WebCore: No new tests needed. This is covered by existing tests. * cssjit/CSSPtrTag.h: * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): Source/WTF: This is in preparation for doing pointer profiling at the WTF layer as well. Also deleted an unused ptrTag() function. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h. (WTF::makePtrTagHash): (JSC::ptrTagName): Deleted. (JSC::tagForPtr): Deleted. (JSC::ptrTag): Deleted. (JSC::tagCodePtr): Deleted. (JSC::untagCodePtr): Deleted. (JSC::retagCodePtr): Deleted. (JSC::removeCodePtrTag): Deleted. (JSC::tagCFunctionPtr): Deleted. (JSC::untagCFunctionPtr): Deleted. (JSC::assertIsCFunctionPtr): Deleted. (JSC::assertIsNullOrCFunctionPtr): Deleted. (JSC::assertIsNotTagged): Deleted. (JSC::assertIsTagged): Deleted. (JSC::assertIsNullOrTagged): Deleted. (JSC::assertIsTaggedWith): Deleted. (JSC::assertIsNullOrTaggedWith): Deleted. Canonical link: https://commits.webkit.org/200497@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-25 22:31:13 +00:00
return result & 0xffff;
}
Push the definition of PtrTag down to the WTF layer. https://bugs.webkit.org/show_bug.cgi?id=184976 <rdar://problem/39723901> Reviewed by Saam Barati. Source/JavaScriptCore: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/ARM64Assembler.h: * assembler/AbstractMacroAssembler.h: * assembler/MacroAssemblerCodeRef.cpp: * assembler/MacroAssemblerCodeRef.h: * b3/B3MathExtras.cpp: * bytecode/LLIntCallLinkInfo.h: * disassembler/Disassembler.h: * ftl/FTLJITCode.cpp: * interpreter/InterpreterInlines.h: * jit/ExecutableAllocator.h: * jit/JITOperations.cpp: * jit/ThunkGenerator.h: * jit/ThunkGenerators.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: * runtime/JSCPtrTag.h: Added. * runtime/NativeFunction.h: * runtime/PtrTag.h: Removed. * runtime/VMTraps.cpp: Source/WebCore: No new tests needed. This is covered by existing tests. * cssjit/CSSPtrTag.h: * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): Source/WTF: This is in preparation for doing pointer profiling at the WTF layer as well. Also deleted an unused ptrTag() function. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h. (WTF::makePtrTagHash): (JSC::ptrTagName): Deleted. (JSC::tagForPtr): Deleted. (JSC::ptrTag): Deleted. (JSC::tagCodePtr): Deleted. (JSC::untagCodePtr): Deleted. (JSC::retagCodePtr): Deleted. (JSC::removeCodePtrTag): Deleted. (JSC::tagCFunctionPtr): Deleted. (JSC::untagCFunctionPtr): Deleted. (JSC::assertIsCFunctionPtr): Deleted. (JSC::assertIsNullOrCFunctionPtr): Deleted. (JSC::assertIsNotTagged): Deleted. (JSC::assertIsTagged): Deleted. (JSC::assertIsNullOrTagged): Deleted. (JSC::assertIsTaggedWith): Deleted. (JSC::assertIsNullOrTaggedWith): Deleted. Canonical link: https://commits.webkit.org/200497@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-25 22:31:13 +00:00
#define WTF_PTRTAG_HASH(tag) WTF::makePtrTagHash(#tag)
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
#endif // not CPU(ARM64E)
Push the definition of PtrTag down to the WTF layer. https://bugs.webkit.org/show_bug.cgi?id=184976 <rdar://problem/39723901> Reviewed by Saam Barati. Source/JavaScriptCore: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/ARM64Assembler.h: * assembler/AbstractMacroAssembler.h: * assembler/MacroAssemblerCodeRef.cpp: * assembler/MacroAssemblerCodeRef.h: * b3/B3MathExtras.cpp: * bytecode/LLIntCallLinkInfo.h: * disassembler/Disassembler.h: * ftl/FTLJITCode.cpp: * interpreter/InterpreterInlines.h: * jit/ExecutableAllocator.h: * jit/JITOperations.cpp: * jit/ThunkGenerator.h: * jit/ThunkGenerators.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: * runtime/JSCPtrTag.h: Added. * runtime/NativeFunction.h: * runtime/PtrTag.h: Removed. * runtime/VMTraps.cpp: Source/WebCore: No new tests needed. This is covered by existing tests. * cssjit/CSSPtrTag.h: * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): Source/WTF: This is in preparation for doing pointer profiling at the WTF layer as well. Also deleted an unused ptrTag() function. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h. (WTF::makePtrTagHash): (JSC::ptrTagName): Deleted. (JSC::tagForPtr): Deleted. (JSC::ptrTag): Deleted. (JSC::tagCodePtr): Deleted. (JSC::untagCodePtr): Deleted. (JSC::retagCodePtr): Deleted. (JSC::removeCodePtrTag): Deleted. (JSC::tagCFunctionPtr): Deleted. (JSC::untagCFunctionPtr): Deleted. (JSC::assertIsCFunctionPtr): Deleted. (JSC::assertIsNullOrCFunctionPtr): Deleted. (JSC::assertIsNotTagged): Deleted. (JSC::assertIsTagged): Deleted. (JSC::assertIsNullOrTagged): Deleted. (JSC::assertIsTaggedWith): Deleted. (JSC::assertIsNullOrTaggedWith): Deleted. Canonical link: https://commits.webkit.org/200497@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-25 22:31:13 +00:00
#define WTF_DECLARE_PTRTAG(tag) \
constexpr PtrTag tag = static_cast<PtrTag>(WTF_PTRTAG_HASH(#tag)); \
static_assert(tag != NoPtrTag && tag != CFunctionPtrTag, "");
[Re-landing] Prepare LLInt code to support pointer profiling. https://bugs.webkit.org/show_bug.cgi?id=183387 <rdar://problem/38199678> Reviewed by JF Bastien. Source/JavaScriptCore: 1. Introduced PtrTag enums for supporting pointer profiling later. 2. Also introduced tagging, untagging, retagging, and tag removal placeholder template functions for the same purpose. 3. Prepare the offlineasm for supporting pointer profiling later. 4. Tagged some pointers in LLInt asm code. Currently, these should have no effect on behavior. 5. Removed returnToThrowForThrownException() because it is not used anywhere. 6. Added the offlineasm folder to JavaScriptCore Xcode project so that it's easier to view and edit these files in Xcode. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/LLIntCallLinkInfo.h: (JSC::LLIntCallLinkInfo::unlink): * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntData.h: * llint/LLIntExceptions.cpp: (JSC::LLInt::returnToThrowForThrownException): Deleted. * llint/LLIntExceptions.h: * llint/LLIntOfflineAsmConfig.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: (JSC::LLInt::isLLIntPC): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::handleHostCall): (JSC::LLInt::setUpCall): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * offlineasm/ast.rb: * offlineasm/instructions.rb: * offlineasm/risc.rb: * runtime/PtrTag.h: Added. (JSC::uniquePtrTagID): (JSC::ptrTag): (JSC::tagCodePtr): (JSC::untagCodePtr): (JSC::retagCodePtr): (JSC::removeCodePtrTag): Source/WTF: * wtf/Platform.h: Canonical link: https://commits.webkit.org/199183@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-03-09 21:35:17 +00:00
static_assert(static_cast<uintptr_t>(NoPtrTag) == static_cast<uintptr_t>(0), "");
Templatize CodePtr/Refs/FunctionPtrs with PtrTags. https://bugs.webkit.org/show_bug.cgi?id=184702 <rdar://problem/35391681> Reviewed by Filip Pizlo and Saam Barati. Source/JavaScriptCore: 1. Templatized MacroAssemblerCodePtr/Ref, FunctionPtr, and CodeLocation variants to take a PtrTag template argument. 2. Replaced some uses of raw pointers with the equivalent CodePtr / FunctionPtr. * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::differenceBetweenCodePtr): (JSC::AbstractMacroAssembler::linkJump): (JSC::AbstractMacroAssembler::linkPointer): (JSC::AbstractMacroAssembler::getLinkerAddress): (JSC::AbstractMacroAssembler::repatchJump): (JSC::AbstractMacroAssembler::repatchJumpToNop): (JSC::AbstractMacroAssembler::repatchNearCall): (JSC::AbstractMacroAssembler::repatchCompact): (JSC::AbstractMacroAssembler::repatchInt32): (JSC::AbstractMacroAssembler::repatchPointer): (JSC::AbstractMacroAssembler::readPointer): (JSC::AbstractMacroAssembler::replaceWithLoad): (JSC::AbstractMacroAssembler::replaceWithAddressComputation): * assembler/CodeLocation.h: (JSC::CodeLocationCommon:: const): (JSC::CodeLocationCommon::CodeLocationCommon): (JSC::CodeLocationInstruction::CodeLocationInstruction): (JSC::CodeLocationLabel::CodeLocationLabel): (JSC::CodeLocationLabel::retagged): (JSC::CodeLocationLabel:: const): (JSC::CodeLocationJump::CodeLocationJump): (JSC::CodeLocationJump::retagged): (JSC::CodeLocationCall::CodeLocationCall): (JSC::CodeLocationCall::retagged): (JSC::CodeLocationNearCall::CodeLocationNearCall): (JSC::CodeLocationDataLabel32::CodeLocationDataLabel32): (JSC::CodeLocationDataLabelCompact::CodeLocationDataLabelCompact): (JSC::CodeLocationDataLabelPtr::CodeLocationDataLabelPtr): (JSC::CodeLocationConvertibleLoad::CodeLocationConvertibleLoad): (JSC::CodeLocationCommon<tag>::instructionAtOffset): (JSC::CodeLocationCommon<tag>::labelAtOffset): (JSC::CodeLocationCommon<tag>::jumpAtOffset): (JSC::CodeLocationCommon<tag>::callAtOffset): (JSC::CodeLocationCommon<tag>::nearCallAtOffset): (JSC::CodeLocationCommon<tag>::dataLabelPtrAtOffset): (JSC::CodeLocationCommon<tag>::dataLabel32AtOffset): (JSC::CodeLocationCommon<tag>::dataLabelCompactAtOffset): (JSC::CodeLocationCommon<tag>::convertibleLoadAtOffset): (JSC::CodeLocationCommon::instructionAtOffset): Deleted. (JSC::CodeLocationCommon::labelAtOffset): Deleted. (JSC::CodeLocationCommon::jumpAtOffset): Deleted. (JSC::CodeLocationCommon::callAtOffset): Deleted. (JSC::CodeLocationCommon::nearCallAtOffset): Deleted. (JSC::CodeLocationCommon::dataLabelPtrAtOffset): Deleted. (JSC::CodeLocationCommon::dataLabel32AtOffset): Deleted. (JSC::CodeLocationCommon::dataLabelCompactAtOffset): Deleted. (JSC::CodeLocationCommon::convertibleLoadAtOffset): Deleted. * assembler/LinkBuffer.cpp: (JSC::LinkBuffer::finalizeCodeWithoutDisassemblyImpl): (JSC::LinkBuffer::finalizeCodeWithDisassemblyImpl): (JSC::LinkBuffer::finalizeCodeWithoutDisassembly): Deleted. (JSC::LinkBuffer::finalizeCodeWithDisassembly): Deleted. * assembler/LinkBuffer.h: (JSC::LinkBuffer::link): (JSC::LinkBuffer::patch): (JSC::LinkBuffer::entrypoint): (JSC::LinkBuffer::locationOf): (JSC::LinkBuffer::locationOfNearCall): (JSC::LinkBuffer::finalizeCodeWithoutDisassembly): (JSC::LinkBuffer::finalizeCodeWithDisassembly): (JSC::LinkBuffer::trampolineAt): * assembler/MacroAssemblerARM.h: (JSC::MacroAssemblerARM::readCallTarget): (JSC::MacroAssemblerARM::replaceWithJump): (JSC::MacroAssemblerARM::startOfPatchableBranch32WithPatchOnAddress): (JSC::MacroAssemblerARM::startOfPatchableBranchPtrWithPatchOnAddress): (JSC::MacroAssemblerARM::startOfBranchPtrWithPatchOnRegister): (JSC::MacroAssemblerARM::revertJumpReplacementToBranchPtrWithPatch): (JSC::MacroAssemblerARM::revertJumpReplacementToPatchableBranch32WithPatch): (JSC::MacroAssemblerARM::revertJumpReplacementToPatchableBranchPtrWithPatch): (JSC::MacroAssemblerARM::repatchCall): (JSC::MacroAssemblerARM::linkCall): * assembler/MacroAssemblerARM64.h: (JSC::MacroAssemblerARM64::readCallTarget): (JSC::MacroAssemblerARM64::replaceWithVMHalt): (JSC::MacroAssemblerARM64::replaceWithJump): (JSC::MacroAssemblerARM64::startOfBranchPtrWithPatchOnRegister): (JSC::MacroAssemblerARM64::startOfPatchableBranchPtrWithPatchOnAddress): (JSC::MacroAssemblerARM64::startOfPatchableBranch32WithPatchOnAddress): (JSC::MacroAssemblerARM64::revertJumpReplacementToBranchPtrWithPatch): (JSC::MacroAssemblerARM64::revertJumpReplacementToPatchableBranchPtrWithPatch): (JSC::MacroAssemblerARM64::revertJumpReplacementToPatchableBranch32WithPatch): (JSC::MacroAssemblerARM64::repatchCall): (JSC::MacroAssemblerARM64::linkCall): * assembler/MacroAssemblerARMv7.h: (JSC::MacroAssemblerARMv7::replaceWithJump): (JSC::MacroAssemblerARMv7::readCallTarget): (JSC::MacroAssemblerARMv7::startOfBranchPtrWithPatchOnRegister): (JSC::MacroAssemblerARMv7::revertJumpReplacementToBranchPtrWithPatch): (JSC::MacroAssemblerARMv7::startOfPatchableBranchPtrWithPatchOnAddress): (JSC::MacroAssemblerARMv7::startOfPatchableBranch32WithPatchOnAddress): (JSC::MacroAssemblerARMv7::revertJumpReplacementToPatchableBranchPtrWithPatch): (JSC::MacroAssemblerARMv7::revertJumpReplacementToPatchableBranch32WithPatch): (JSC::MacroAssemblerARMv7::repatchCall): (JSC::MacroAssemblerARMv7::linkCall): * assembler/MacroAssemblerCodeRef.cpp: (JSC::MacroAssemblerCodePtrBase::dumpWithName): (JSC::MacroAssemblerCodeRefBase::tryToDisassemble): (JSC::MacroAssemblerCodeRefBase::disassembly): (JSC::MacroAssemblerCodePtr::createLLIntCodePtr): Deleted. (JSC::MacroAssemblerCodePtr::dumpWithName const): Deleted. (JSC::MacroAssemblerCodePtr::dump const): Deleted. (JSC::MacroAssemblerCodeRef::createLLIntCodeRef): Deleted. (JSC::MacroAssemblerCodeRef::tryToDisassemble const): Deleted. (JSC::MacroAssemblerCodeRef::disassembly const): Deleted. (JSC::MacroAssemblerCodeRef::dump const): Deleted. * assembler/MacroAssemblerCodeRef.h: (JSC::FunctionPtr::FunctionPtr): (JSC::FunctionPtr::retagged const): (JSC::FunctionPtr::retaggedExecutableAddress const): (JSC::FunctionPtr::operator== const): (JSC::FunctionPtr::operator!= const): (JSC::ReturnAddressPtr::ReturnAddressPtr): (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): (JSC::MacroAssemblerCodePtr::createFromExecutableAddress): (JSC::MacroAssemblerCodePtr::retagged const): (JSC::MacroAssemblerCodePtr:: const): (JSC::MacroAssemblerCodePtr::dumpWithName const): (JSC::MacroAssemblerCodePtr::dump const): (JSC::MacroAssemblerCodePtrHash::hash): (JSC::MacroAssemblerCodePtrHash::equal): (JSC::MacroAssemblerCodeRef::MacroAssemblerCodeRef): (JSC::MacroAssemblerCodeRef::createSelfManagedCodeRef): (JSC::MacroAssemblerCodeRef::code const): (JSC::MacroAssemblerCodeRef::retaggedCode const): (JSC::MacroAssemblerCodeRef::retagged const): (JSC::MacroAssemblerCodeRef::tryToDisassemble const): (JSC::MacroAssemblerCodeRef::disassembly const): (JSC::MacroAssemblerCodeRef::dump const): (JSC::FunctionPtr<tag>::FunctionPtr): * assembler/MacroAssemblerMIPS.h: (JSC::MacroAssemblerMIPS::readCallTarget): (JSC::MacroAssemblerMIPS::replaceWithJump): (JSC::MacroAssemblerMIPS::startOfPatchableBranch32WithPatchOnAddress): (JSC::MacroAssemblerMIPS::startOfBranchPtrWithPatchOnRegister): (JSC::MacroAssemblerMIPS::revertJumpReplacementToBranchPtrWithPatch): (JSC::MacroAssemblerMIPS::startOfPatchableBranchPtrWithPatchOnAddress): (JSC::MacroAssemblerMIPS::revertJumpReplacementToPatchableBranch32WithPatch): (JSC::MacroAssemblerMIPS::revertJumpReplacementToPatchableBranchPtrWithPatch): (JSC::MacroAssemblerMIPS::repatchCall): (JSC::MacroAssemblerMIPS::linkCall): * assembler/MacroAssemblerX86.h: (JSC::MacroAssemblerX86::readCallTarget): (JSC::MacroAssemblerX86::startOfBranchPtrWithPatchOnRegister): (JSC::MacroAssemblerX86::startOfPatchableBranchPtrWithPatchOnAddress): (JSC::MacroAssemblerX86::startOfPatchableBranch32WithPatchOnAddress): (JSC::MacroAssemblerX86::revertJumpReplacementToBranchPtrWithPatch): (JSC::MacroAssemblerX86::revertJumpReplacementToPatchableBranchPtrWithPatch): (JSC::MacroAssemblerX86::revertJumpReplacementToPatchableBranch32WithPatch): (JSC::MacroAssemblerX86::repatchCall): (JSC::MacroAssemblerX86::linkCall): * assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::repatchCompact): (JSC::MacroAssemblerX86Common::replaceWithVMHalt): (JSC::MacroAssemblerX86Common::replaceWithJump): * assembler/MacroAssemblerX86_64.h: (JSC::MacroAssemblerX86_64::readCallTarget): (JSC::MacroAssemblerX86_64::startOfBranchPtrWithPatchOnRegister): (JSC::MacroAssemblerX86_64::startOfBranch32WithPatchOnRegister): (JSC::MacroAssemblerX86_64::startOfPatchableBranchPtrWithPatchOnAddress): (JSC::MacroAssemblerX86_64::startOfPatchableBranch32WithPatchOnAddress): (JSC::MacroAssemblerX86_64::revertJumpReplacementToPatchableBranchPtrWithPatch): (JSC::MacroAssemblerX86_64::revertJumpReplacementToPatchableBranch32WithPatch): (JSC::MacroAssemblerX86_64::revertJumpReplacementToBranchPtrWithPatch): (JSC::MacroAssemblerX86_64::repatchCall): (JSC::MacroAssemblerX86_64::linkCall): * assembler/testmasm.cpp: (JSC::compile): (JSC::invoke): (JSC::testProbeModifiesProgramCounter): * b3/B3Compilation.cpp: (JSC::B3::Compilation::Compilation): * b3/B3Compilation.h: (JSC::B3::Compilation::code const): (JSC::B3::Compilation::codeRef const): * b3/B3Compile.cpp: (JSC::B3::compile): * b3/B3LowerMacros.cpp: * b3/air/AirDisassembler.cpp: (JSC::B3::Air::Disassembler::dump): * b3/air/testair.cpp: * b3/testb3.cpp: (JSC::B3::invoke): (JSC::B3::testInterpreter): (JSC::B3::testEntrySwitchSimple): (JSC::B3::testEntrySwitchNoEntrySwitch): (JSC::B3::testEntrySwitchWithCommonPaths): (JSC::B3::testEntrySwitchWithCommonPathsAndNonTrivialEntrypoint): (JSC::B3::testEntrySwitchLoop): * bytecode/AccessCase.cpp: (JSC::AccessCase::generateImpl): * bytecode/AccessCaseSnippetParams.cpp: (JSC::SlowPathCallGeneratorWithArguments::generateImpl): * bytecode/ByValInfo.h: (JSC::ByValInfo::ByValInfo): * bytecode/CallLinkInfo.cpp: (JSC::CallLinkInfo::callReturnLocation): (JSC::CallLinkInfo::patchableJump): (JSC::CallLinkInfo::hotPathBegin): (JSC::CallLinkInfo::slowPathStart): * bytecode/CallLinkInfo.h: (JSC::CallLinkInfo::setCallLocations): (JSC::CallLinkInfo::hotPathOther): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::computeForStubInfoWithoutExitSiteFeedback): * bytecode/GetByIdVariant.cpp: (JSC::GetByIdVariant::GetByIdVariant): (JSC::GetByIdVariant::dumpInContext const): * bytecode/GetByIdVariant.h: (JSC::GetByIdVariant::customAccessorGetter const): * bytecode/GetterSetterAccessCase.cpp: (JSC::GetterSetterAccessCase::create): (JSC::GetterSetterAccessCase::GetterSetterAccessCase): (JSC::GetterSetterAccessCase::dumpImpl const): * bytecode/GetterSetterAccessCase.h: (JSC::GetterSetterAccessCase::customAccessor const): (): Deleted. * bytecode/HandlerInfo.h: (JSC::HandlerInfo::initialize): * bytecode/InlineAccess.cpp: (JSC::linkCodeInline): (JSC::InlineAccess::rewireStubAsJump): * bytecode/InlineAccess.h: * bytecode/JumpTable.h: (JSC::StringJumpTable::ctiForValue): (JSC::SimpleJumpTable::ctiForValue): * bytecode/LLIntCallLinkInfo.h: (JSC::LLIntCallLinkInfo::unlink): * bytecode/PolymorphicAccess.cpp: (JSC::AccessGenerationState::emitExplicitExceptionHandler): (JSC::PolymorphicAccess::regenerate): * bytecode/PolymorphicAccess.h: (JSC::AccessGenerationResult::AccessGenerationResult): (JSC::AccessGenerationResult::code const): * bytecode/StructureStubInfo.h: (JSC::StructureStubInfo::slowPathCallLocation): (JSC::StructureStubInfo::doneLocation): (JSC::StructureStubInfo::slowPathStartLocation): (JSC::StructureStubInfo::patchableJumpForIn): * dfg/DFGCommonData.h: (JSC::DFG::CommonData::appendCatchEntrypoint): * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::dumpDisassembly): * dfg/DFGDriver.h: * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::linkOSRExits): (JSC::DFG::JITCompiler::compileExceptionHandlers): (JSC::DFG::JITCompiler::link): (JSC::DFG::JITCompiler::compileFunction): (JSC::DFG::JITCompiler::noticeCatchEntrypoint): * dfg/DFGJITCompiler.h: (JSC::DFG::CallLinkRecord::CallLinkRecord): (JSC::DFG::JITCompiler::appendCall): (JSC::DFG::JITCompiler::JSCallRecord::JSCallRecord): (JSC::DFG::JITCompiler::JSDirectCallRecord::JSDirectCallRecord): (JSC::DFG::JITCompiler::JSDirectTailCallRecord::JSDirectTailCallRecord): * dfg/DFGJITFinalizer.cpp: (JSC::DFG::JITFinalizer::JITFinalizer): (JSC::DFG::JITFinalizer::finalize): (JSC::DFG::JITFinalizer::finalizeFunction): * dfg/DFGJITFinalizer.h: * dfg/DFGJumpReplacement.h: (JSC::DFG::JumpReplacement::JumpReplacement): * dfg/DFGNode.h: * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): (JSC::DFG::prepareCatchOSREntry): * dfg/DFGOSREntry.h: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::executeOSRExit): (JSC::DFG::reifyInlinedCallFrames): (JSC::DFG::adjustAndJumpToTarget): (JSC::DFG::OSRExit::codeLocationForRepatch const): (JSC::DFG::OSRExit::emitRestoreArguments): (JSC::DFG::OSRExit::compileOSRExit): * dfg/DFGOSRExit.h: * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::handleExitCounts): (JSC::DFG::reifyInlinedCallFrames): (JSC::DFG::osrWriteBarrier): (JSC::DFG::adjustAndJumpToTarget): * dfg/DFGOperations.cpp: * dfg/DFGSlowPathGenerator.h: (JSC::DFG::CallResultAndArgumentsSlowPathGenerator::CallResultAndArgumentsSlowPathGenerator): (JSC::DFG::CallResultAndArgumentsSlowPathGenerator::unpackAndGenerate): (JSC::DFG::slowPathCall): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileMathIC): (JSC::DFG::SpeculativeJIT::compileCallDOM): (JSC::DFG::SpeculativeJIT::compileCallDOMGetter): (JSC::DFG::SpeculativeJIT::emitSwitchIntJump): (JSC::DFG::SpeculativeJIT::emitSwitchImm): (JSC::DFG::SpeculativeJIT::emitSwitchStringOnString): (JSC::DFG::SpeculativeJIT::compileHasIndexedProperty): (JSC::DFG::SpeculativeJIT::compileGetDirectPname): (JSC::DFG::SpeculativeJIT::cachedPutById): * dfg/DFGSpeculativeJIT.h: (JSC::DFG::SpeculativeJIT::callOperation): (JSC::DFG::SpeculativeJIT::appendCall): (JSC::DFG::SpeculativeJIT::appendCallWithCallFrameRollbackOnException): (JSC::DFG::SpeculativeJIT::appendCallWithCallFrameRollbackOnExceptionSetResult): (JSC::DFG::SpeculativeJIT::appendCallSetResult): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::cachedGetById): (JSC::DFG::SpeculativeJIT::cachedGetByIdWithThis): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGThunks.cpp: (JSC::DFG::osrExitThunkGenerator): (JSC::DFG::osrExitGenerationThunkGenerator): (JSC::DFG::osrEntryThunkGenerator): * dfg/DFGThunks.h: * disassembler/ARM64Disassembler.cpp: (JSC::tryToDisassemble): * disassembler/ARMv7Disassembler.cpp: (JSC::tryToDisassemble): * disassembler/Disassembler.cpp: (JSC::disassemble): (JSC::disassembleAsynchronously): * disassembler/Disassembler.h: (JSC::tryToDisassemble): * disassembler/UDis86Disassembler.cpp: (JSC::tryToDisassembleWithUDis86): * disassembler/UDis86Disassembler.h: (JSC::tryToDisassembleWithUDis86): * disassembler/X86Disassembler.cpp: (JSC::tryToDisassemble): * ftl/FTLCompile.cpp: (JSC::FTL::compile): * ftl/FTLExceptionTarget.cpp: (JSC::FTL::ExceptionTarget::label): (JSC::FTL::ExceptionTarget::jumps): * ftl/FTLExceptionTarget.h: * ftl/FTLGeneratedFunction.h: * ftl/FTLJITCode.cpp: (JSC::FTL::JITCode::initializeB3Code): (JSC::FTL::JITCode::initializeAddressForCall): (JSC::FTL::JITCode::initializeArityCheckEntrypoint): (JSC::FTL::JITCode::addressForCall): (JSC::FTL::JITCode::executableAddressAtOffset): * ftl/FTLJITCode.h: (JSC::FTL::JITCode::b3Code const): * ftl/FTLJITFinalizer.cpp: (JSC::FTL::JITFinalizer::finalizeCommon): * ftl/FTLLazySlowPath.cpp: (JSC::FTL::LazySlowPath::initialize): (JSC::FTL::LazySlowPath::generate): * ftl/FTLLazySlowPath.h: (JSC::FTL::LazySlowPath::patchableJump const): (JSC::FTL::LazySlowPath::done const): (JSC::FTL::LazySlowPath::stub const): * ftl/FTLLazySlowPathCall.h: (JSC::FTL::createLazyCallGenerator): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstruct): (JSC::FTL::DFG::LowerDFGToB3::compileDirectCallOrConstruct): (JSC::FTL::DFG::LowerDFGToB3::compileTailCall): (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread): (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs): (JSC::FTL::DFG::LowerDFGToB3::compileCallEval): (JSC::FTL::DFG::LowerDFGToB3::compileInvalidationPoint): (JSC::FTL::DFG::LowerDFGToB3::compileIn): (JSC::FTL::DFG::LowerDFGToB3::compileCheckSubClass): (JSC::FTL::DFG::LowerDFGToB3::compileCallDOM): (JSC::FTL::DFG::LowerDFGToB3::compileCallDOMGetter): (JSC::FTL::DFG::LowerDFGToB3::lazySlowPath): * ftl/FTLOSRExit.cpp: (JSC::FTL::OSRExit::codeLocationForRepatch const): * ftl/FTLOSRExit.h: * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileStub): (JSC::FTL::compileFTLOSRExit): * ftl/FTLOSRExitHandle.cpp: (JSC::FTL::OSRExitHandle::emitExitThunk): * ftl/FTLOperations.cpp: (JSC::FTL::compileFTLLazySlowPath): * ftl/FTLPatchpointExceptionHandle.cpp: (JSC::FTL::PatchpointExceptionHandle::scheduleExitCreationForUnwind): * ftl/FTLSlowPathCall.cpp: (JSC::FTL::SlowPathCallContext::keyWithTarget const): (JSC::FTL::SlowPathCallContext::makeCall): * ftl/FTLSlowPathCall.h: (JSC::FTL::callOperation): * ftl/FTLSlowPathCallKey.cpp: (JSC::FTL::SlowPathCallKey::dump const): * ftl/FTLSlowPathCallKey.h: (JSC::FTL::SlowPathCallKey::SlowPathCallKey): (JSC::FTL::SlowPathCallKey::callTarget const): (JSC::FTL::SlowPathCallKey::withCallTarget): (JSC::FTL::SlowPathCallKey::hash const): (JSC::FTL::SlowPathCallKey::callPtrTag const): Deleted. * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): (JSC::FTL::osrExitGenerationThunkGenerator): (JSC::FTL::lazySlowPathGenerationThunkGenerator): (JSC::FTL::slowPathCallThunkGenerator): * ftl/FTLThunks.h: (JSC::FTL::generateIfNecessary): (JSC::FTL::keyForThunk): (JSC::FTL::Thunks::getSlowPathCallThunk): (JSC::FTL::Thunks::keyForSlowPathCallThunk): * interpreter/InterpreterInlines.h: (JSC::Interpreter::getOpcodeID): * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::callExceptionFuzz): (JSC::AssemblyHelpers::emitDumbVirtualCall): (JSC::AssemblyHelpers::debugCall): * jit/CCallHelpers.cpp: (JSC::CCallHelpers::ensureShadowChickenPacket): * jit/ExecutableAllocator.cpp: (JSC::FixedVMPoolExecutableAllocator::initializeSeparatedWXHeaps): (JSC::FixedVMPoolExecutableAllocator::jitWriteThunkGenerator): * jit/ExecutableAllocator.h: (JSC::performJITMemcpy): * jit/GCAwareJITStubRoutine.cpp: (JSC::GCAwareJITStubRoutine::GCAwareJITStubRoutine): (JSC::MarkingGCAwareJITStubRoutine::MarkingGCAwareJITStubRoutine): (JSC::GCAwareJITStubRoutineWithExceptionHandler::GCAwareJITStubRoutineWithExceptionHandler): (JSC::createJITStubRoutine): * jit/GCAwareJITStubRoutine.h: (JSC::createJITStubRoutine): * jit/JIT.cpp: (JSC::ctiPatchCallByReturnAddress): (JSC::JIT::compileWithoutLinking): (JSC::JIT::link): (JSC::JIT::privateCompileExceptionHandlers): * jit/JIT.h: (JSC::CallRecord::CallRecord): * jit/JITArithmetic.cpp: (JSC::JIT::emitMathICFast): (JSC::JIT::emitMathICSlow): * jit/JITCall.cpp: (JSC::JIT::compileOpCallSlowCase): * jit/JITCall32_64.cpp: (JSC::JIT::compileOpCallSlowCase): * jit/JITCode.cpp: (JSC::JITCodeWithCodeRef::JITCodeWithCodeRef): (JSC::JITCodeWithCodeRef::executableAddressAtOffset): (JSC::DirectJITCode::DirectJITCode): (JSC::DirectJITCode::initializeCodeRef): (JSC::DirectJITCode::addressForCall): (JSC::NativeJITCode::NativeJITCode): (JSC::NativeJITCode::initializeCodeRef): (JSC::NativeJITCode::addressForCall): * jit/JITCode.h: * jit/JITCodeMap.h: (JSC::JITCodeMap::Entry::Entry): (JSC::JITCodeMap::Entry::codeLocation): (JSC::JITCodeMap::append): (JSC::JITCodeMap::find const): * jit/JITDisassembler.cpp: (JSC::JITDisassembler::dumpDisassembly): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITInlineCacheGenerator.cpp: (JSC::JITByIdGenerator::finalize): * jit/JITInlines.h: (JSC::JIT::emitNakedCall): (JSC::JIT::emitNakedTailCall): (JSC::JIT::appendCallWithExceptionCheck): (JSC::JIT::appendCallWithExceptionCheckAndSlowPathReturnType): (JSC::JIT::appendCallWithCallFrameRollbackOnException): (JSC::JIT::appendCallWithExceptionCheckSetJSValueResult): (JSC::JIT::appendCallWithExceptionCheckSetJSValueResultWithProfile): * jit/JITMathIC.h: (JSC::isProfileEmpty): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_catch): (JSC::JIT::emit_op_switch_imm): (JSC::JIT::emit_op_switch_char): (JSC::JIT::emit_op_switch_string): (JSC::JIT::privateCompileHasIndexedProperty): (JSC::JIT::emitSlow_op_has_indexed_property): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileHasIndexedProperty): * jit/JITOperations.cpp: (JSC::getByVal): * jit/JITPropertyAccess.cpp: (JSC::JIT::stringGetByValStubGenerator): (JSC::JIT::emitGetByValWithCachedId): (JSC::JIT::emitSlow_op_get_by_val): (JSC::JIT::emitPutByValWithCachedId): (JSC::JIT::emitSlow_op_put_by_val): (JSC::JIT::emitSlow_op_try_get_by_id): (JSC::JIT::emitSlow_op_get_by_id_direct): (JSC::JIT::emitSlow_op_get_by_id): (JSC::JIT::emitSlow_op_get_by_id_with_this): (JSC::JIT::emitSlow_op_put_by_id): (JSC::JIT::privateCompileGetByVal): (JSC::JIT::privateCompileGetByValWithCachedId): (JSC::JIT::privateCompilePutByVal): (JSC::JIT::privateCompilePutByValWithCachedId): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::stringGetByValStubGenerator): (JSC::JIT::emitSlow_op_get_by_val): (JSC::JIT::emitSlow_op_put_by_val): * jit/JITStubRoutine.h: (JSC::JITStubRoutine::JITStubRoutine): (JSC::JITStubRoutine::createSelfManagedRoutine): (JSC::JITStubRoutine::code const): (JSC::JITStubRoutine::asCodePtr): * jit/JITThunks.cpp: (JSC::JITThunks::ctiNativeCall): (JSC::JITThunks::ctiNativeConstruct): (JSC::JITThunks::ctiNativeTailCall): (JSC::JITThunks::ctiNativeTailCallWithoutSavedTags): (JSC::JITThunks::ctiInternalFunctionCall): (JSC::JITThunks::ctiInternalFunctionConstruct): (JSC::JITThunks::ctiStub): (JSC::JITThunks::existingCTIStub): (JSC::JITThunks::hostFunctionStub): * jit/JITThunks.h: * jit/PCToCodeOriginMap.cpp: (JSC::PCToCodeOriginMap::PCToCodeOriginMap): * jit/PCToCodeOriginMap.h: * jit/PolymorphicCallStubRoutine.cpp: (JSC::PolymorphicCallStubRoutine::PolymorphicCallStubRoutine): * jit/PolymorphicCallStubRoutine.h: * jit/Repatch.cpp: (JSC::readPutICCallTarget): (JSC::ftlThunkAwareRepatchCall): (JSC::appropriateOptimizingGetByIdFunction): (JSC::appropriateGetByIdFunction): (JSC::tryCacheGetByID): (JSC::repatchGetByID): (JSC::tryCachePutByID): (JSC::repatchPutByID): (JSC::tryCacheIn): (JSC::repatchIn): (JSC::linkSlowFor): (JSC::linkFor): (JSC::linkDirectFor): (JSC::revertCall): (JSC::unlinkFor): (JSC::linkVirtualFor): (JSC::linkPolymorphicCall): (JSC::resetGetByID): (JSC::resetPutByID): * jit/Repatch.h: * jit/SlowPathCall.h: (JSC::JITSlowPathCall::call): * jit/SpecializedThunkJIT.h: (JSC::SpecializedThunkJIT::finalize): (JSC::SpecializedThunkJIT::callDoubleToDouble): (JSC::SpecializedThunkJIT::callDoubleToDoublePreservingReturn): * jit/ThunkGenerator.h: * jit/ThunkGenerators.cpp: (JSC::throwExceptionFromCallSlowPathGenerator): (JSC::slowPathFor): (JSC::linkCallThunkGenerator): (JSC::linkPolymorphicCallThunkGenerator): (JSC::virtualThunkFor): (JSC::nativeForGenerator): (JSC::nativeCallGenerator): (JSC::nativeTailCallGenerator): (JSC::nativeTailCallWithoutSavedTagsGenerator): (JSC::nativeConstructGenerator): (JSC::internalFunctionCallGenerator): (JSC::internalFunctionConstructGenerator): (JSC::arityFixupGenerator): (JSC::unreachableGenerator): (JSC::charCodeAtThunkGenerator): (JSC::charAtThunkGenerator): (JSC::fromCharCodeThunkGenerator): (JSC::clz32ThunkGenerator): (JSC::sqrtThunkGenerator): (JSC::floorThunkGenerator): (JSC::ceilThunkGenerator): (JSC::truncThunkGenerator): (JSC::roundThunkGenerator): (JSC::expThunkGenerator): (JSC::logThunkGenerator): (JSC::absThunkGenerator): (JSC::imulThunkGenerator): (JSC::randomThunkGenerator): (JSC::boundThisNoArgsFunctionCallGenerator): * jit/ThunkGenerators.h: * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntData.h: (JSC::LLInt::getExecutableAddress): (JSC::LLInt::getCodePtr): (JSC::LLInt::getCodeRef): (JSC::LLInt::getCodeFunctionPtr): * llint/LLIntEntrypoint.cpp: (JSC::LLInt::setFunctionEntrypoint): (JSC::LLInt::setEvalEntrypoint): (JSC::LLInt::setProgramEntrypoint): (JSC::LLInt::setModuleProgramEntrypoint): * llint/LLIntExceptions.cpp: (JSC::LLInt::callToThrow): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::setUpCall): * llint/LLIntThunks.cpp: (JSC::vmEntryToWasm): (JSC::LLInt::generateThunkWithJumpTo): (JSC::LLInt::functionForCallEntryThunkGenerator): (JSC::LLInt::functionForConstructEntryThunkGenerator): (JSC::LLInt::functionForCallArityCheckThunkGenerator): (JSC::LLInt::functionForConstructArityCheckThunkGenerator): (JSC::LLInt::evalEntryThunkGenerator): (JSC::LLInt::programEntryThunkGenerator): (JSC::LLInt::moduleProgramEntryThunkGenerator): * llint/LLIntThunks.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * profiler/ProfilerCompilation.cpp: (JSC::Profiler::Compilation::addOSRExitSite): * profiler/ProfilerCompilation.h: * profiler/ProfilerOSRExitSite.cpp: (JSC::Profiler::OSRExitSite::toJS const): * profiler/ProfilerOSRExitSite.h: (JSC::Profiler::OSRExitSite::OSRExitSite): (JSC::Profiler::OSRExitSite::codeAddress const): (JSC::Profiler::OSRExitSite:: const): Deleted. * runtime/ExecutableBase.cpp: (JSC::ExecutableBase::clearCode): * runtime/ExecutableBase.h: (JSC::ExecutableBase::entrypointFor): * runtime/NativeExecutable.cpp: (JSC::NativeExecutable::finishCreation): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * runtime/PtrTag.h: (JSC::tagCodePtr): (JSC::untagCodePtr): (JSC::retagCodePtr): (JSC::tagCFunctionPtr): (JSC::untagCFunctionPtr): (JSC::nextPtrTagID): Deleted. * runtime/PutPropertySlot.h: (JSC::PutPropertySlot::PutPropertySlot): (JSC::PutPropertySlot::setCustomValue): (JSC::PutPropertySlot::setCustomAccessor): (JSC::PutPropertySlot::customSetter const): * runtime/ScriptExecutable.cpp: (JSC::ScriptExecutable::installCode): * runtime/VM.cpp: (JSC::VM::getHostFunction): (JSC::VM::getCTIInternalFunctionTrampolineFor): * runtime/VM.h: (JSC::VM::getCTIStub): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::B3IRGenerator): (JSC::Wasm::B3IRGenerator::emitExceptionCheck): (JSC::Wasm::B3IRGenerator::emitTierUpCheck): (JSC::Wasm::B3IRGenerator::addCall): (JSC::Wasm::B3IRGenerator::addCallIndirect): * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::prepare): (JSC::Wasm::BBQPlan::complete): * wasm/WasmBBQPlan.h: * wasm/WasmBinding.cpp: (JSC::Wasm::wasmToWasm): * wasm/WasmBinding.h: * wasm/WasmCallee.h: (JSC::Wasm::Callee::entrypoint const): * wasm/WasmCallingConvention.h: (JSC::Wasm::CallingConvention::setupFrameInPrologue const): * wasm/WasmCodeBlock.h: (JSC::Wasm::CodeBlock::entrypointLoadLocationFromFunctionIndexSpace): * wasm/WasmFaultSignalHandler.cpp: (JSC::Wasm::trapHandler): * wasm/WasmFormat.h: * wasm/WasmInstance.h: * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::work): * wasm/WasmThunks.cpp: (JSC::Wasm::throwExceptionFromWasmThunkGenerator): (JSC::Wasm::throwStackOverflowFromWasmThunkGenerator): (JSC::Wasm::triggerOMGTierUpThunkGenerator): (JSC::Wasm::Thunks::stub): (JSC::Wasm::Thunks::existingStub): * wasm/WasmThunks.h: * wasm/js/JSToWasm.cpp: (JSC::Wasm::createJSToWasmWrapper): * wasm/js/JSWebAssemblyCodeBlock.h: * wasm/js/WasmToJS.cpp: (JSC::Wasm::handleBadI64Use): (JSC::Wasm::wasmToJS): * wasm/js/WasmToJS.h: * wasm/js/WebAssemblyFunction.h: * yarr/YarrJIT.cpp: (JSC::Yarr::YarrGenerator::loadFromFrameAndJump): (JSC::Yarr::YarrGenerator::BacktrackingState::linkDataLabels): (JSC::Yarr::YarrGenerator::compile): * yarr/YarrJIT.h: (JSC::Yarr::YarrCodeBlock::set8BitCode): (JSC::Yarr::YarrCodeBlock::set16BitCode): (JSC::Yarr::YarrCodeBlock::set8BitCodeMatchOnly): (JSC::Yarr::YarrCodeBlock::set16BitCodeMatchOnly): (JSC::Yarr::YarrCodeBlock::execute): (JSC::Yarr::YarrCodeBlock::clear): Source/WebCore: No new tests. This is covered by existing tests. * WebCore.xcodeproj/project.pbxproj: * css/ElementRuleCollector.cpp: (WebCore::ElementRuleCollector::ruleMatches): * cssjit/CSSPtrTag.h: Added. * cssjit/CompiledSelector.h: * cssjit/FunctionCall.h: (WebCore::FunctionCall::FunctionCall): (WebCore::FunctionCall::setFunctionAddress): (WebCore::FunctionCall::prepareAndCall): * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::compileSelector): (WebCore::SelectorCompiler::SelectorFragment::appendUnoptimizedPseudoClassWithContext): (WebCore::SelectorCompiler::addPseudoClassType): (WebCore::SelectorCompiler::SelectorCodeGenerator::compile): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeFunctionCallValueMatching): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementFunctionCallTest): (WebCore::SelectorCompiler::SelectorCodeGenerator::generateContextFunctionCallTest): * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): * dom/SelectorQuery.cpp: (WebCore::SelectorDataList::executeCompiledSingleMultiSelectorData const): (WebCore::SelectorDataList::execute const): * dom/SelectorQuery.h: Canonical link: https://commits.webkit.org/200234@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230748 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-18 03:31:09 +00:00
static_assert(static_cast<uintptr_t>(CFunctionPtrTag) == static_cast<uintptr_t>(1), "");
#if COMPILER(MSVC)
#pragma warning(push)
#pragma warning(disable:4307)
#endif
Push the definition of PtrTag down to the WTF layer. https://bugs.webkit.org/show_bug.cgi?id=184976 <rdar://problem/39723901> Reviewed by Saam Barati. Source/JavaScriptCore: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/ARM64Assembler.h: * assembler/AbstractMacroAssembler.h: * assembler/MacroAssemblerCodeRef.cpp: * assembler/MacroAssemblerCodeRef.h: * b3/B3MathExtras.cpp: * bytecode/LLIntCallLinkInfo.h: * disassembler/Disassembler.h: * ftl/FTLJITCode.cpp: * interpreter/InterpreterInlines.h: * jit/ExecutableAllocator.h: * jit/JITOperations.cpp: * jit/ThunkGenerator.h: * jit/ThunkGenerators.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: * runtime/JSCPtrTag.h: Added. * runtime/NativeFunction.h: * runtime/PtrTag.h: Removed. * runtime/VMTraps.cpp: Source/WebCore: No new tests needed. This is covered by existing tests. * cssjit/CSSPtrTag.h: * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): Source/WTF: This is in preparation for doing pointer profiling at the WTF layer as well. Also deleted an unused ptrTag() function. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h. (WTF::makePtrTagHash): (JSC::ptrTagName): Deleted. (JSC::tagForPtr): Deleted. (JSC::ptrTag): Deleted. (JSC::tagCodePtr): Deleted. (JSC::untagCodePtr): Deleted. (JSC::retagCodePtr): Deleted. (JSC::removeCodePtrTag): Deleted. (JSC::tagCFunctionPtr): Deleted. (JSC::untagCFunctionPtr): Deleted. (JSC::assertIsCFunctionPtr): Deleted. (JSC::assertIsNullOrCFunctionPtr): Deleted. (JSC::assertIsNotTagged): Deleted. (JSC::assertIsTagged): Deleted. (JSC::assertIsNullOrTagged): Deleted. (JSC::assertIsTaggedWith): Deleted. (JSC::assertIsNullOrTaggedWith): Deleted. Canonical link: https://commits.webkit.org/200497@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-25 22:31:13 +00:00
FOR_EACH_ADDITIONAL_WTF_PTRTAG(WTF_DECLARE_PTRTAG)
#if COMPILER(MSVC)
#pragma warning(pop)
#endif
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
struct PtrTagLookup {
using TagForPtrFunc = const char* (*)(const void*);
using PtrTagNameFunc = const char* (*)(PtrTag);
void initialize(TagForPtrFunc tagForPtr, PtrTagNameFunc ptrTagName)
{
this->tagForPtr = tagForPtr;
this->ptrTagName = ptrTagName;
}
TagForPtrFunc tagForPtr;
PtrTagNameFunc ptrTagName;
PtrTagLookup* next;
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
};
#if CPU(ARM64E)
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
#define ENABLE_PTRTAG_DEBUGGING ASSERT_ENABLED
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
WTF_EXPORT_PRIVATE void registerPtrTagLookup(PtrTagLookup*);
WTF_EXPORT_PRIVATE void reportBadTag(const void*, PtrTag expectedTag);
#if ENABLE(PTRTAG_DEBUGGING)
WTF_EXPORT_PRIVATE const char* ptrTagName(PtrTag);
WTF_EXPORT_PRIVATE const char* tagForPtr(const void*);
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
constexpr bool enablePtrTagDebugAssert = true;
#define REPORT_BAD_TAG(success, ptr, expectedTag) do { \
if (UNLIKELY(!success)) \
reportBadTag(reinterpret_cast<const void*>(ptr), expectedTag); \
} while (false)
PerformanceTests: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * JetStream2/wasm/HashSet.cpp: * StitchMarker/wtf/Assertions.h: * StitchMarker/wtf/DateMath.cpp: (WTF::initializeDates): * StitchMarker/wtf/HashTable.h: * StitchMarker/wtf/Hasher.h: (WTF::StringHasher::addCharacters): * StitchMarker/wtf/NeverDestroyed.h: (WTF::LazyNeverDestroyed::construct): * StitchMarker/wtf/StackBounds.h: (WTF::StackBounds::checkConsistency const): * StitchMarker/wtf/ValueCheck.h: * StitchMarker/wtf/Vector.h: (WTF::minCapacity>::checkConsistency): * StitchMarker/wtf/text/AtomicStringImpl.cpp: * StitchMarker/wtf/text/AtomicStringImpl.h: * StitchMarker/wtf/text/StringCommon.h: (WTF::hasPrefixWithLettersIgnoringASCIICaseCommon): * StitchMarker/wtf/text/StringImpl.h: * StitchMarker/wtf/text/SymbolImpl.h: * StitchMarker/wtf/text/UniquedStringImpl.h: Source/JavaScriptCore: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * API/tests/testapi.c: * assembler/ARM64Assembler.h: (JSC::ARM64Assembler::replaceWithLoad): (JSC::ARM64Assembler::replaceWithAddressComputation): * assembler/AssemblerBuffer.h: (JSC::AssemblerBuffer::LocalWriter::LocalWriter): * assembler/LinkBuffer.cpp: (JSC::LinkBuffer::copyCompactAndLinkCode): * assembler/ProbeStack.cpp: (JSC::Probe::Stack::Stack): * assembler/ProbeStack.h: * b3/B3FoldPathConstants.cpp: * b3/B3LowerToAir.cpp: * b3/B3MemoryValue.cpp: (JSC::B3::MemoryValue::MemoryValue): * b3/B3Opcode.cpp: * b3/B3Type.h: * b3/B3TypeMap.h: * b3/B3Width.h: * b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp: (JSC::B3::Air::GenerateAndAllocateRegisters::prepareForGeneration): (JSC::B3::Air::GenerateAndAllocateRegisters::generate): * b3/air/AirAllocateRegistersAndStackAndGenerateCode.h: * b3/air/AirAllocateRegistersByGraphColoring.cpp: * b3/air/AirArg.cpp: * b3/air/AirArg.h: * b3/air/AirCode.h: * b3/air/AirEmitShuffle.cpp: (JSC::B3::Air::emitShuffle): * builtins/BuiltinExecutables.cpp: (JSC::BuiltinExecutables::createExecutable): * bytecode/AccessCase.cpp: * bytecode/AccessCase.h: * bytecode/CallVariant.cpp: (JSC::variantListWithVariant): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeIndex): * bytecode/CodeBlockHash.cpp: (JSC::CodeBlockHash::dump const): * bytecode/StructureStubInfo.cpp: * bytecode/StructureStubInfo.h: * bytecompiler/NodesCodegen.cpp: (JSC::FunctionCallResolveNode::emitBytecode): * bytecompiler/RegisterID.h: (JSC::RegisterID::RegisterID): (JSC::RegisterID::setIndex): * debugger/Debugger.cpp: (JSC::Debugger::removeBreakpoint): * debugger/DebuggerEvalEnabler.h: (JSC::DebuggerEvalEnabler::DebuggerEvalEnabler): (JSC::DebuggerEvalEnabler::~DebuggerEvalEnabler): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::observeTransitions): * dfg/DFGAbstractValue.cpp: * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::merge): (JSC::DFG::AbstractValue::checkConsistency const): (JSC::DFG::AbstractValue::assertIsRegistered const): * dfg/DFGArithMode.h: (JSC::DFG::doesOverflow): * dfg/DFGBasicBlock.cpp: (JSC::DFG::BasicBlock::BasicBlock): * dfg/DFGBasicBlock.h: (JSC::DFG::BasicBlock::didLink): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::performBlockCFA): * dfg/DFGCommon.h: (JSC::DFG::validationEnabled): * dfg/DFGCommonData.cpp: (JSC::DFG::CommonData::finalizeCatchEntrypoints): * dfg/DFGDesiredWatchpoints.h: * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGEdge.h: (JSC::DFG::Edge::makeWord): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGJITCode.cpp: (JSC::DFG::JITCode::finalizeOSREntrypoints): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * dfg/DFGScoreBoard.h: (JSC::DFG::ScoreBoard::assertClear): * dfg/DFGSlowPathGenerator.h: (JSC::DFG::SlowPathGenerator::generate): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCurrentBlock): (JSC::DFG::SpeculativeJIT::emitBinarySwitchStringRecurse): (JSC::DFG::SpeculativeJIT::emitAllocateButterfly): (JSC::DFG::SpeculativeJIT::compileAllocateNewArrayWithSize): (JSC::DFG::SpeculativeJIT::compileMakeRope): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::fillSpeculateCell): * dfg/DFGStructureAbstractValue.cpp: * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::assertIsRegistered const): * dfg/DFGVarargsForwardingPhase.cpp: * dfg/DFGVirtualRegisterAllocationPhase.cpp: (JSC::DFG::VirtualRegisterAllocationPhase::run): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::callPreflight): (JSC::FTL::DFG::LowerDFGToB3::callCheck): (JSC::FTL::DFG::LowerDFGToB3::crash): * ftl/FTLOperations.cpp: (JSC::FTL::operationMaterializeObjectInOSR): * heap/BlockDirectory.cpp: (JSC::BlockDirectory::assertNoUnswept): * heap/GCSegmentedArray.h: (JSC::GCArraySegment::GCArraySegment): * heap/GCSegmentedArrayInlines.h: (JSC::GCSegmentedArray<T>::clear): (JSC::GCSegmentedArray<T>::expand): (JSC::GCSegmentedArray<T>::validatePrevious): * heap/HandleSet.cpp: * heap/HandleSet.h: * heap/Heap.cpp: (JSC::Heap::updateAllocationLimits): * heap/Heap.h: * heap/MarkedBlock.cpp: * heap/MarkedBlock.h: (JSC::MarkedBlock::assertValidCell const): (JSC::MarkedBlock::assertMarksNotStale): * heap/MarkedSpace.cpp: (JSC::MarkedSpace::beginMarking): (JSC::MarkedSpace::endMarking): (JSC::MarkedSpace::assertNoUnswept): * heap/PreciseAllocation.cpp: * heap/PreciseAllocation.h: (JSC::PreciseAllocation::assertValidCell const): * heap/SlotVisitor.cpp: (JSC::SlotVisitor::SlotVisitor): (JSC::SlotVisitor::appendJSCellOrAuxiliary): * heap/SlotVisitor.h: * inspector/InspectorProtocolTypes.h: (Inspector::Protocol::BindingTraits<JSON::ArrayOf<T>>::assertValueHasExpectedType): * inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py: (CppProtocolTypesImplementationGenerator._generate_assertion_for_object_declaration): (CppProtocolTypesImplementationGenerator): (CppProtocolTypesImplementationGenerator._generate_assertion_for_enum): * inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result: * interpreter/FrameTracers.h: (JSC::JITOperationPrologueCallFrameTracer::JITOperationPrologueCallFrameTracer): * interpreter/Interpreter.cpp: (JSC::Interpreter::Interpreter): * interpreter/Interpreter.h: * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::emitStoreStructureWithTypeInfo): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::prepareCallOperation): * jit/BinarySwitch.cpp: (JSC::BinarySwitch::BinarySwitch): * jit/CCallHelpers.h: (JSC::CCallHelpers::setupStubArgs): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::emitDeltaCheck): (JSC::CallFrameShuffler::prepareAny): * jit/JIT.cpp: (JSC::JIT::assertStackPointerOffset): (JSC::JIT::compileWithoutLinking): * jit/JITOpcodes.cpp: (JSC::JIT::emitSlow_op_loop_hint): * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_get_from_scope): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emit_op_get_from_scope): * jit/Repatch.cpp: (JSC::linkPolymorphicCall): * jit/ThunkGenerators.cpp: (JSC::emitPointerValidation): * llint/LLIntData.cpp: (JSC::LLInt::Data::performAssertions): * llint/LLIntOfflineAsmConfig.h: * parser/Lexer.cpp: * parser/Lexer.h: (JSC::isSafeBuiltinIdentifier): (JSC::Lexer<T>::lexExpectIdentifier): * runtime/ArgList.h: (JSC::MarkedArgumentBuffer::setNeedsOverflowCheck): (JSC::MarkedArgumentBuffer::clearNeedsOverflowCheck): * runtime/Butterfly.h: (JSC::ContiguousData::ContiguousData): (JSC::ContiguousData::Data::Data): * runtime/HashMapImpl.h: (JSC::HashMapImpl::checkConsistency const): (JSC::HashMapImpl::assertBufferIsEmpty const): * runtime/JSCellInlines.h: (JSC::JSCell::methodTable const): * runtime/JSFunction.cpp: * runtime/JSFunction.h: (JSC::JSFunction::assertTypeInfoFlagInvariants): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * runtime/JSGlobalObject.h: * runtime/JSObject.cpp: (JSC::JSObject::visitChildren): (JSC::JSFinalObject::visitChildren): * runtime/JSObjectInlines.h: (JSC::JSObject::validatePutOwnDataProperty): * runtime/JSSegmentedVariableObject.h: (JSC::JSSegmentedVariableObject::assertVariableIsInThisObject): * runtime/LiteralParser.cpp: (JSC::LiteralParser<CharType>::Lexer::lex): * runtime/LiteralParser.h: * runtime/Operations.h: (JSC::scribbleFreeCells): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::computeCanUseJIT): * runtime/VM.h: (JSC::VM::canUseJIT): * runtime/VarOffset.h: (JSC::VarOffset::checkSanity const): * runtime/WeakMapImpl.h: (JSC::WeakMapImpl::checkConsistency const): (JSC::WeakMapImpl::assertBufferIsEmpty const): * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::validateInst): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::parseAndCompile): * wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser::validationFail const): * wasm/WasmLLIntGenerator.cpp: (JSC::Wasm::LLIntGenerator::checkConsistency): * wasm/WasmPlan.cpp: (JSC::Wasm::Plan::tryRemoveContextAndCancelIfLast): * wasm/WasmSectionParser.h: * wasm/WasmSections.h: * wasm/WasmSignatureInlines.h: (JSC::Wasm::SignatureInformation::get): * wasm/WasmWorklist.cpp: (JSC::Wasm::Worklist::enqueue): * wasm/js/JSToWasm.cpp: (JSC::Wasm::createJSToWasmWrapper): * wasm/js/WebAssemblyFunction.cpp: (JSC::WebAssemblyFunction::previousInstanceOffset const): Source/WebCore: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * Modules/fetch/FetchBodySource.cpp: (WebCore::FetchBodySource::close): * Modules/fetch/FetchBodySource.h: * Modules/webdatabase/DatabaseDetails.h: (WebCore::DatabaseDetails::DatabaseDetails): (WebCore::DatabaseDetails::operator=): * Modules/webdatabase/DatabaseTask.cpp: (WebCore::DatabaseTask::performTask): * Modules/webdatabase/DatabaseTask.h: * Modules/webdatabase/DatabaseThread.cpp: (WebCore::DatabaseThread::terminationRequested const): * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h: (WebCore::WHLSL::AST::TypeAnnotation::TypeAnnotation): * Modules/webgpu/WHLSL/WHLSLHighZombieFinder.cpp: (WebCore::WHLSL::findHighZombies): * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp: (WebCore::WHLSL::matches): * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp: (WebCore::WHLSL::checkLiteralTypes): * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp: (WebCore::WHLSL::FindAllTypes::appendNamedType): * bindings/js/JSCallbackData.h: * bindings/js/JSLazyEventListener.cpp: * bindings/js/JSLazyEventListener.h: * contentextensions/ContentExtensionCompiler.cpp: (WebCore::ContentExtensions::compileRuleList): * css/CSSCalculationValue.cpp: (WebCore::CSSCalcOperationNode::primitiveType const): * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): * css/CSSPrimitiveValue.cpp: * css/CSSSelector.cpp: (WebCore::CSSSelector::selectorText const): * css/CSSStyleSheet.cpp: * dom/ActiveDOMObject.cpp: (WebCore::ActiveDOMObject::suspendIfNeeded): (WebCore::ActiveDOMObject::assertSuspendIfNeededWasCalled const): * dom/ActiveDOMObject.h: * dom/ContainerNode.cpp: * dom/ContainerNodeAlgorithms.cpp: * dom/ContainerNodeAlgorithms.h: * dom/CustomElementReactionQueue.cpp: * dom/CustomElementReactionQueue.h: (WebCore::CustomElementReactionDisallowedScope::CustomElementReactionDisallowedScope): (WebCore::CustomElementReactionDisallowedScope::~CustomElementReactionDisallowedScope): * dom/Document.cpp: (WebCore::Document::hitTest): * dom/Document.h: (WebCore::Document::decrementReferencingNodeCount): * dom/Element.cpp: (WebCore::Element::addShadowRoot): (WebCore::Element::getURLAttribute const): (WebCore::Element::getNonEmptyURLAttribute const): * dom/Element.h: * dom/ElementAndTextDescendantIterator.h: (WebCore::ElementAndTextDescendantIterator::ElementAndTextDescendantIterator): (WebCore::ElementAndTextDescendantIterator::dropAssertions): (WebCore::ElementAndTextDescendantIterator::popAncestorSiblingStack): (WebCore::ElementAndTextDescendantIterator::traverseNextSibling): (WebCore::ElementAndTextDescendantIterator::traversePreviousSibling): * dom/ElementDescendantIterator.h: (WebCore::ElementDescendantIterator::ElementDescendantIterator): (WebCore::ElementDescendantIterator::dropAssertions): (WebCore::ElementDescendantIterator::operator++): (WebCore::ElementDescendantIterator::operator--): (WebCore::ElementDescendantConstIterator::ElementDescendantConstIterator): (WebCore::ElementDescendantConstIterator::dropAssertions): (WebCore::ElementDescendantConstIterator::operator++): * dom/ElementIterator.h: (WebCore::ElementIterator<ElementType>::ElementIterator): (WebCore::ElementIterator<ElementType>::traverseNext): (WebCore::ElementIterator<ElementType>::traversePrevious): (WebCore::ElementIterator<ElementType>::traverseNextSibling): (WebCore::ElementIterator<ElementType>::traversePreviousSibling): (WebCore::ElementIterator<ElementType>::traverseNextSkippingChildren): (WebCore::ElementIterator<ElementType>::dropAssertions): (WebCore::ElementIterator<ElementType>::traverseAncestor): (WebCore::ElementConstIterator<ElementType>::ElementConstIterator): (WebCore::ElementConstIterator<ElementType>::traverseNext): (WebCore::ElementConstIterator<ElementType>::traversePrevious): (WebCore::ElementConstIterator<ElementType>::traverseNextSibling): (WebCore::ElementConstIterator<ElementType>::traversePreviousSibling): (WebCore::ElementConstIterator<ElementType>::traverseNextSkippingChildren): (WebCore::ElementConstIterator<ElementType>::traverseAncestor): (WebCore::ElementConstIterator<ElementType>::dropAssertions): * dom/EventContext.cpp: * dom/EventContext.h: * dom/EventListener.h: * dom/EventPath.cpp: * dom/EventSender.h: * dom/EventTarget.cpp: (WebCore::EventTarget::addEventListener): (WebCore::EventTarget::setAttributeEventListener): (WebCore::EventTarget::innerInvokeEventListeners): * dom/Node.cpp: (WebCore::Node::~Node): (WebCore::Node::moveNodeToNewDocument): (WebCore::Node::removedLastRef): * dom/Node.h: (WebCore::Node::deref const): * dom/ScriptDisallowedScope.h: (WebCore::ScriptDisallowedScope::InMainThread::isEventDispatchAllowedInSubtree): * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::~ScriptExecutionContext): * dom/ScriptExecutionContext.h: * dom/SelectorQuery.cpp: (WebCore::SelectorDataList::execute const): * dom/SlotAssignment.cpp: (WebCore::SlotAssignment::addSlotElementByName): (WebCore::SlotAssignment::removeSlotElementByName): (WebCore::SlotAssignment::resolveSlotsAfterSlotMutation): (WebCore::SlotAssignment::findFirstSlotElement): * dom/SlotAssignment.h: * dom/TreeScopeOrderedMap.cpp: (WebCore::TreeScopeOrderedMap::add): (WebCore::TreeScopeOrderedMap::get const): * dom/TreeScopeOrderedMap.h: * fileapi/Blob.cpp: * fileapi/Blob.h: * history/BackForwardCache.cpp: (WebCore::BackForwardCache::removeAllItemsForPage): * history/BackForwardCache.h: * html/CanvasBase.cpp: (WebCore::CanvasBase::notifyObserversCanvasDestroyed): * html/CanvasBase.h: * html/HTMLCollection.h: (WebCore::CollectionNamedElementCache::didPopulate): * html/HTMLSelectElement.cpp: (WebCore:: const): * html/HTMLTableRowsCollection.cpp: (WebCore::assertRowIsInTable): * html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::indexForPosition const): * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::~CanvasRenderingContext2DBase): * html/parser/HTMLParserScheduler.cpp: (WebCore::HTMLParserScheduler::HTMLParserScheduler): (WebCore::HTMLParserScheduler::suspend): (WebCore::HTMLParserScheduler::resume): * html/parser/HTMLParserScheduler.h: * html/parser/HTMLToken.h: (WebCore::HTMLToken::beginStartTag): (WebCore::HTMLToken::beginEndTag): (WebCore::HTMLToken::endAttribute): * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::HTMLTreeBuilder): (WebCore::HTMLTreeBuilder::constructTree): * html/parser/HTMLTreeBuilder.h: (WebCore::HTMLTreeBuilder::~HTMLTreeBuilder): * layout/FormattingContext.cpp: (WebCore::Layout::FormattingContext::geometryForBox const): * layout/blockformatting/BlockFormattingContext.cpp: (WebCore::Layout::BlockFormattingContext::computeEstimatedVerticalPosition): * layout/blockformatting/BlockFormattingContext.h: * layout/displaytree/DisplayBox.cpp: (WebCore::Display::Box::Box): * layout/displaytree/DisplayBox.h: (WebCore::Display::Box::setTopLeft): (WebCore::Display::Box::setTop): (WebCore::Display::Box::setLeft): (WebCore::Display::Box::setContentBoxHeight): (WebCore::Display::Box::setContentBoxWidth): (WebCore::Display::Box::setHorizontalMargin): (WebCore::Display::Box::setVerticalMargin): (WebCore::Display::Box::setHorizontalComputedMargin): (WebCore::Display::Box::setBorder): (WebCore::Display::Box::setPadding): * layout/displaytree/DisplayInlineRect.h: (WebCore::Display::InlineRect::InlineRect): (WebCore::Display::InlineRect::setTopLeft): (WebCore::Display::InlineRect::setTop): (WebCore::Display::InlineRect::setBottom): (WebCore::Display::InlineRect::setLeft): (WebCore::Display::InlineRect::setWidth): (WebCore::Display::InlineRect::setHeight): * layout/displaytree/DisplayLineBox.h: (WebCore::Display::LineBox::LineBox): (WebCore::Display::LineBox::setBaselineOffsetIfGreater): (WebCore::Display::LineBox::resetBaseline): (WebCore::Display::LineBox::Baseline::Baseline): (WebCore::Display::LineBox::Baseline::setAscent): (WebCore::Display::LineBox::Baseline::setDescent): (WebCore::Display::LineBox::Baseline::reset): * layout/displaytree/DisplayRect.h: (WebCore::Display::Rect::Rect): (WebCore::Display::Rect::setTopLeft): (WebCore::Display::Rect::setTop): (WebCore::Display::Rect::setLeft): (WebCore::Display::Rect::setWidth): (WebCore::Display::Rect::setHeight): (WebCore::Display::Rect::setSize): (WebCore::Display::Rect::clone const): * layout/floats/FloatingContext.cpp: * layout/inlineformatting/InlineLineBuilder.cpp: (WebCore::Layout::LineBuilder::CollapsibleContent::collapse): * layout/tableformatting/TableGrid.cpp: (WebCore::Layout::TableGrid::Column::setWidthConstraints): (WebCore::Layout::TableGrid::Column::setLogicalWidth): (WebCore::Layout::TableGrid::Column::setLogicalLeft): * layout/tableformatting/TableGrid.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::continueAfterContentPolicy): (WebCore::DocumentLoader::attachToFrame): (WebCore::DocumentLoader::detachFromFrame): (WebCore::DocumentLoader::addSubresourceLoader): * loader/DocumentLoader.h: * loader/ImageLoader.cpp: * loader/cache/CachedResource.h: * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::lruListFor): (WebCore::MemoryCache::removeFromLRUList): * page/FrameView.cpp: (WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive): * page/FrameViewLayoutContext.cpp: * page/FrameViewLayoutContext.h: * page/Page.cpp: * page/Page.h: * page/ViewportConfiguration.cpp: * page/ViewportConfiguration.h: * page/mac/EventHandlerMac.mm: (WebCore::CurrentEventScope::CurrentEventScope): * platform/DateComponents.cpp: (WebCore::DateComponents::toStringForTime const): * platform/ScrollableArea.cpp: * platform/SharedBuffer.cpp: (WebCore::SharedBuffer::combineIntoOneSegment const): * platform/SharedBuffer.h: * platform/Supplementable.h: * platform/Timer.cpp: (WebCore::TimerBase::checkHeapIndex const): (WebCore::TimerBase::updateHeapIfNeeded): * platform/graphics/BitmapImage.cpp: * platform/graphics/BitmapImage.h: * platform/graphics/Image.h: * platform/graphics/ShadowBlur.cpp: (WebCore::ScratchBuffer::ScratchBuffer): (WebCore::ScratchBuffer::getScratchBuffer): (WebCore::ScratchBuffer::scheduleScratchBufferPurge): * platform/graphics/ca/win/CACFLayerTreeHost.cpp: (WebCore::CACFLayerTreeHost::setWindow): * platform/graphics/ca/win/CACFLayerTreeHost.h: * platform/graphics/cg/ImageBufferDataCG.cpp: (WebCore::ImageBufferData::putData): * platform/graphics/cocoa/FontCacheCoreText.cpp: * platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp: (gstAllocatorFastMallocFree): * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp: (Nicosia::PaintingContextCairo::ForPainting::ForPainting): * platform/graphics/nicosia/texmap/NicosiaBackingStoreTextureMapperImpl.cpp: (Nicosia::BackingStoreTextureMapperImpl::createTile): * platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.cpp: (Nicosia::ContentLayerTextureMapperImpl::~ContentLayerTextureMapperImpl): * platform/graphics/win/GradientDirect2D.cpp: (WebCore::Gradient::fill): * platform/graphics/win/ImageBufferDataDirect2D.cpp: (WebCore::ImageBufferData::putData): * platform/graphics/win/PathDirect2D.cpp: (WebCore::Path::appendGeometry): (WebCore::Path::Path): (WebCore::Path::operator=): (WebCore::Path::strokeContains const): (WebCore::Path::transform): * platform/graphics/win/PlatformContextDirect2D.cpp: (WebCore::PlatformContextDirect2D::setTags): * platform/mediastream/MediaStreamTrackPrivate.h: * platform/mediastream/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::~RealtimeOutgoingAudioSource): * platform/mediastream/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::~RealtimeOutgoingVideoSource): * platform/network/HTTPParsers.cpp: (WebCore::isCrossOriginSafeHeader): * platform/sql/SQLiteDatabase.cpp: * platform/sql/SQLiteDatabase.h: * platform/sql/SQLiteStatement.cpp: (WebCore::SQLiteStatement::SQLiteStatement): (WebCore::SQLiteStatement::prepare): (WebCore::SQLiteStatement::finalize): * platform/sql/SQLiteStatement.h: * platform/win/COMPtr.h: * rendering/ComplexLineLayout.cpp: (WebCore::ComplexLineLayout::removeInlineBox const): * rendering/FloatingObjects.cpp: (WebCore::FloatingObject::FloatingObject): (WebCore::FloatingObjects::addPlacedObject): (WebCore::FloatingObjects::removePlacedObject): * rendering/FloatingObjects.h: * rendering/GridTrackSizingAlgorithm.cpp: * rendering/GridTrackSizingAlgorithm.h: * rendering/LayoutDisallowedScope.cpp: * rendering/LayoutDisallowedScope.h: * rendering/RenderBlock.cpp: * rendering/RenderBlock.h: * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::layoutBlockChild): (WebCore::RenderBlockFlow::removeFloatingObject): (WebCore::RenderBlockFlow::ensureLineBoxes): * rendering/RenderBoxModelObject.cpp: * rendering/RenderDeprecatedFlexibleBox.cpp: (WebCore::RenderDeprecatedFlexibleBox::layoutBlock): * rendering/RenderElement.cpp: * rendering/RenderGeometryMap.cpp: (WebCore::RenderGeometryMap::mapToContainer const): * rendering/RenderGrid.cpp: (WebCore::RenderGrid::placeItemsOnGrid const): (WebCore::RenderGrid::baselinePosition const): * rendering/RenderInline.cpp: (WebCore::RenderInline::willBeDestroyed): * rendering/RenderLayer.cpp: (WebCore::ClipRectsCache::ClipRectsCache): (WebCore::RenderLayer::RenderLayer): (WebCore::RenderLayer::paintList): (WebCore::RenderLayer::hitTestLayer): (WebCore::RenderLayer::updateClipRects): (WebCore::RenderLayer::calculateClipRects const): * rendering/RenderLayer.h: * rendering/RenderLayerBacking.cpp: (WebCore::traverseVisibleNonCompositedDescendantLayers): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::updateBackingAndHierarchy): (WebCore::RenderLayerCompositor::addDescendantsToOverlapMapRecursive const): (WebCore::RenderLayerCompositor::recursiveRepaintLayer): (WebCore::RenderLayerCompositor::layerHas3DContent const): * rendering/RenderLayoutState.cpp: (WebCore::RenderLayoutState::RenderLayoutState): (WebCore::RenderLayoutState::computeOffsets): (WebCore::RenderLayoutState::addLayoutDelta): * rendering/RenderLayoutState.h: (WebCore::RenderLayoutState::RenderLayoutState): * rendering/RenderObject.cpp: (WebCore::RenderObject::RenderObject): (WebCore::RenderObject::~RenderObject): (WebCore::RenderObject::clearNeedsLayout): * rendering/RenderObject.h: * rendering/RenderQuote.cpp: (WebCore::quotesForLanguage): * rendering/RenderTableCell.h: * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::computeOverflowFromCells): * rendering/RenderTextLineBoxes.cpp: (WebCore::RenderTextLineBoxes::checkConsistency const): * rendering/RenderTextLineBoxes.h: * rendering/line/BreakingContext.h: (WebCore::tryHyphenating): * rendering/style/GridArea.h: (WebCore::GridSpan::GridSpan): * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::~RenderStyle): * rendering/style/RenderStyle.h: * rendering/updating/RenderTreeBuilderRuby.cpp: (WebCore::RenderTreeBuilder::Ruby::detach): * rendering/updating/RenderTreePosition.cpp: (WebCore::RenderTreePosition::computeNextSibling): * rendering/updating/RenderTreePosition.h: * svg/SVGToOTFFontConversion.cpp: (WebCore::SVGToOTFFontConverter::Placeholder::Placeholder): (WebCore::SVGToOTFFontConverter::Placeholder::populate): (WebCore::SVGToOTFFontConverter::appendCFFTable): (WebCore::SVGToOTFFontConverter::firstGlyph const): (WebCore::SVGToOTFFontConverter::appendKERNTable): * svg/SVGTransformDistance.cpp: (WebCore::SVGTransformDistance::SVGTransformDistance): (WebCore::SVGTransformDistance::scaledDistance const): (WebCore::SVGTransformDistance::addSVGTransforms): (WebCore::SVGTransformDistance::addToSVGTransform const): (WebCore::SVGTransformDistance::distance const): * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::nativeImage): * testing/InternalSettings.cpp: * workers/service/ServiceWorkerJob.h: * worklets/PaintWorkletGlobalScope.h: (WebCore::PaintWorkletGlobalScope::~PaintWorkletGlobalScope): * xml/XPathStep.cpp: Source/WebKit: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * NetworkProcess/NetworkSession.cpp: (WebKit::NetworkSession::invalidateAndCancel): * NetworkProcess/NetworkSession.h: * NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::setCapacity): * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (toNSURLSessionResponseDisposition): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): * Platform/IPC/Connection.cpp: (IPC::Connection::waitForMessage): * Platform/IPC/MessageReceiver.h: (IPC::MessageReceiver::willBeAddedToMessageReceiverMap): (IPC::MessageReceiver::willBeRemovedFromMessageReceiverMap): * Platform/IPC/cocoa/ConnectionCocoa.mm: (IPC::readFromMachPort): * Platform/mac/MachUtilities.cpp: (setMachExceptionPort): * Shared/API/APIClient.h: (API::Client::Client): * Shared/API/Cocoa/WKRemoteObjectCoder.mm: * Shared/Cocoa/ArgumentCodersCocoa.h: * Shared/SharedStringHashTableReadOnly.cpp: * UIProcess/BackingStore.cpp: (WebKit::BackingStore::incorporateUpdate): * UIProcess/GenericCallback.h: * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::ProcessLauncher::launchProcess): * UIProcess/PageLoadState.h: (WebKit::PageLoadState::Transaction::Token::Token): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::~WebPageProxy): * WebProcess/Network/WebResourceLoader.cpp: (WebKit::WebResourceLoader::didReceiveResponse): * WebProcess/Network/WebResourceLoader.h: * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: (WebKit::NetscapePluginStream::NetscapePluginStream): (WebKit::NetscapePluginStream::notifyAndDestroyStream): * WebProcess/Plugins/Netscape/NetscapePluginStream.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::runModal): * WebProcess/WebProcess.cpp: (WebKit::checkDocumentsCaptureStateConsistency): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::updateProcessName): Source/WebKitLegacy: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * Storage/StorageAreaImpl.cpp: (WebKit::StorageAreaImpl::StorageAreaImpl): (WebKit::StorageAreaImpl::close): * Storage/StorageAreaImpl.h: Source/WebKitLegacy/mac: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * History/WebHistory.mm: (-[WebHistoryPrivate removeItemForURLString:]): * WebView/WebFrame.mm: Source/WebKitLegacy/win: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. * WebKitQuartzCoreAdditions/CAD3DRenderer.cpp: (WKQCA::CAD3DRenderer::swapChain): (WKQCA::CAD3DRenderer::initialize): * WebKitQuartzCoreAdditions/CAD3DRenderer.h: * WebView.cpp: (WebView::Release): * WebView.h: Source/WTF: Convert ASSERT_DISABLED to ASSERT_ENABLED, and fix some tests of NDEBUG that should actually test for ASSERT_ENABLED. https://bugs.webkit.org/show_bug.cgi?id=205776 Reviewed by Saam Barati. This patch did the following changes: 1. Replaced ASSERT_DISABLED with ASSERT_ENABLED. This change does away with the need for the double negative !ASSERT_DISABLED test that is commonly used all over the code, thereby improving code readability. In Assertions.h, there is also BACKTRACE_DISABLED, ASSERT_MSG_DISABLED, ASSERT_ARG_DISABLED, FATAL_DISABLED, ERROR_DISABLED, LOG_DISABLED, and RELEASE_LOG_DISABLED. We should replace those with ..._ENABLED equivalents as well. We'll do that in another patch. For now, they are left as is to minimize the size of this patch. See https://bugs.webkit.org/show_bug.cgi?id=205780. 2. Fixed some code was guarded with "#ifndef NDEBUG" that should actually be guarded by "#if ASSERT_ENABLED" instead. 3. In cases where the change is minimal, we move some code around so that we can test for "#if ASSERT_ENABLED" instead of "#if !ASSERT_ENABLED". * wtf/Assertions.h: * wtf/AutomaticThread.cpp: (WTF::AutomaticThread::start): * wtf/BitVector.h: * wtf/BlockObjCExceptions.mm: (ReportBlockedObjCException): * wtf/BloomFilter.h: * wtf/CallbackAggregator.h: (WTF::CallbackAggregator::CallbackAggregator): * wtf/CheckedArithmetic.h: (WTF::observesOverflow<AssertNoOverflow>): * wtf/CheckedBoolean.h: (CheckedBoolean::CheckedBoolean): (CheckedBoolean::operator bool): * wtf/CompletionHandler.h: (WTF::CompletionHandler<Out): * wtf/DateMath.cpp: (WTF::initializeDates): * wtf/Gigacage.cpp: (Gigacage::tryAllocateZeroedVirtualPages): * wtf/HashTable.h: (WTF::KeyTraits>::checkKey): (WTF::KeyTraits>::checkTableConsistencyExceptSize const): * wtf/LoggerHelper.h: * wtf/NaturalLoops.h: (WTF::NaturalLoops::headerOf const): * wtf/NeverDestroyed.h: (WTF::LazyNeverDestroyed::construct): * wtf/OptionSet.h: (WTF::OptionSet::OptionSet): * wtf/Platform.h: * wtf/PtrTag.h: * wtf/RefCounted.h: (WTF::RefCountedBase::disableThreadingChecks): (WTF::RefCountedBase::enableThreadingChecksGlobally): (WTF::RefCountedBase::RefCountedBase): (WTF::RefCountedBase::applyRefDerefThreadingCheck const): * wtf/SingleRootGraph.h: (WTF::SingleRootGraph::assertIsConsistent const): * wtf/SizeLimits.cpp: * wtf/StackBounds.h: (WTF::StackBounds::checkConsistency const): * wtf/URLParser.cpp: (WTF::URLParser::URLParser): (WTF::URLParser::domainToASCII): * wtf/ValueCheck.h: * wtf/Vector.h: (WTF::Malloc>::checkConsistency): * wtf/WeakHashSet.h: * wtf/WeakPtr.h: (WTF::WeakPtrImpl::WeakPtrImpl): (WTF::WeakPtrFactory::WeakPtrFactory): * wtf/text/AtomStringImpl.cpp: * wtf/text/AtomStringImpl.h: * wtf/text/StringBuilder.cpp: (WTF::StringBuilder::reifyString const): * wtf/text/StringBuilder.h: * wtf/text/StringCommon.h: (WTF::hasPrefixWithLettersIgnoringASCIICaseCommon): * wtf/text/StringHasher.h: (WTF::StringHasher::addCharacters): * wtf/text/StringImpl.h: * wtf/text/SymbolImpl.h: * wtf/text/UniquedStringImpl.h: Tools: Remove WebsiteDataStore::setServiceWorkerRegistrationDirectory https://bugs.webkit.org/show_bug.cgi?id=205754 Patch by Alex Christensen <achristensen@webkit.org> on 2020-01-06 Reviewed by Youenn Fablet. * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm: * WebKitTestRunner/TestController.cpp: (WTR::TestController::websiteDataStore): (WTR::TestController::platformAdjustContext): * WebKitTestRunner/cocoa/TestControllerCocoa.mm: (WTR::initializeWebViewConfiguration): Canonical link: https://commits.webkit.org/218957@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254087 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-06 22:24:50 +00:00
#else
constexpr bool enablePtrTagDebugAssert = false;
#define REPORT_BAD_TAG(success, ptr, expectedTag)
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
#endif
#define WTF_PTRTAG_ASSERT(action, ptr, expectedTag, assertion) \
do { \
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
if constexpr (action == PtrTagAction::ReleaseAssert \
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
|| (WTF::enablePtrTagDebugAssert && action == PtrTagAction::DebugAssert)) { \
bool passed = (assertion); \
REPORT_BAD_TAG(passed, ptr, expectedTag); \
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
RELEASE_ASSERT(passed && #assertion); \
} \
} while (false)
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
#else
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
inline void registerPtrTagLookup(PtrTagLookup*) { }
inline void reportBadTag(const void*, PtrTag) { }
Remove Gigacage from arm64 and use PAC for arm64e instead https://bugs.webkit.org/show_bug.cgi?id=197110 Reviewed by Saam Barati. Source/bmalloc: Stop using gigacage on arm64 and add a new cage function cagedMayBeNull that is the same as cage but returns a nullptr if the incoming pointer is already null. * bmalloc/Gigacage.h: (Gigacage::cagedMayBeNull): Source/JavaScriptCore: This patch makes a bunch of changes. I'll start with global changes then go over changes to each tier and finish with bug fixes. Global Changes: Change CagedBarrierPtr to work with PAC so constructors and accessors now expect to receive a length. Update assembler helper methods to use do PAC when caging. LLInt: Add arm64e.rb backend as we missed that when originally open sourcing our arm64e code. Add a new optional t6 temporary, which is only used currently on arm64e for GetByVal on a TypedArray. Refactor caging into two helper macros for Primitive/JSValue cages. Baseline/DFG: Add authentication where needed for GetByVal and inline object construction. FTL: Add a new ValueRep that allows for a late register use. We want this for the authentication patchpoint since we use the length register at the same time as we are defing the authenticated pointer. Wasm: Use the TaggedArrayStoragePtr class for the memory base pointer. In theory we should be caging those pointers but I don't want to risk introducing a performance regression with the rest of this change. I've filed https://bugs.webkit.org/show_bug.cgi?id=197620 to do this later. As we no longer have the Gigacage using most of our VA memory, we can enable fast memories on iOS. Using fast memories leads to roughly a 2% JetStream2 speedup. * assembler/MacroAssemblerARM64E.h: (JSC::MacroAssemblerARM64E::tagArrayPtr): (JSC::MacroAssemblerARM64E::untagArrayPtr): (JSC::MacroAssemblerARM64E::removeArrayPtrTag): * b3/B3LowerToAir.cpp: * b3/B3PatchpointSpecial.cpp: (JSC::B3::PatchpointSpecial::admitsStack): * b3/B3StackmapSpecial.cpp: (JSC::B3::StackmapSpecial::forEachArgImpl): (JSC::B3::StackmapSpecial::isArgValidForRep): * b3/B3Validate.cpp: * b3/B3ValueRep.cpp: (JSC::B3::ValueRep::addUsedRegistersTo const): (JSC::B3::ValueRep::dump const): (WTF::printInternal): * b3/B3ValueRep.h: (JSC::B3::ValueRep::ValueRep): (JSC::B3::ValueRep::isReg const): * dfg/DFGOperations.cpp: (JSC::DFG::newTypedArrayWithSize): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::jumpForTypedArrayIsNeuteredIfOutOfBounds): (JSC::DFG::SpeculativeJIT::cageTypedArrayStorage): (JSC::DFG::SpeculativeJIT::compileGetIndexedPropertyStorage): (JSC::DFG::SpeculativeJIT::compileGetTypedArrayByteOffset): (JSC::DFG::SpeculativeJIT::compileNewTypedArrayWithSize): * dfg/DFGSpeculativeJIT.h: * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileGetIndexedPropertyStorage): (JSC::FTL::DFG::LowerDFGToB3::compileGetTypedArrayByteOffset): (JSC::FTL::DFG::LowerDFGToB3::compileNewTypedArray): (JSC::FTL::DFG::LowerDFGToB3::compileDataViewGet): (JSC::FTL::DFG::LowerDFGToB3::compileDataViewSet): (JSC::FTL::DFG::LowerDFGToB3::untagArrayPtr): (JSC::FTL::DFG::LowerDFGToB3::caged): (JSC::FTL::DFG::LowerDFGToB3::speculateTypedArrayIsNotNeutered): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::cageConditionally): * jit/IntrinsicEmitter.cpp: (JSC::IntrinsicGetterAccessCase::emitIntrinsicGetter): * jit/JITPropertyAccess.cpp: (JSC::JIT::emitDirectArgumentsGetByVal): (JSC::JIT::emitIntTypedArrayGetByVal): (JSC::JIT::emitFloatTypedArrayGetByVal): (JSC::JIT::emitIntTypedArrayPutByVal): (JSC::JIT::emitFloatTypedArrayPutByVal): * jit/PolymorphicCallStubRoutine.cpp: (JSC::PolymorphicCallNode::clearCallLinkInfo): * llint/LowLevelInterpreter64.asm: * offlineasm/arm64.rb: * offlineasm/arm64e.rb: Added. * offlineasm/ast.rb: * offlineasm/instructions.rb: * offlineasm/registers.rb: * offlineasm/x86.rb: * runtime/ArrayBuffer.cpp: (JSC::SharedArrayBufferContents::SharedArrayBufferContents): (JSC::SharedArrayBufferContents::~SharedArrayBufferContents): (JSC::ArrayBufferContents::ArrayBufferContents): (JSC::ArrayBufferContents::destroy): (JSC::ArrayBufferContents::tryAllocate): (JSC::ArrayBufferContents::makeShared): (JSC::ArrayBufferContents::copyTo): * runtime/ArrayBuffer.h: (JSC::SharedArrayBufferContents::data const): (JSC::ArrayBufferContents::data const): (JSC::ArrayBuffer::data): (JSC::ArrayBuffer::data const): (JSC::ArrayBuffer::byteLength const): * runtime/ArrayBufferView.cpp: (JSC::ArrayBufferView::ArrayBufferView): * runtime/ArrayBufferView.h: (JSC::ArrayBufferView::baseAddress const): (JSC::ArrayBufferView::byteLength const): (JSC::ArrayBufferView::setRangeImpl): (JSC::ArrayBufferView::getRangeImpl): * runtime/CachedTypes.cpp: (JSC::CachedScopedArgumentsTable::encode): (JSC::CachedScopedArgumentsTable::decode const): * runtime/CagedBarrierPtr.h: (JSC::CagedBarrierPtr::CagedBarrierPtr): (JSC::CagedBarrierPtr::set): (JSC::CagedBarrierPtr::get const): (JSC::CagedBarrierPtr::getMayBeNull const): (JSC::CagedBarrierPtr::getUnsafe const): (JSC::CagedBarrierPtr::at const): (JSC::CagedBarrierPtr::operator== const): (JSC::CagedBarrierPtr::operator bool const): (JSC::CagedBarrierPtr::setWithoutBarrier): (JSC::CagedBarrierPtr::operator* const): Deleted. (JSC::CagedBarrierPtr::operator-> const): Deleted. (JSC::CagedBarrierPtr::operator[] const): Deleted. (): Deleted. * runtime/DataView.cpp: (JSC::DataView::DataView): * runtime/DataView.h: (JSC::DataView::get): (JSC::DataView::set): * runtime/DirectArguments.cpp: (JSC::DirectArguments::visitChildren): (JSC::DirectArguments::overrideThings): (JSC::DirectArguments::unmapArgument): * runtime/DirectArguments.h: * runtime/GenericArguments.h: * runtime/GenericArgumentsInlines.h: (JSC::GenericArguments<Type>::visitChildren): (JSC::GenericArguments<Type>::initModifiedArgumentsDescriptor): (JSC::GenericArguments<Type>::setModifiedArgumentDescriptor): (JSC::GenericArguments<Type>::isModifiedArgumentDescriptor): * runtime/GenericTypedArrayView.h: * runtime/GenericTypedArrayViewInlines.h: (JSC::GenericTypedArrayView<Adaptor>::GenericTypedArrayView): * runtime/JSArrayBufferView.cpp: (JSC::JSArrayBufferView::ConstructionContext::ConstructionContext): (JSC::JSArrayBufferView::JSArrayBufferView): (JSC::JSArrayBufferView::finalize): (JSC::JSArrayBufferView::slowDownAndWasteMemory): * runtime/JSArrayBufferView.h: (JSC::JSArrayBufferView::ConstructionContext::vector const): (JSC::JSArrayBufferView::isNeutered): (JSC::JSArrayBufferView::hasVector const): (JSC::JSArrayBufferView::vector const): * runtime/JSGenericTypedArrayViewInlines.h: (JSC::JSGenericTypedArrayView<Adaptor>::createUninitialized): (JSC::JSGenericTypedArrayView<Adaptor>::estimatedSize): (JSC::JSGenericTypedArrayView<Adaptor>::visitChildren): * runtime/Options.h: * runtime/ScopedArgumentsTable.cpp: (JSC::ScopedArgumentsTable::clone): (JSC::ScopedArgumentsTable::setLength): * runtime/ScopedArgumentsTable.h: * runtime/SymbolTable.h: * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::restoreWebAssemblyGlobalState): (JSC::Wasm::AirIRGenerator::addCallIndirect): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::restoreWebAssemblyGlobalState): (JSC::Wasm::B3IRGenerator::addCallIndirect): * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::complete): * wasm/WasmBinding.cpp: (JSC::Wasm::wasmToWasm): * wasm/WasmInstance.h: (JSC::Wasm::Instance::cachedMemory const): (JSC::Wasm::Instance::updateCachedMemory): * wasm/WasmMemory.cpp: (JSC::Wasm::Memory::Memory): (JSC::Wasm::Memory::~Memory): (JSC::Wasm::Memory::grow): (JSC::Wasm::Memory::dump const): * wasm/WasmMemory.h: (JSC::Wasm::Memory::memory const): * wasm/js/JSToWasm.cpp: (JSC::Wasm::createJSToWasmWrapper): * wasm/js/WebAssemblyFunction.cpp: (JSC::WebAssemblyFunction::jsCallEntrypointSlow): Source/WTF: This patch changes the Gigacage to use PAC on arm64e. As part of this process all platforms must provide their length when materializing the caged pointer. Since it would be somewhat confusing to have two parameters for an operator [] those methods have been removed. Lastly, this patch removes the specializations for void* caged pointers, instead opting to use enable_if on the methods that would normally fail on void* e.g. anything that returns a T&. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/CagedPtr.h: (WTF::CagedPtr::CagedPtr): (WTF::CagedPtr::get const): (WTF::CagedPtr::getMayBeNull const): (WTF::CagedPtr::getUnsafe const): (WTF::CagedPtr::at const): (WTF::CagedPtr::reauthenticate): (WTF::CagedPtr::operator=): (WTF::CagedPtr::operator== const): (WTF::CagedPtr::operator bool const): (WTF::CagedPtr::operator* const): Deleted. (WTF::CagedPtr::operator-> const): Deleted. (WTF::CagedPtr::operator[] const): Deleted. (): Deleted. * wtf/CagedUniquePtr.h: (WTF::CagedUniquePtr::CagedUniquePtr): (WTF::CagedUniquePtr::create): (WTF::CagedUniquePtr::~CagedUniquePtr): (WTF::CagedUniquePtr::destroy): (): Deleted. * wtf/Gigacage.h: (Gigacage::cagedMayBeNull): * wtf/PtrTag.h: (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): * wtf/TaggedArrayStoragePtr.h: Copied from Source/JavaScriptCore/runtime/ArrayBufferView.cpp. (WTF::TaggedArrayStoragePtr::TaggedArrayStoragePtr): (WTF::TaggedArrayStoragePtr::get const): (WTF::TaggedArrayStoragePtr::getUnsafe const): (WTF::TaggedArrayStoragePtr::resize): (WTF::TaggedArrayStoragePtr::operator bool const): Canonical link: https://commits.webkit.org/211843@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245064 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-08 20:07:53 +00:00
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
#define WTF_PTRTAG_ASSERT(action, ptr, expectedTag, assertion) \
do { \
if constexpr (action == PtrTagAction::ReleaseAssert) { \
UNUSED_PARAM(ptr); \
RELEASE_ASSERT(assertion); \
} \
} while (false)
#endif
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
enum class PtrTagAction {
ReleaseAssert,
DebugAssert,
NoAssert,
};
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
constexpr PtrTag AnyPtrTag = static_cast<PtrTag>(-1); // Only used for assertion messages.
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
inline constexpr T removeCodePtrTag(PtrType ptr)
{
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
#if CPU(ARM64E)
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
return bitwise_cast<T>(ptrauth_strip(ptr, ptrauth_key_process_dependent_code));
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
#else
return bitwise_cast<T>(ptr);
#endif
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
}
template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
inline constexpr PtrType removeCodePtrTag(PtrType ptr)
{
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
#if CPU(ARM64E)
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
return ptrauth_strip(ptr, ptrauth_key_process_dependent_code);
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
#else
return ptr;
#endif
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
}
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
template<PtrTagAction tagAction, PtrTag tag, typename PtrType>
inline PtrType tagCodePtrImpl(PtrType ptr)
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
{
if (!ptr)
return nullptr;
WTF_PTRTAG_ASSERT(tagAction, ptr, NoPtrTag, removeCodePtrTag(ptr) == ptr);
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
return PtrTagTraits<tag>::tagCodePtr(ptr);
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
}
template<typename T, PtrTag tag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
inline T tagCodePtr(PtrType ptr)
{
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
return bitwise_cast<T>(tagCodePtrImpl<PtrTagAction::DebugAssert, tag>(ptr));
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
}
template<PtrTag tag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
inline PtrType tagCodePtr(PtrType ptr) { return tagCodePtrImpl<PtrTagAction::DebugAssert, tag>(ptr); }
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
template<PtrTagAction tagAction, PtrTag tag, typename PtrType>
inline PtrType untagCodePtrImpl(PtrType ptr)
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
{
if (!ptr)
return nullptr;
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
PtrType result = PtrTagTraits<tag>::untagCodePtr(ptr);
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
WTF_PTRTAG_ASSERT(tagAction, ptr, tag, removeCodePtrTag(ptr) == result);
return result;
}
template<typename T, PtrTag tag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
inline T untagCodePtr(PtrType ptr)
{
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
return bitwise_cast<T>(untagCodePtrImpl<PtrTagAction::DebugAssert, tag>(ptr));
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
}
template<PtrTag tag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
inline PtrType untagCodePtr(PtrType ptr) { return untagCodePtrImpl<PtrTagAction::DebugAssert, tag>(ptr); }
Unreviewed, reland r268170 https://bugs.webkit.org/show_bug.cgi?id=217460 Source/JavaScriptCore: Fixed missing wrong OperationPtrTag use in Repatch.cpp. * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::getLinkerAddress): * assembler/AssemblerBuffer.h: (JSC::ARM64EHash::update): (JSC::ARM64EHash::finalHash const): * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/MacroAssemblerARM64.cpp: (JSC::MacroAssembler::probe): * assembler/MacroAssemblerCodeRef.h: (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): (JSC::MacroAssemblerCodePtr::createFromExecutableAddress): * assembler/testmasm.cpp: (JSC::testProbeModifiesProgramCounter): * b3/air/testair.cpp: * ftl/FTLOutput.h: (JSC::FTL::Output::callWithoutSideEffects): (JSC::FTL::Output::operation): * ftl/FTLSlowPathCall.cpp: (JSC::FTL::SlowPathCallContext::makeCall): * jit/JITCode.cpp: (JSC::JITCodeWithCodeRef::executableAddressAtOffset): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITOperations.cpp: * jit/Repatch.cpp: (JSC::readPutICCallTarget): (JSC::ftlThunkAwareRepatchCall): (JSC::tryCacheGetBy): (JSC::tryCachePutByID): * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntPCRanges.h: (JSC::LLInt::isLLIntPC): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::setUpCall): * llint/LLIntThunks.cpp: (JSC::LLInt::generateThunkWithJumpTo): * runtime/JSCPtrTag.h: * runtime/MachineContext.h: (JSC::MachineContext::instructionPointer): * runtime/NativeExecutable.cpp: (JSC::NativeExecutable::finishCreation): * runtime/PutPropertySlot.h: (JSC::PutPropertySlot::setCustomValue): (JSC::PutPropertySlot::setCustomAccessor): (JSC::PutPropertySlot::customSetter const): * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::emitCCall): * wasm/WasmSlowPaths.cpp: Source/WTF: * wtf/PlatformRegisters.cpp: (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PtrTag.h: (WTF::tagCodePtr): (WTF::untagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtr): (WTF::tagInt): Canonical link: https://commits.webkit.org/230280@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268247 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 05:08:11 +00:00
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
template<PtrTagAction tagAction, PtrTag oldTag, PtrTag newTag, typename PtrType>
inline PtrType retagCodePtrImplHelper(PtrType ptr)
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
{
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
if constexpr (oldTag == newTag || (oldTag == NoPtrTag && newTag == NoPtrTag))
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
return ptr;
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
if constexpr (newTag == NoPtrTag)
return untagCodePtrImpl<tagAction, oldTag>(ptr);
if constexpr (oldTag == NoPtrTag)
return tagCodePtrImpl<tagAction, newTag>(ptr);
#if CPU(ARM64E)
if constexpr (PtrTagTraits<oldTag>::isSpecialized || PtrTagTraits<newTag>::isSpecialized)
return tagCodePtrImpl<tagAction, newTag>(untagCodePtrImpl<tagAction, oldTag>(ptr));
if constexpr (oldTag == CFunctionPtrTag)
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
return ptrauth_auth_and_resign(ptr, ptrauth_key_function_pointer, 0, ptrauth_key_process_dependent_code, newTag);
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
if constexpr (newTag == CFunctionPtrTag)
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
return ptrauth_auth_and_resign(ptr, ptrauth_key_process_dependent_code, oldTag, ptrauth_key_function_pointer, 0);
return ptrauth_auth_and_resign(ptr, ptrauth_key_process_dependent_code, oldTag, ptrauth_key_process_dependent_code, newTag);
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
#else
return tagCodePtrImpl<tagAction, newTag>(untagCodePtrImpl<tagAction, oldTag>(ptr));
#endif
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
}
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
template<PtrTagAction tagAction, PtrTag oldTag, PtrTag newTag, typename PtrType>
inline PtrType retagCodePtrImpl(PtrType ptr)
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
{
if (!ptr)
return nullptr;
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
WTF_PTRTAG_ASSERT(tagAction, ptr, oldTag, ptr == (tagCodePtrImpl<PtrTagAction::NoAssert, oldTag>(removeCodePtrTag(ptr))));
PtrType result = retagCodePtrImplHelper<tagAction, oldTag, newTag>(ptr);
WTF_PTRTAG_ASSERT(tagAction, ptr, newTag, result == (tagCodePtrImpl<PtrTagAction::NoAssert, newTag>(removeCodePtrTag(ptr))));
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
return result;
}
template<typename T, PtrTag oldTag, PtrTag newTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
inline T retagCodePtr(PtrType ptr)
{
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
return bitwise_cast<T>(retagCodePtrImpl<PtrTagAction::DebugAssert, oldTag, newTag>(ptr));
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
}
template<PtrTag oldTag, PtrTag newTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
inline PtrType retagCodePtr(PtrType ptr) { return retagCodePtrImpl<PtrTagAction::DebugAssert, oldTag, newTag>(ptr); }
[Re-landing] Prepare LLInt code to support pointer profiling. https://bugs.webkit.org/show_bug.cgi?id=183387 <rdar://problem/38199678> Reviewed by JF Bastien. Source/JavaScriptCore: 1. Introduced PtrTag enums for supporting pointer profiling later. 2. Also introduced tagging, untagging, retagging, and tag removal placeholder template functions for the same purpose. 3. Prepare the offlineasm for supporting pointer profiling later. 4. Tagged some pointers in LLInt asm code. Currently, these should have no effect on behavior. 5. Removed returnToThrowForThrownException() because it is not used anywhere. 6. Added the offlineasm folder to JavaScriptCore Xcode project so that it's easier to view and edit these files in Xcode. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/LLIntCallLinkInfo.h: (JSC::LLIntCallLinkInfo::unlink): * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntData.h: * llint/LLIntExceptions.cpp: (JSC::LLInt::returnToThrowForThrownException): Deleted. * llint/LLIntExceptions.h: * llint/LLIntOfflineAsmConfig.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: (JSC::LLInt::isLLIntPC): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::handleHostCall): (JSC::LLInt::setUpCall): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * offlineasm/ast.rb: * offlineasm/instructions.rb: * offlineasm/risc.rb: * runtime/PtrTag.h: Added. (JSC::uniquePtrTagID): (JSC::ptrTag): (JSC::tagCodePtr): (JSC::untagCodePtr): (JSC::retagCodePtr): (JSC::removeCodePtrTag): Source/WTF: * wtf/Platform.h: Canonical link: https://commits.webkit.org/199183@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-03-09 21:35:17 +00:00
Unreviewed, reland r268170 https://bugs.webkit.org/show_bug.cgi?id=217460 Source/JavaScriptCore: Fixed missing wrong OperationPtrTag use in Repatch.cpp. * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::getLinkerAddress): * assembler/AssemblerBuffer.h: (JSC::ARM64EHash::update): (JSC::ARM64EHash::finalHash const): * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/MacroAssemblerARM64.cpp: (JSC::MacroAssembler::probe): * assembler/MacroAssemblerCodeRef.h: (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): (JSC::MacroAssemblerCodePtr::createFromExecutableAddress): * assembler/testmasm.cpp: (JSC::testProbeModifiesProgramCounter): * b3/air/testair.cpp: * ftl/FTLOutput.h: (JSC::FTL::Output::callWithoutSideEffects): (JSC::FTL::Output::operation): * ftl/FTLSlowPathCall.cpp: (JSC::FTL::SlowPathCallContext::makeCall): * jit/JITCode.cpp: (JSC::JITCodeWithCodeRef::executableAddressAtOffset): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITOperations.cpp: * jit/Repatch.cpp: (JSC::readPutICCallTarget): (JSC::ftlThunkAwareRepatchCall): (JSC::tryCacheGetBy): (JSC::tryCachePutByID): * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntPCRanges.h: (JSC::LLInt::isLLIntPC): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::setUpCall): * llint/LLIntThunks.cpp: (JSC::LLInt::generateThunkWithJumpTo): * runtime/JSCPtrTag.h: * runtime/MachineContext.h: (JSC::MachineContext::instructionPointer): * runtime/NativeExecutable.cpp: (JSC::NativeExecutable::finishCreation): * runtime/PutPropertySlot.h: (JSC::PutPropertySlot::setCustomValue): (JSC::PutPropertySlot::setCustomAccessor): (JSC::PutPropertySlot::customSetter const): * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::emitCCall): * wasm/WasmSlowPaths.cpp: Source/WTF: * wtf/PlatformRegisters.cpp: (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PtrTag.h: (WTF::tagCodePtr): (WTF::untagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtr): (WTF::tagInt): Canonical link: https://commits.webkit.org/230280@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268247 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 05:08:11 +00:00
template<typename PtrType>
void assertIsCFunctionPtr(PtrType value)
{
void* ptr = bitwise_cast<void*>(value);
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
WTF_PTRTAG_ASSERT(PtrTagAction::DebugAssert, ptr, CFunctionPtrTag, ptr == (tagCodePtrImpl<PtrTagAction::NoAssert, CFunctionPtrTag>(removeCodePtrTag(ptr))));
Unreviewed, reland r268170 https://bugs.webkit.org/show_bug.cgi?id=217460 Source/JavaScriptCore: Fixed missing wrong OperationPtrTag use in Repatch.cpp. * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::getLinkerAddress): * assembler/AssemblerBuffer.h: (JSC::ARM64EHash::update): (JSC::ARM64EHash::finalHash const): * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/MacroAssemblerARM64.cpp: (JSC::MacroAssembler::probe): * assembler/MacroAssemblerCodeRef.h: (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): (JSC::MacroAssemblerCodePtr::createFromExecutableAddress): * assembler/testmasm.cpp: (JSC::testProbeModifiesProgramCounter): * b3/air/testair.cpp: * ftl/FTLOutput.h: (JSC::FTL::Output::callWithoutSideEffects): (JSC::FTL::Output::operation): * ftl/FTLSlowPathCall.cpp: (JSC::FTL::SlowPathCallContext::makeCall): * jit/JITCode.cpp: (JSC::JITCodeWithCodeRef::executableAddressAtOffset): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITOperations.cpp: * jit/Repatch.cpp: (JSC::readPutICCallTarget): (JSC::ftlThunkAwareRepatchCall): (JSC::tryCacheGetBy): (JSC::tryCachePutByID): * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntPCRanges.h: (JSC::LLInt::isLLIntPC): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::setUpCall): * llint/LLIntThunks.cpp: (JSC::LLInt::generateThunkWithJumpTo): * runtime/JSCPtrTag.h: * runtime/MachineContext.h: (JSC::MachineContext::instructionPointer): * runtime/NativeExecutable.cpp: (JSC::NativeExecutable::finishCreation): * runtime/PutPropertySlot.h: (JSC::PutPropertySlot::setCustomValue): (JSC::PutPropertySlot::setCustomAccessor): (JSC::PutPropertySlot::customSetter const): * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::emitCCall): * wasm/WasmSlowPaths.cpp: Source/WTF: * wtf/PlatformRegisters.cpp: (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PtrTag.h: (WTF::tagCodePtr): (WTF::untagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtr): (WTF::tagInt): Canonical link: https://commits.webkit.org/230280@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268247 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 05:08:11 +00:00
}
template<typename PtrType>
void assertIsNullOrCFunctionPtr(PtrType ptr)
{
if (ptr)
assertIsCFunctionPtr(ptr);
}
template<typename PtrType>
void assertIsNotTagged(PtrType value)
{
void* ptr = bitwise_cast<void*>(value);
WTF_PTRTAG_ASSERT(PtrTagAction::DebugAssert, ptr, NoPtrTag, ptr == removeCodePtrTag(ptr));
}
template<PtrTag tag, typename PtrType>
bool isTaggedWith(PtrType value)
{
void* ptr = bitwise_cast<void*>(value);
if (tag == NoPtrTag)
return ptr == removeCodePtrTag(ptr);
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
return ptr == tagCodePtrImpl<PtrTagAction::NoAssert, tag>(removeCodePtrTag(ptr));
Unreviewed, reland r268170 https://bugs.webkit.org/show_bug.cgi?id=217460 Source/JavaScriptCore: Fixed missing wrong OperationPtrTag use in Repatch.cpp. * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::getLinkerAddress): * assembler/AssemblerBuffer.h: (JSC::ARM64EHash::update): (JSC::ARM64EHash::finalHash const): * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/MacroAssemblerARM64.cpp: (JSC::MacroAssembler::probe): * assembler/MacroAssemblerCodeRef.h: (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): (JSC::MacroAssemblerCodePtr::createFromExecutableAddress): * assembler/testmasm.cpp: (JSC::testProbeModifiesProgramCounter): * b3/air/testair.cpp: * ftl/FTLOutput.h: (JSC::FTL::Output::callWithoutSideEffects): (JSC::FTL::Output::operation): * ftl/FTLSlowPathCall.cpp: (JSC::FTL::SlowPathCallContext::makeCall): * jit/JITCode.cpp: (JSC::JITCodeWithCodeRef::executableAddressAtOffset): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITOperations.cpp: * jit/Repatch.cpp: (JSC::readPutICCallTarget): (JSC::ftlThunkAwareRepatchCall): (JSC::tryCacheGetBy): (JSC::tryCachePutByID): * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntPCRanges.h: (JSC::LLInt::isLLIntPC): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::setUpCall): * llint/LLIntThunks.cpp: (JSC::LLInt::generateThunkWithJumpTo): * runtime/JSCPtrTag.h: * runtime/MachineContext.h: (JSC::MachineContext::instructionPointer): * runtime/NativeExecutable.cpp: (JSC::NativeExecutable::finishCreation): * runtime/PutPropertySlot.h: (JSC::PutPropertySlot::setCustomValue): (JSC::PutPropertySlot::setCustomAccessor): (JSC::PutPropertySlot::customSetter const): * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::emitCCall): * wasm/WasmSlowPaths.cpp: Source/WTF: * wtf/PlatformRegisters.cpp: (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PtrTag.h: (WTF::tagCodePtr): (WTF::untagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtr): (WTF::tagInt): Canonical link: https://commits.webkit.org/230280@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268247 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 05:08:11 +00:00
}
template<PtrTag tag, typename PtrType>
void assertIsTaggedWith(PtrType value)
{
[JSC] Add JITCage support https://bugs.webkit.org/show_bug.cgi?id=218143 Reviewed by Saam Barati. Source/JavaScriptCore: Towards software verified JIT, this patch adds partial JIT-Caging support which cages JIT call / jumps in a certain format. This is currently only enabled when internal SDK is enabled. And it is only enabled in ARM64E for now. Currently, this patch does not have CSS JIT support. Subsequent patch will add it. We ensured that JS2 and RAMification are neutral. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/JITOperationList.cpp: (JSC::addPointers): (JSC::JITOperationList::populatePointersInJavaScriptCoreForLLInt): * assembler/JITOperationList.h: (JSC::JITOperationList::map const): (JSC::JITOperationList::assertIsHostFunction): (JSC::JITOperationList::assertIsJITOperation): (JSC::JITOperationList::contains const): Deleted. * assembler/MacroAssemblerARM64.h: (JSC::MacroAssemblerARM64::farJump): * assembler/MacroAssemblerARM64E.h: (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::farJumpRegister): (JSC::MacroAssemblerARM64E::farJump): (JSC::MacroAssemblerARM64E::ret): * assembler/MacroAssemblerARMv7.h: (JSC::MacroAssemblerARMv7::farJump): * assembler/MacroAssemblerMIPS.h: (JSC::MacroAssemblerMIPS::farJump): * assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::farJump): * bytecode/BytecodeList.rb: * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::callerReturnPC): (JSC::DFG::adjustAndJumpToTarget): * dfg/DFGOSRExitCompilerCommon.h: * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::setJITEnabled): (JSC::initializeJITPageReservation): * jit/GPRInfo.h: * jit/PolymorphicCallStubRoutine.cpp: (JSC::PolymorphicCallNode::unlink): * jit/ThunkGenerators.cpp: (JSC::emitPointerValidation): * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntData.h: (JSC::LLInt::getOpcode): (JSC::LLInt::getOpcodeWide16): (JSC::LLInt::getOpcodeWide32): (JSC::LLInt::getCodePtr): (JSC::LLInt::getWide16CodePtr): (JSC::LLInt::getWide32CodePtr): (JSC::LLInt::getCodeFunctionPtr): (JSC::LLInt::getWide16CodeFunctionPtr): (JSC::LLInt::getWide32CodeFunctionPtr): * llint/LLIntEntrypoint.cpp: (JSC::LLInt::entrypointTrampoline): (JSC::LLInt::setFunctionEntrypoint): (JSC::LLInt::setEvalEntrypoint): (JSC::LLInt::setProgramEntrypoint): (JSC::LLInt::setModuleProgramEntrypoint): (JSC::LLInt::getHostCallReturnValueEntrypoint): (JSC::LLInt::fuzzerReturnEarlyFromLoopHintEntrypoint): (JSC::LLInt::genericReturnPointEntrypoint): * llint/LLIntEntrypoint.h: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::commonCallEval): (JSC::LLInt::dispatchToNextInstruction): * llint/LLIntThunks.cpp: (JSC::LLInt::generateThunkWithJumpTo): (JSC::LLInt::generateThunkWithJumpToPrologue): (JSC::LLInt::generateThunkWithJumpToLLIntReturnPoint): (JSC::LLInt::functionForCallEntryThunk): (JSC::LLInt::functionForConstructEntryThunk): (JSC::LLInt::functionForCallArityCheckThunk): (JSC::LLInt::functionForConstructArityCheckThunk): (JSC::LLInt::evalEntryThunk): (JSC::LLInt::programEntryThunk): (JSC::LLInt::moduleProgramEntryThunk): (JSC::LLInt::wasmFunctionEntryThunk): (JSC::LLInt::handleCatchThunk): (JSC::LLInt::genericReturnPointThunk): (JSC::LLInt::fuzzerReturnEarlyFromLoopHintThunk): (JSC::LLInt::createJSGateThunk): (JSC::LLInt::createWasmGateThunk): (JSC::LLInt::createTailCallGate): (JSC::LLInt::loopOSREntryGateThunk): (JSC::LLInt::entryOSREntryGateThunk): (JSC::LLInt::wasmOSREntryGateThunk): (JSC::LLInt::exceptionHandlerGateThunk): (JSC::LLInt::returnFromLLIntGateThunk): (JSC::LLInt::tagGateThunk): (JSC::LLInt::untagGateThunk): (JSC::LLInt::jitCagePtrThunk): (JSC::LLInt::normalOSRExitTrampolineThunk): (JSC::LLInt::checkpointOSRExitTrampolineThunk): (JSC::LLInt::checkpointOSRExitFromInlinedCallTrampolineThunk): (JSC::LLInt::returnLocationThunk): * llint/LLIntThunks.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * llint/WebAssembly.asm: * offlineasm/arm64.rb: * offlineasm/mips.rb: * runtime/Gate.h: Added. * runtime/JSCConfig.h: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::callerType): (JSC::calleeType): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): (JSC::tagCodePtrWithStackPointerForJITCall): (JSC::untagCodePtrWithStackPointerForJITCall): * runtime/MatchResult.h: (JSC::MatchResult::MatchResult): * runtime/Options.cpp: (JSC::disableAllJITOptions): (JSC::canUseJITCage): * runtime/OptionsList.h: * wasm/WasmSlowPaths.cpp: * yarr/YarrJIT.cpp: * yarr/YarrJIT.h: (JSC::Yarr::YarrCodeBlock::execute): Source/WTF: * wtf/OSAllocator.h: (WTF::OSAllocator::reserveAndCommit): (WTF::OSAllocator::reallocateCommitted): * wtf/PageReservation.h: (WTF::PageReservation::reserve): (WTF::PageReservation::reserveWithGuardPages): (WTF::PageReservation::reserveAndCommitWithGuardPages): (WTF::PageReservation::PageReservation): * wtf/PlatformEnable.h: * wtf/PlatformUse.h: * wtf/PtrTag.h: (WTF::assertIsTaggedWith): (WTF::tagCodePtrWithStackPointerForJITCall): Deleted. (WTF::untagCodePtrWithStackPointerForJITCall): Deleted. * wtf/posix/OSAllocatorPOSIX.cpp: (WTF::OSAllocator::reserveUncommitted): (WTF::OSAllocator::reserveAndCommit): * wtf/win/OSAllocatorWin.cpp: (WTF::OSAllocator::reserveUncommitted): (WTF::OSAllocator::reserveAndCommit): Canonical link: https://commits.webkit.org/231193@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269349 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-04 02:31:56 +00:00
UNUSED_PARAM(value);
Unreviewed, reland r268170 https://bugs.webkit.org/show_bug.cgi?id=217460 Source/JavaScriptCore: Fixed missing wrong OperationPtrTag use in Repatch.cpp. * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::getLinkerAddress): * assembler/AssemblerBuffer.h: (JSC::ARM64EHash::update): (JSC::ARM64EHash::finalHash const): * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/MacroAssemblerARM64.cpp: (JSC::MacroAssembler::probe): * assembler/MacroAssemblerCodeRef.h: (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): (JSC::MacroAssemblerCodePtr::createFromExecutableAddress): * assembler/testmasm.cpp: (JSC::testProbeModifiesProgramCounter): * b3/air/testair.cpp: * ftl/FTLOutput.h: (JSC::FTL::Output::callWithoutSideEffects): (JSC::FTL::Output::operation): * ftl/FTLSlowPathCall.cpp: (JSC::FTL::SlowPathCallContext::makeCall): * jit/JITCode.cpp: (JSC::JITCodeWithCodeRef::executableAddressAtOffset): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITOperations.cpp: * jit/Repatch.cpp: (JSC::readPutICCallTarget): (JSC::ftlThunkAwareRepatchCall): (JSC::tryCacheGetBy): (JSC::tryCachePutByID): * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntPCRanges.h: (JSC::LLInt::isLLIntPC): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::setUpCall): * llint/LLIntThunks.cpp: (JSC::LLInt::generateThunkWithJumpTo): * runtime/JSCPtrTag.h: * runtime/MachineContext.h: (JSC::MachineContext::instructionPointer): * runtime/NativeExecutable.cpp: (JSC::NativeExecutable::finishCreation): * runtime/PutPropertySlot.h: (JSC::PutPropertySlot::setCustomValue): (JSC::PutPropertySlot::setCustomAccessor): (JSC::PutPropertySlot::customSetter const): * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::emitCCall): * wasm/WasmSlowPaths.cpp: Source/WTF: * wtf/PlatformRegisters.cpp: (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PtrTag.h: (WTF::tagCodePtr): (WTF::untagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtr): (WTF::tagInt): Canonical link: https://commits.webkit.org/230280@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268247 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 05:08:11 +00:00
WTF_PTRTAG_ASSERT(PtrTagAction::DebugAssert, value, tag, isTaggedWith<tag>(value));
}
template<PtrTag tag, typename PtrType>
void assertIsNullOrTaggedWith(PtrType ptr)
{
if (ptr)
assertIsTaggedWith<tag>(ptr);
}
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
template<PtrTagAction tagAction, PtrTag tag, typename PtrType>
inline PtrType tagCFunctionPtrImpl(PtrType ptr)
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
{
if (!ptr)
return nullptr;
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
WTF_PTRTAG_ASSERT(tagAction, ptr, CFunctionPtrTag, ptr == (tagCodePtrImpl<PtrTagAction::NoAssert, CFunctionPtrTag>(removeCodePtrTag(ptr))));
return retagCodePtrImpl<tagAction, CFunctionPtrTag, tag>(ptr);
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
}
template<typename T, PtrTag tag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
inline T tagCFunctionPtr(PtrType ptr)
{
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
return bitwise_cast<T>(tagCFunctionPtrImpl<PtrTagAction::DebugAssert, tag>(ptr));
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
}
template<PtrTag tag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
inline PtrType tagCFunctionPtr(PtrType ptr) { return tagCFunctionPtrImpl<PtrTagAction::DebugAssert, tag>(ptr); }
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
Implement a more efficient tagCFunction() tool. https://bugs.webkit.org/show_bug.cgi?id=210254 Reviewed by Keith Miller. Source/JavaScriptCore: Putting tagCFunction() to use. * b3/B3LowerMacros.cpp: * b3/B3LowerMacrosAfterOptimizations.cpp: * b3/B3MathExtras.cpp: * b3/B3ReduceLoopStrength.cpp: (JSC::B3::ReduceLoopStrength::reduceByteCopyLoopsToMemcpy): * b3/B3ReduceStrength.cpp: * b3/testb3_5.cpp: (testCallSimple): (testCallRare): (testCallRareLive): (testCallSimplePure): (testCallFunctionWithHellaArguments): (testCallFunctionWithHellaArguments2): (testCallFunctionWithHellaArguments3): (testCallSimpleDouble): (testCallSimpleFloat): (testCallFunctionWithHellaDoubleArguments): (testCallFunctionWithHellaFloatArguments): (testLinearScanWithCalleeOnStack): * b3/testb3_6.cpp: (testInterpreter): * b3/testb3_7.cpp: (testLICMPure): (testLICMPureSideExits): (testLICMPureWritesPinned): (testLICMPureWrites): (testLICMReadsLocalState): (testLICMReadsPinned): (testLICMReads): (testLICMPureNotBackwardsDominant): (testLICMPureFoiledByChild): (testLICMPureNotBackwardsDominantFoiledByChild): (testLICMExitsSideways): (testLICMWritesLocalState): (testLICMWrites): (testLICMFence): (testLICMWritesPinned): (testLICMControlDependent): (testLICMControlDependentNotBackwardsDominant): (testLICMControlDependentSideExits): (testLICMReadsPinnedWritesPinned): (testLICMReadsWritesDifferentHeaps): (testLICMReadsWritesOverlappingHeaps): (testLICMDefaultCall): (testShuffleDoesntTrashCalleeSaves): * dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::emitRestoreArguments): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::handleExitCounts): (JSC::DFG::osrWriteBarrier): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread): (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs): (JSC::FTL::DFG::LowerDFGToB3::compileCallEval): * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileStub): * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::callExceptionFuzz): * jit/CCallHelpers.cpp: (JSC::CCallHelpers::ensureShadowChickenPacket): * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::throwExceptionFromCallSlowPathGenerator): (JSC::slowPathFor): (JSC::nativeForGenerator): (JSC::boundFunctionCallGenerator): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::addTableGet): (JSC::Wasm::B3IRGenerator::addTableSet): (JSC::Wasm::B3IRGenerator::addRefFunc): (JSC::Wasm::B3IRGenerator::addTableSize): (JSC::Wasm::B3IRGenerator::addTableGrow): (JSC::Wasm::B3IRGenerator::addTableFill): (JSC::Wasm::B3IRGenerator::addGrowMemory): (JSC::Wasm::B3IRGenerator::setGlobal): (JSC::Wasm::B3IRGenerator::emitWriteBarrierForJSWrapper): (JSC::Wasm::B3IRGenerator::addOp<OpType::I32Popcnt>): (JSC::Wasm::B3IRGenerator::addOp<OpType::I64Popcnt>): * wasm/WasmThunks.cpp: (JSC::Wasm::triggerOMGEntryTierUpThunkGenerator): Source/WTF: The current tagCFunctionPtr() tool does some extra work that is not needed if we are tagging a known function and not a potentially arbitrary pointer. For example, 1. it doesn't need to do a null check. 2. it doesn't need to authenticate the function address. 3. The RELEASE_ASSERT used to enforce that authentication can also go away. We should only use tagCFunction() (instead of tagCFunctionPtr()) if we know for certain that we're operating on a C/C++ function, and not some arbitrary pointer. * wtf/PtrTag.h: (WTF::tagCFunction): Canonical link: https://commits.webkit.org/223146@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259786 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-09 09:27:40 +00:00
template<PtrTag newTag, typename FunctionType, class = typename std::enable_if<std::is_pointer<FunctionType>::value && std::is_function<typename std::remove_pointer<FunctionType>::type>::value>::type>
inline FunctionType tagCFunction(FunctionType func)
{
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
return tagCFunctionPtrImpl<PtrTagAction::DebugAssert, newTag>(func);
Implement a more efficient tagCFunction() tool. https://bugs.webkit.org/show_bug.cgi?id=210254 Reviewed by Keith Miller. Source/JavaScriptCore: Putting tagCFunction() to use. * b3/B3LowerMacros.cpp: * b3/B3LowerMacrosAfterOptimizations.cpp: * b3/B3MathExtras.cpp: * b3/B3ReduceLoopStrength.cpp: (JSC::B3::ReduceLoopStrength::reduceByteCopyLoopsToMemcpy): * b3/B3ReduceStrength.cpp: * b3/testb3_5.cpp: (testCallSimple): (testCallRare): (testCallRareLive): (testCallSimplePure): (testCallFunctionWithHellaArguments): (testCallFunctionWithHellaArguments2): (testCallFunctionWithHellaArguments3): (testCallSimpleDouble): (testCallSimpleFloat): (testCallFunctionWithHellaDoubleArguments): (testCallFunctionWithHellaFloatArguments): (testLinearScanWithCalleeOnStack): * b3/testb3_6.cpp: (testInterpreter): * b3/testb3_7.cpp: (testLICMPure): (testLICMPureSideExits): (testLICMPureWritesPinned): (testLICMPureWrites): (testLICMReadsLocalState): (testLICMReadsPinned): (testLICMReads): (testLICMPureNotBackwardsDominant): (testLICMPureFoiledByChild): (testLICMPureNotBackwardsDominantFoiledByChild): (testLICMExitsSideways): (testLICMWritesLocalState): (testLICMWrites): (testLICMFence): (testLICMWritesPinned): (testLICMControlDependent): (testLICMControlDependentNotBackwardsDominant): (testLICMControlDependentSideExits): (testLICMReadsPinnedWritesPinned): (testLICMReadsWritesDifferentHeaps): (testLICMReadsWritesOverlappingHeaps): (testLICMDefaultCall): (testShuffleDoesntTrashCalleeSaves): * dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::emitRestoreArguments): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::handleExitCounts): (JSC::DFG::osrWriteBarrier): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread): (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs): (JSC::FTL::DFG::LowerDFGToB3::compileCallEval): * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileStub): * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::callExceptionFuzz): * jit/CCallHelpers.cpp: (JSC::CCallHelpers::ensureShadowChickenPacket): * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::throwExceptionFromCallSlowPathGenerator): (JSC::slowPathFor): (JSC::nativeForGenerator): (JSC::boundFunctionCallGenerator): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::addTableGet): (JSC::Wasm::B3IRGenerator::addTableSet): (JSC::Wasm::B3IRGenerator::addRefFunc): (JSC::Wasm::B3IRGenerator::addTableSize): (JSC::Wasm::B3IRGenerator::addTableGrow): (JSC::Wasm::B3IRGenerator::addTableFill): (JSC::Wasm::B3IRGenerator::addGrowMemory): (JSC::Wasm::B3IRGenerator::setGlobal): (JSC::Wasm::B3IRGenerator::emitWriteBarrierForJSWrapper): (JSC::Wasm::B3IRGenerator::addOp<OpType::I32Popcnt>): (JSC::Wasm::B3IRGenerator::addOp<OpType::I64Popcnt>): * wasm/WasmThunks.cpp: (JSC::Wasm::triggerOMGEntryTierUpThunkGenerator): Source/WTF: The current tagCFunctionPtr() tool does some extra work that is not needed if we are tagging a known function and not a potentially arbitrary pointer. For example, 1. it doesn't need to do a null check. 2. it doesn't need to authenticate the function address. 3. The RELEASE_ASSERT used to enforce that authentication can also go away. We should only use tagCFunction() (instead of tagCFunctionPtr()) if we know for certain that we're operating on a C/C++ function, and not some arbitrary pointer. * wtf/PtrTag.h: (WTF::tagCFunction): Canonical link: https://commits.webkit.org/223146@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259786 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-09 09:27:40 +00:00
}
template<typename ReturnType, PtrTag newTag, typename FunctionType, class = typename std::enable_if<std::is_pointer<FunctionType>::value && std::is_function<typename std::remove_pointer<FunctionType>::type>::value>::type>
inline ReturnType tagCFunction(FunctionType func)
{
return bitwise_cast<ReturnType>(tagCFunction<newTag>(func));
}
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
template<PtrTagAction tagAction, PtrTag tag, typename PtrType>
inline PtrType untagCFunctionPtrImpl(PtrType ptr)
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
{
if (!ptr)
return nullptr;
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
WTF_PTRTAG_ASSERT(tagAction, ptr, tag, ptr == (tagCodePtrImpl<PtrTagAction::NoAssert, tag>(removeCodePtrTag(ptr))));
return retagCodePtrImpl<tagAction, tag, CFunctionPtrTag>(ptr);
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
}
template<typename T, PtrTag tag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
inline T untagCFunctionPtr(PtrType ptr)
{
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
return bitwise_cast<T>(untagCFunctionPtrImpl<PtrTagAction::DebugAssert, tag>(ptr));
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
}
template<typename T, PtrTag tag, PtrTagAction tagAction, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
inline T untagCFunctionPtr(PtrType ptr)
{
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
return bitwise_cast<T>(untagCFunctionPtrImpl<tagAction, tag>(ptr));
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
}
template<PtrTag tag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
inline PtrType untagCFunctionPtr(PtrType ptr) { return untagCFunctionPtrImpl<PtrTagAction::DebugAssert, tag>(ptr); }
#if CPU(ARM64E)
inline const void* untagReturnPC(const void* pc, const void* sp)
{
auto ptr = __builtin_ptrauth_auth(pc, ptrauth_key_return_address, sp);
assertIsNotTagged(ptr);
return ptr;
}
template <typename IntType>
inline IntType untagInt(IntType ptrInt, PtrTag tag)
{
static_assert(sizeof(IntType) == sizeof(uintptr_t));
return bitwise_cast<IntType>(ptrauth_auth_data(bitwise_cast<void*>(ptrInt), ptrauth_key_process_dependent_data, tag));
}
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
template<typename T>
inline T* tagArrayPtr(std::nullptr_t ptr, size_t length)
{
ASSERT(!length);
return ptrauth_sign_unauthenticated(static_cast<T*>(ptr), ptrauth_key_process_dependent_data, length);
}
template<typename T>
inline T* tagArrayPtr(T* ptr, size_t length)
{
return ptrauth_sign_unauthenticated(ptr, ptrauth_key_process_dependent_data, length);
}
template<typename T>
inline T* untagArrayPtr(T* ptr, size_t length)
{
return ptrauth_auth_data(ptr, ptrauth_key_process_dependent_data, length);
}
template<typename T>
inline T* removeArrayPtrTag(T* ptr)
{
return ptrauth_strip(ptr, ptrauth_key_process_dependent_data);
}
template<typename T>
inline T* retagArrayPtr(T* ptr, size_t oldLength, size_t newLength)
{
return ptrauth_auth_and_resign(ptr, ptrauth_key_process_dependent_data, oldLength, ptrauth_key_process_dependent_data, newLength);
}
Unreviewed, reland r268170 https://bugs.webkit.org/show_bug.cgi?id=217460 Source/JavaScriptCore: Fixed missing wrong OperationPtrTag use in Repatch.cpp. * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::getLinkerAddress): * assembler/AssemblerBuffer.h: (JSC::ARM64EHash::update): (JSC::ARM64EHash::finalHash const): * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/MacroAssemblerARM64.cpp: (JSC::MacroAssembler::probe): * assembler/MacroAssemblerCodeRef.h: (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): (JSC::MacroAssemblerCodePtr::createFromExecutableAddress): * assembler/testmasm.cpp: (JSC::testProbeModifiesProgramCounter): * b3/air/testair.cpp: * ftl/FTLOutput.h: (JSC::FTL::Output::callWithoutSideEffects): (JSC::FTL::Output::operation): * ftl/FTLSlowPathCall.cpp: (JSC::FTL::SlowPathCallContext::makeCall): * jit/JITCode.cpp: (JSC::JITCodeWithCodeRef::executableAddressAtOffset): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITOperations.cpp: * jit/Repatch.cpp: (JSC::readPutICCallTarget): (JSC::ftlThunkAwareRepatchCall): (JSC::tryCacheGetBy): (JSC::tryCachePutByID): * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntPCRanges.h: (JSC::LLInt::isLLIntPC): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::setUpCall): * llint/LLIntThunks.cpp: (JSC::LLInt::generateThunkWithJumpTo): * runtime/JSCPtrTag.h: * runtime/MachineContext.h: (JSC::MachineContext::instructionPointer): * runtime/NativeExecutable.cpp: (JSC::NativeExecutable::finishCreation): * runtime/PutPropertySlot.h: (JSC::PutPropertySlot::setCustomValue): (JSC::PutPropertySlot::setCustomAccessor): (JSC::PutPropertySlot::customSetter const): * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::emitCCall): * wasm/WasmSlowPaths.cpp: Source/WTF: * wtf/PlatformRegisters.cpp: (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PtrTag.h: (WTF::tagCodePtr): (WTF::untagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtr): (WTF::tagInt): Canonical link: https://commits.webkit.org/230280@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268247 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 05:08:11 +00:00
template <PtrTag tag, typename IntType>
inline IntType tagInt(IntType ptrInt)
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
{
static_assert(sizeof(IntType) == sizeof(uintptr_t));
return bitwise_cast<IntType>(ptrauth_sign_unauthenticated(bitwise_cast<void*>(ptrInt), ptrauth_key_process_dependent_data, tag));
}
template <typename IntType>
inline IntType tagInt(IntType ptrInt, PtrTag tag)
{
static_assert(sizeof(IntType) == sizeof(uintptr_t));
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
return bitwise_cast<IntType>(ptrauth_sign_unauthenticated(bitwise_cast<void*>(ptrInt), ptrauth_key_process_dependent_data, tag));
}
inline bool usesPointerTagging() { return true; }
[ARM64E] Harden the diversity of the DOMJIT::Signature::unsafeFunction pointer. https://bugs.webkit.org/show_bug.cgi?id=200292 <rdar://problem/53706881> Reviewed by Geoffrey Garen. Source/JavaScriptCore: Previously, DOMJIT::Signature::functionWithoutTypeCheck was signed as a C function pointer. We can do better by signing it like a vtbl function pointer. No new tests needed. The DOMJIT mechanism is covered by existing tests. I also manually confirmed that DOMJIT::Signature::functionWithoutTypeCheck is signed exactly as expected by reading its bits out of memory (not letting Clang have a chance to resign it into a C function pointer) and comparing it against manually signed bits with the expected diversifier. * assembler/MacroAssemblerCodeRef.h: (JSC::CFunctionPtr::CFunctionPtr): (JSC::CFunctionPtr::get const): (JSC::CFunctionPtr::address const): (JSC::CFunctionPtr::operator bool const): (JSC::CFunctionPtr::operator! const): (JSC::CFunctionPtr::operator== const): (JSC::CFunctionPtr::operator!= const): - Introduce a CFunctionPtr abstraction that is used to hold pointers to C functions. It can instantiated in 4 ways: 1. The default constructor. 2. A constructor that takes a nullptr_t. These 2 forms will instantiate a CFunctionPtr with a nullptr. 3. A constructor that takes the name of a function. 4. A constructor that takes a function pointer. Form 3 already knows that we're initializing with a real function, and that Clang will give it to use signed as a C function pointer. So, it doesn't do any assertions. This form is useful for initializing CFunctionPtrs embedded in const data structures. Form 4 is an explicit constructor that takes an arbitrary function pointer, but does not know if that pointer is already signed as a C function pointer. Hence, this form will do a RELEASE_ASSERT that the given function pointer is actually signed as a C function pointer. Once instantiated, we are guaranteed that a C function pointer is either null or contains a signed C function pointer. * domjit/DOMJITSignature.h: (JSC::DOMJIT::Signature::Signature): - Sign functionWithoutTypeCheck as WTF_VTBL_FUNCPTR_PTRAUTH(DOMJITFunctionPtrTag). * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCallDOM): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileCallDOM): - Use the new CFunctionPtr to document that the retrieved signature->functionWithoutTypeCheck is signed as a C function pointer. * runtime/ClassInfo.h: - Update MethodTable to sign its function pointers using the new WTF_VTBL_FUNCPTR_PTRAUTH_STR to be consistent. No longer need to roll its own PTRAUTH macro. * runtime/JSCPtrTag.h: - Add DOMJITFunctionPtrTag. * tools/JSDollarVM.cpp: - Update to work with the new DOMJIT::Signature constructor. Source/WebCore: * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): - Update to work with the new DOMJIT::Signature constructor. * bindings/scripts/test/JS/JSTestDOMJIT.cpp: - Re-base test results. Source/WTF: * wtf/PtrTag.h: - Introducing WTF_VTBL_FUNCPTR_PTRAUTH and WTF_VTBL_FUNCPTR_PTRAUTH_STR macros for defining vtbl function pointer style pointer signing modifier. Canonical link: https://commits.webkit.org/214187@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248192 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-03 00:31:31 +00:00
// vtbl function pointers need to sign with ptrauth_key_process_independent_code
// because they reside in library code shared by multiple processes.
// The second argument to __ptrauth() being 1 means to use the address of the pointer
// for diversification as well. __ptrauth() expects a literal int for this argument.
#define WTF_VTBL_FUNCPTR_PTRAUTH(discriminator) WTF_VTBL_FUNCPTR_PTRAUTH_STR(#discriminator)
#define WTF_VTBL_FUNCPTR_PTRAUTH_STR(discriminatorStr) \
__ptrauth(ptrauth_key_process_independent_code, 1, ptrauth_string_discriminator(discriminatorStr))
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
#else // not CPU(ARM64E)
inline const void* untagReturnPC(const void* pc, const void*)
{
return pc;
}
template<typename T>
inline T* tagArrayPtr(std::nullptr_t, size_t size)
{
ASSERT_UNUSED(size, !size);
return nullptr;
}
template<typename T>
inline T* tagArrayPtr(T* ptr, size_t)
{
return ptr;
}
template<typename T>
inline T* untagArrayPtr(T* ptr, size_t)
{
return ptr;
}
template<typename T>
inline T* removeArrayPtrTag(T* ptr)
{
return ptr;
}
template<typename T>
inline T* retagArrayPtr(T* ptr, size_t, size_t)
{
return ptr;
}
Unreviewed, reland r268170 https://bugs.webkit.org/show_bug.cgi?id=217460 Source/JavaScriptCore: Fixed missing wrong OperationPtrTag use in Repatch.cpp. * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::getLinkerAddress): * assembler/AssemblerBuffer.h: (JSC::ARM64EHash::update): (JSC::ARM64EHash::finalHash const): * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/MacroAssemblerARM64.cpp: (JSC::MacroAssembler::probe): * assembler/MacroAssemblerCodeRef.h: (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): (JSC::MacroAssemblerCodePtr::createFromExecutableAddress): * assembler/testmasm.cpp: (JSC::testProbeModifiesProgramCounter): * b3/air/testair.cpp: * ftl/FTLOutput.h: (JSC::FTL::Output::callWithoutSideEffects): (JSC::FTL::Output::operation): * ftl/FTLSlowPathCall.cpp: (JSC::FTL::SlowPathCallContext::makeCall): * jit/JITCode.cpp: (JSC::JITCodeWithCodeRef::executableAddressAtOffset): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITOperations.cpp: * jit/Repatch.cpp: (JSC::readPutICCallTarget): (JSC::ftlThunkAwareRepatchCall): (JSC::tryCacheGetBy): (JSC::tryCachePutByID): * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntPCRanges.h: (JSC::LLInt::isLLIntPC): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::setUpCall): * llint/LLIntThunks.cpp: (JSC::LLInt::generateThunkWithJumpTo): * runtime/JSCPtrTag.h: * runtime/MachineContext.h: (JSC::MachineContext::instructionPointer): * runtime/NativeExecutable.cpp: (JSC::NativeExecutable::finishCreation): * runtime/PutPropertySlot.h: (JSC::PutPropertySlot::setCustomValue): (JSC::PutPropertySlot::setCustomAccessor): (JSC::PutPropertySlot::customSetter const): * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::emitCCall): * wasm/WasmSlowPaths.cpp: Source/WTF: * wtf/PlatformRegisters.cpp: (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PtrTag.h: (WTF::tagCodePtr): (WTF::untagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtr): (WTF::tagInt): Canonical link: https://commits.webkit.org/230280@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268247 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 05:08:11 +00:00
template <PtrTag, typename IntType>
inline IntType tagInt(IntType ptrInt)
Verify the contents of AssemblerBuffer on arm64e https://bugs.webkit.org/show_bug.cgi?id=190057 <rdar://problem/38916630> Reviewed by Mark Lam. JSTests: * stress/regress-189132.js: Source/JavaScriptCore: * assembler/ARM64Assembler.h: (JSC::ARM64Assembler::ARM64Assembler): (JSC::ARM64Assembler::fillNops): (JSC::ARM64Assembler::link): (JSC::ARM64Assembler::linkJumpOrCall): (JSC::ARM64Assembler::linkCompareAndBranch): (JSC::ARM64Assembler::linkConditionalBranch): (JSC::ARM64Assembler::linkTestAndBranch): (JSC::ARM64Assembler::unlinkedCode): Deleted. * assembler/ARMAssembler.h: (JSC::ARMAssembler::fillNops): * assembler/ARMv7Assembler.h: (JSC::ARMv7Assembler::unlinkedCode): Deleted. * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::emitNops): (JSC::AbstractMacroAssembler::AbstractMacroAssembler): * assembler/AssemblerBuffer.h: (JSC::ARM64EHash::ARM64EHash): (JSC::ARM64EHash::update): (JSC::ARM64EHash::hash const): (JSC::ARM64EHash::randomSeed const): (JSC::AssemblerBuffer::AssemblerBuffer): (JSC::AssemblerBuffer::putShort): (JSC::AssemblerBuffer::putIntUnchecked): (JSC::AssemblerBuffer::putInt): (JSC::AssemblerBuffer::hash const): (JSC::AssemblerBuffer::data const): (JSC::AssemblerBuffer::putIntegralUnchecked): (JSC::AssemblerBuffer::append): Deleted. * assembler/LinkBuffer.cpp: (JSC::LinkBuffer::copyCompactAndLinkCode): * assembler/MIPSAssembler.h: (JSC::MIPSAssembler::fillNops): * assembler/MacroAssemblerARM64.h: (JSC::MacroAssemblerARM64::jumpsToLink): (JSC::MacroAssemblerARM64::link): (JSC::MacroAssemblerARM64::unlinkedCode): Deleted. * assembler/MacroAssemblerARMv7.h: (JSC::MacroAssemblerARMv7::jumpsToLink): (JSC::MacroAssemblerARMv7::unlinkedCode): Deleted. * assembler/X86Assembler.h: (JSC::X86Assembler::fillNops): Source/WTF: * wtf/PtrTag.h: (WTF::tagInt): Canonical link: https://commits.webkit.org/205025@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236589 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-28 05:34:38 +00:00
{
static_assert(sizeof(IntType) == sizeof(uintptr_t), "");
return ptrInt;
}
template <typename IntType>
inline IntType tagInt(IntType ptrInt, PtrTag)
{
static_assert(sizeof(IntType) == sizeof(uintptr_t));
return ptrInt;
}
template <typename IntType>
inline IntType untagInt(IntType ptrInt, PtrTag)
{
static_assert(sizeof(IntType) == sizeof(uintptr_t));
return ptrInt;
}
inline bool usesPointerTagging() { return false; }
[ARM64E] Harden the diversity of the DOMJIT::Signature::unsafeFunction pointer. https://bugs.webkit.org/show_bug.cgi?id=200292 <rdar://problem/53706881> Reviewed by Geoffrey Garen. Source/JavaScriptCore: Previously, DOMJIT::Signature::functionWithoutTypeCheck was signed as a C function pointer. We can do better by signing it like a vtbl function pointer. No new tests needed. The DOMJIT mechanism is covered by existing tests. I also manually confirmed that DOMJIT::Signature::functionWithoutTypeCheck is signed exactly as expected by reading its bits out of memory (not letting Clang have a chance to resign it into a C function pointer) and comparing it against manually signed bits with the expected diversifier. * assembler/MacroAssemblerCodeRef.h: (JSC::CFunctionPtr::CFunctionPtr): (JSC::CFunctionPtr::get const): (JSC::CFunctionPtr::address const): (JSC::CFunctionPtr::operator bool const): (JSC::CFunctionPtr::operator! const): (JSC::CFunctionPtr::operator== const): (JSC::CFunctionPtr::operator!= const): - Introduce a CFunctionPtr abstraction that is used to hold pointers to C functions. It can instantiated in 4 ways: 1. The default constructor. 2. A constructor that takes a nullptr_t. These 2 forms will instantiate a CFunctionPtr with a nullptr. 3. A constructor that takes the name of a function. 4. A constructor that takes a function pointer. Form 3 already knows that we're initializing with a real function, and that Clang will give it to use signed as a C function pointer. So, it doesn't do any assertions. This form is useful for initializing CFunctionPtrs embedded in const data structures. Form 4 is an explicit constructor that takes an arbitrary function pointer, but does not know if that pointer is already signed as a C function pointer. Hence, this form will do a RELEASE_ASSERT that the given function pointer is actually signed as a C function pointer. Once instantiated, we are guaranteed that a C function pointer is either null or contains a signed C function pointer. * domjit/DOMJITSignature.h: (JSC::DOMJIT::Signature::Signature): - Sign functionWithoutTypeCheck as WTF_VTBL_FUNCPTR_PTRAUTH(DOMJITFunctionPtrTag). * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCallDOM): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileCallDOM): - Use the new CFunctionPtr to document that the retrieved signature->functionWithoutTypeCheck is signed as a C function pointer. * runtime/ClassInfo.h: - Update MethodTable to sign its function pointers using the new WTF_VTBL_FUNCPTR_PTRAUTH_STR to be consistent. No longer need to roll its own PTRAUTH macro. * runtime/JSCPtrTag.h: - Add DOMJITFunctionPtrTag. * tools/JSDollarVM.cpp: - Update to work with the new DOMJIT::Signature constructor. Source/WebCore: * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): - Update to work with the new DOMJIT::Signature constructor. * bindings/scripts/test/JS/JSTestDOMJIT.cpp: - Re-base test results. Source/WTF: * wtf/PtrTag.h: - Introducing WTF_VTBL_FUNCPTR_PTRAUTH and WTF_VTBL_FUNCPTR_PTRAUTH_STR macros for defining vtbl function pointer style pointer signing modifier. Canonical link: https://commits.webkit.org/214187@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248192 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-03 00:31:31 +00:00
#define WTF_VTBL_FUNCPTR_PTRAUTH(discriminator)
#define WTF_VTBL_FUNCPTR_PTRAUTH_STR(discriminatorStr)
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
#endif // CPU(ARM64E)
[Re-landing] Prepare LLInt code to support pointer profiling. https://bugs.webkit.org/show_bug.cgi?id=183387 <rdar://problem/38199678> Reviewed by JF Bastien. Source/JavaScriptCore: 1. Introduced PtrTag enums for supporting pointer profiling later. 2. Also introduced tagging, untagging, retagging, and tag removal placeholder template functions for the same purpose. 3. Prepare the offlineasm for supporting pointer profiling later. 4. Tagged some pointers in LLInt asm code. Currently, these should have no effect on behavior. 5. Removed returnToThrowForThrownException() because it is not used anywhere. 6. Added the offlineasm folder to JavaScriptCore Xcode project so that it's easier to view and edit these files in Xcode. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/LLIntCallLinkInfo.h: (JSC::LLIntCallLinkInfo::unlink): * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntData.h: * llint/LLIntExceptions.cpp: (JSC::LLInt::returnToThrowForThrownException): Deleted. * llint/LLIntExceptions.h: * llint/LLIntOfflineAsmConfig.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: (JSC::LLInt::isLLIntPC): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::handleHostCall): (JSC::LLInt::setUpCall): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * offlineasm/ast.rb: * offlineasm/instructions.rb: * offlineasm/risc.rb: * runtime/PtrTag.h: Added. (JSC::uniquePtrTagID): (JSC::ptrTag): (JSC::tagCodePtr): (JSC::untagCodePtr): (JSC::retagCodePtr): (JSC::removeCodePtrTag): Source/WTF: * wtf/Platform.h: Canonical link: https://commits.webkit.org/199183@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-03-09 21:35:17 +00:00
Push the definition of PtrTag down to the WTF layer. https://bugs.webkit.org/show_bug.cgi?id=184976 <rdar://problem/39723901> Reviewed by Saam Barati. Source/JavaScriptCore: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/ARM64Assembler.h: * assembler/AbstractMacroAssembler.h: * assembler/MacroAssemblerCodeRef.cpp: * assembler/MacroAssemblerCodeRef.h: * b3/B3MathExtras.cpp: * bytecode/LLIntCallLinkInfo.h: * disassembler/Disassembler.h: * ftl/FTLJITCode.cpp: * interpreter/InterpreterInlines.h: * jit/ExecutableAllocator.h: * jit/JITOperations.cpp: * jit/ThunkGenerator.h: * jit/ThunkGenerators.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: * runtime/JSCPtrTag.h: Added. * runtime/NativeFunction.h: * runtime/PtrTag.h: Removed. * runtime/VMTraps.cpp: Source/WebCore: No new tests needed. This is covered by existing tests. * cssjit/CSSPtrTag.h: * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): Source/WTF: This is in preparation for doing pointer profiling at the WTF layer as well. Also deleted an unused ptrTag() function. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h. (WTF::makePtrTagHash): (JSC::ptrTagName): Deleted. (JSC::tagForPtr): Deleted. (JSC::ptrTag): Deleted. (JSC::tagCodePtr): Deleted. (JSC::untagCodePtr): Deleted. (JSC::retagCodePtr): Deleted. (JSC::removeCodePtrTag): Deleted. (JSC::tagCFunctionPtr): Deleted. (JSC::untagCFunctionPtr): Deleted. (JSC::assertIsCFunctionPtr): Deleted. (JSC::assertIsNullOrCFunctionPtr): Deleted. (JSC::assertIsNotTagged): Deleted. (JSC::assertIsTagged): Deleted. (JSC::assertIsNullOrTagged): Deleted. (JSC::assertIsTaggedWith): Deleted. (JSC::assertIsNullOrTaggedWith): Deleted. Canonical link: https://commits.webkit.org/200497@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-25 22:31:13 +00:00
} // namespace WTF
using WTF::CFunctionPtrTag;
using WTF::NoPtrTag;
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
using WTF::PlatformRegistersLRPtrTag;
using WTF::PlatformRegistersPCPtrTag;
Push the definition of PtrTag down to the WTF layer. https://bugs.webkit.org/show_bug.cgi?id=184976 <rdar://problem/39723901> Reviewed by Saam Barati. Source/JavaScriptCore: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/ARM64Assembler.h: * assembler/AbstractMacroAssembler.h: * assembler/MacroAssemblerCodeRef.cpp: * assembler/MacroAssemblerCodeRef.h: * b3/B3MathExtras.cpp: * bytecode/LLIntCallLinkInfo.h: * disassembler/Disassembler.h: * ftl/FTLJITCode.cpp: * interpreter/InterpreterInlines.h: * jit/ExecutableAllocator.h: * jit/JITOperations.cpp: * jit/ThunkGenerator.h: * jit/ThunkGenerators.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: * runtime/JSCPtrTag.h: Added. * runtime/NativeFunction.h: * runtime/PtrTag.h: Removed. * runtime/VMTraps.cpp: Source/WebCore: No new tests needed. This is covered by existing tests. * cssjit/CSSPtrTag.h: * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): Source/WTF: This is in preparation for doing pointer profiling at the WTF layer as well. Also deleted an unused ptrTag() function. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h. (WTF::makePtrTagHash): (JSC::ptrTagName): Deleted. (JSC::tagForPtr): Deleted. (JSC::ptrTag): Deleted. (JSC::tagCodePtr): Deleted. (JSC::untagCodePtr): Deleted. (JSC::retagCodePtr): Deleted. (JSC::removeCodePtrTag): Deleted. (JSC::tagCFunctionPtr): Deleted. (JSC::untagCFunctionPtr): Deleted. (JSC::assertIsCFunctionPtr): Deleted. (JSC::assertIsNullOrCFunctionPtr): Deleted. (JSC::assertIsNotTagged): Deleted. (JSC::assertIsTagged): Deleted. (JSC::assertIsNullOrTagged): Deleted. (JSC::assertIsTaggedWith): Deleted. (JSC::assertIsNullOrTaggedWith): Deleted. Canonical link: https://commits.webkit.org/200497@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-25 22:31:13 +00:00
using WTF::PtrTag;
[JSC] Assert Operation and HostFunction are in JITOperationsList https://bugs.webkit.org/show_bug.cgi?id=217500 Reviewed by Saam Barati. Source/JavaScriptCore: We make JSC PtrTag more restricted. We add the following information for each PtrTag. 1. What code target is tagged with this PtrTag? Native or JIT. 2. What uses this PtrTag when invoking code? Native, JIT, or None. And we will verify via JIT-caging. This patch adds HostFunctionPtrTag and sign host functions with it. Previously, it was signed with JSEntryPtrTag, and this is wrong since it is used for JS entry thunks. And we introduce assertion that function is registered in JITOperationList when signing function with OperationPtrTag or HostFunctionPtrTag. We also annotate all operations in testb3 so that testb3 can work with OperationPtrTag / HostFunctionPtrTag assertions. * assembler/JITOperationList.cpp: (JSC::addPointers): * assembler/JITOperationList.h: * b3/testb3_1.cpp: (main): * b3/testb3_5.cpp: (JSC_DEFINE_JIT_OPERATION): (simpleFunction): Deleted. (functionWithHellaArguments): Deleted. (functionWithHellaArguments2): Deleted. (functionWithHellaArguments3): Deleted. (simpleFunctionDouble): Deleted. (simpleFunctionFloat): Deleted. (functionWithHellaDoubleArguments): Deleted. (functionWithHellaFloatArguments): Deleted. * b3/testb3_6.cpp: (JSC_DEFINE_JIT_OPERATION): (interpreterPrint): Deleted. * b3/testb3_7.cpp: (JSC_DEFINE_JIT_OPERATION): (oneFunction): Deleted. (noOpFunction): Deleted. (functionNineArgs): Deleted. * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOperations.cpp: * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCPtrTag.cpp: (JSC::tagForPtr): (JSC::ptrTagName): * runtime/JSCPtrTag.h: (JSC::tagJSCCodePtrImpl): (JSC::untagJSCCodePtrImpl): * runtime/NativeFunction.h: (JSC::TaggedNativeFunction::TaggedNativeFunction): (JSC::TaggedNativeFunction::operator NativeFunction): * wasm/WasmOperations.cpp: (JSC::Wasm::doOSREntry): Source/WebCore: * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::populateJITOperations): * testing/js/WebCoreTestSupport.h: Source/WTF: This patch makes tagCodePtr etc. take PtrTag only from template parameter. As a result, we can easily customize special verification process for specific PtrTag. By leveraging this feature, we introduce HostFunction / JITOperation assertions for HostFunctionPtrTag and OperationPtrTag. We also add tagCodePtrWithStackPointerForJITCall and untagCodePtrWithStackPointerForJITCall, they are used only when we need to tag a pointer with stack pointer which is a dynamic PtrTag. * wtf/PtrTag.cpp: (WTF::tagForPtr): * wtf/PtrTag.h: (WTF::tagNativeCodePtrImpl): (WTF::untagNativeCodePtrImpl): (WTF::PtrTagTraits::tagCodePtr): (WTF::PtrTagTraits::untagCodePtr): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::assertIsCFunctionPtr): (WTF::isTaggedWith): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::tagCFunction): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagArrayPtr): (WTF::untagArrayPtr): (WTF::removeArrayPtrTag): (WTF::retagArrayPtr): (WTF::tagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrWithStackPointerForJITCall): (WTF::untagCodePtrImplHelper): Deleted. Tools: This patch turned out that WebCoreTestSupport has its own JIT operations. So we need to populate them in test harness specially. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (main): * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Canonical link: https://commits.webkit.org/230339@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-11 05:27:28 +00:00
using WTF::PtrTagCallerType;
using WTF::PtrTagCalleeType;
[Re-landing] Prepare LLInt code to support pointer profiling. https://bugs.webkit.org/show_bug.cgi?id=183387 <rdar://problem/38199678> Reviewed by JF Bastien. Source/JavaScriptCore: 1. Introduced PtrTag enums for supporting pointer profiling later. 2. Also introduced tagging, untagging, retagging, and tag removal placeholder template functions for the same purpose. 3. Prepare the offlineasm for supporting pointer profiling later. 4. Tagged some pointers in LLInt asm code. Currently, these should have no effect on behavior. 5. Removed returnToThrowForThrownException() because it is not used anywhere. 6. Added the offlineasm folder to JavaScriptCore Xcode project so that it's easier to view and edit these files in Xcode. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/LLIntCallLinkInfo.h: (JSC::LLIntCallLinkInfo::unlink): * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntData.h: * llint/LLIntExceptions.cpp: (JSC::LLInt::returnToThrowForThrownException): Deleted. * llint/LLIntExceptions.h: * llint/LLIntOfflineAsmConfig.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: (JSC::LLInt::isLLIntPC): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::handleHostCall): (JSC::LLInt::setUpCall): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * offlineasm/ast.rb: * offlineasm/instructions.rb: * offlineasm/risc.rb: * runtime/PtrTag.h: Added. (JSC::uniquePtrTagID): (JSC::ptrTag): (JSC::tagCodePtr): (JSC::untagCodePtr): (JSC::retagCodePtr): (JSC::removeCodePtrTag): Source/WTF: * wtf/Platform.h: Canonical link: https://commits.webkit.org/199183@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-03-09 21:35:17 +00:00
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
using WTF::reportBadTag;
Push the definition of PtrTag down to the WTF layer. https://bugs.webkit.org/show_bug.cgi?id=184976 <rdar://problem/39723901> Reviewed by Saam Barati. Source/JavaScriptCore: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/ARM64Assembler.h: * assembler/AbstractMacroAssembler.h: * assembler/MacroAssemblerCodeRef.cpp: * assembler/MacroAssemblerCodeRef.h: * b3/B3MathExtras.cpp: * bytecode/LLIntCallLinkInfo.h: * disassembler/Disassembler.h: * ftl/FTLJITCode.cpp: * interpreter/InterpreterInlines.h: * jit/ExecutableAllocator.h: * jit/JITOperations.cpp: * jit/ThunkGenerator.h: * jit/ThunkGenerators.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: * runtime/JSCPtrTag.h: Added. * runtime/NativeFunction.h: * runtime/PtrTag.h: Removed. * runtime/VMTraps.cpp: Source/WebCore: No new tests needed. This is covered by existing tests. * cssjit/CSSPtrTag.h: * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): Source/WTF: This is in preparation for doing pointer profiling at the WTF layer as well. Also deleted an unused ptrTag() function. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h. (WTF::makePtrTagHash): (JSC::ptrTagName): Deleted. (JSC::tagForPtr): Deleted. (JSC::ptrTag): Deleted. (JSC::tagCodePtr): Deleted. (JSC::untagCodePtr): Deleted. (JSC::retagCodePtr): Deleted. (JSC::removeCodePtrTag): Deleted. (JSC::tagCFunctionPtr): Deleted. (JSC::untagCFunctionPtr): Deleted. (JSC::assertIsCFunctionPtr): Deleted. (JSC::assertIsNullOrCFunctionPtr): Deleted. (JSC::assertIsNotTagged): Deleted. (JSC::assertIsTagged): Deleted. (JSC::assertIsNullOrTagged): Deleted. (JSC::assertIsTaggedWith): Deleted. (JSC::assertIsNullOrTaggedWith): Deleted. Canonical link: https://commits.webkit.org/200497@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-25 22:31:13 +00:00
using WTF::untagReturnPC;
using WTF::tagArrayPtr;
using WTF::untagArrayPtr;
using WTF::retagArrayPtr;
using WTF::removeArrayPtrTag;
Push the definition of PtrTag down to the WTF layer. https://bugs.webkit.org/show_bug.cgi?id=184976 <rdar://problem/39723901> Reviewed by Saam Barati. Source/JavaScriptCore: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/ARM64Assembler.h: * assembler/AbstractMacroAssembler.h: * assembler/MacroAssemblerCodeRef.cpp: * assembler/MacroAssemblerCodeRef.h: * b3/B3MathExtras.cpp: * bytecode/LLIntCallLinkInfo.h: * disassembler/Disassembler.h: * ftl/FTLJITCode.cpp: * interpreter/InterpreterInlines.h: * jit/ExecutableAllocator.h: * jit/JITOperations.cpp: * jit/ThunkGenerator.h: * jit/ThunkGenerators.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: * runtime/JSCPtrTag.h: Added. * runtime/NativeFunction.h: * runtime/PtrTag.h: Removed. * runtime/VMTraps.cpp: Source/WebCore: No new tests needed. This is covered by existing tests. * cssjit/CSSPtrTag.h: * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): Source/WTF: This is in preparation for doing pointer profiling at the WTF layer as well. Also deleted an unused ptrTag() function. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h. (WTF::makePtrTagHash): (JSC::ptrTagName): Deleted. (JSC::tagForPtr): Deleted. (JSC::ptrTag): Deleted. (JSC::tagCodePtr): Deleted. (JSC::untagCodePtr): Deleted. (JSC::retagCodePtr): Deleted. (JSC::removeCodePtrTag): Deleted. (JSC::tagCFunctionPtr): Deleted. (JSC::untagCFunctionPtr): Deleted. (JSC::assertIsCFunctionPtr): Deleted. (JSC::assertIsNullOrCFunctionPtr): Deleted. (JSC::assertIsNotTagged): Deleted. (JSC::assertIsTagged): Deleted. (JSC::assertIsNullOrTagged): Deleted. (JSC::assertIsTaggedWith): Deleted. (JSC::assertIsNullOrTaggedWith): Deleted. Canonical link: https://commits.webkit.org/200497@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-25 22:31:13 +00:00
using WTF::tagCodePtr;
using WTF::untagCodePtr;
using WTF::retagCodePtr;
using WTF::removeCodePtrTag;
Implement a more efficient tagCFunction() tool. https://bugs.webkit.org/show_bug.cgi?id=210254 Reviewed by Keith Miller. Source/JavaScriptCore: Putting tagCFunction() to use. * b3/B3LowerMacros.cpp: * b3/B3LowerMacrosAfterOptimizations.cpp: * b3/B3MathExtras.cpp: * b3/B3ReduceLoopStrength.cpp: (JSC::B3::ReduceLoopStrength::reduceByteCopyLoopsToMemcpy): * b3/B3ReduceStrength.cpp: * b3/testb3_5.cpp: (testCallSimple): (testCallRare): (testCallRareLive): (testCallSimplePure): (testCallFunctionWithHellaArguments): (testCallFunctionWithHellaArguments2): (testCallFunctionWithHellaArguments3): (testCallSimpleDouble): (testCallSimpleFloat): (testCallFunctionWithHellaDoubleArguments): (testCallFunctionWithHellaFloatArguments): (testLinearScanWithCalleeOnStack): * b3/testb3_6.cpp: (testInterpreter): * b3/testb3_7.cpp: (testLICMPure): (testLICMPureSideExits): (testLICMPureWritesPinned): (testLICMPureWrites): (testLICMReadsLocalState): (testLICMReadsPinned): (testLICMReads): (testLICMPureNotBackwardsDominant): (testLICMPureFoiledByChild): (testLICMPureNotBackwardsDominantFoiledByChild): (testLICMExitsSideways): (testLICMWritesLocalState): (testLICMWrites): (testLICMFence): (testLICMWritesPinned): (testLICMControlDependent): (testLICMControlDependentNotBackwardsDominant): (testLICMControlDependentSideExits): (testLICMReadsPinnedWritesPinned): (testLICMReadsWritesDifferentHeaps): (testLICMReadsWritesOverlappingHeaps): (testLICMDefaultCall): (testShuffleDoesntTrashCalleeSaves): * dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::emitRestoreArguments): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::handleExitCounts): (JSC::DFG::osrWriteBarrier): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread): (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs): (JSC::FTL::DFG::LowerDFGToB3::compileCallEval): * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileStub): * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::callExceptionFuzz): * jit/CCallHelpers.cpp: (JSC::CCallHelpers::ensureShadowChickenPacket): * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::throwExceptionFromCallSlowPathGenerator): (JSC::slowPathFor): (JSC::nativeForGenerator): (JSC::boundFunctionCallGenerator): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::addTableGet): (JSC::Wasm::B3IRGenerator::addTableSet): (JSC::Wasm::B3IRGenerator::addRefFunc): (JSC::Wasm::B3IRGenerator::addTableSize): (JSC::Wasm::B3IRGenerator::addTableGrow): (JSC::Wasm::B3IRGenerator::addTableFill): (JSC::Wasm::B3IRGenerator::addGrowMemory): (JSC::Wasm::B3IRGenerator::setGlobal): (JSC::Wasm::B3IRGenerator::emitWriteBarrierForJSWrapper): (JSC::Wasm::B3IRGenerator::addOp<OpType::I32Popcnt>): (JSC::Wasm::B3IRGenerator::addOp<OpType::I64Popcnt>): * wasm/WasmThunks.cpp: (JSC::Wasm::triggerOMGEntryTierUpThunkGenerator): Source/WTF: The current tagCFunctionPtr() tool does some extra work that is not needed if we are tagging a known function and not a potentially arbitrary pointer. For example, 1. it doesn't need to do a null check. 2. it doesn't need to authenticate the function address. 3. The RELEASE_ASSERT used to enforce that authentication can also go away. We should only use tagCFunction() (instead of tagCFunctionPtr()) if we know for certain that we're operating on a C/C++ function, and not some arbitrary pointer. * wtf/PtrTag.h: (WTF::tagCFunction): Canonical link: https://commits.webkit.org/223146@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259786 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-09 09:27:40 +00:00
using WTF::tagCFunction;
Push the definition of PtrTag down to the WTF layer. https://bugs.webkit.org/show_bug.cgi?id=184976 <rdar://problem/39723901> Reviewed by Saam Barati. Source/JavaScriptCore: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/ARM64Assembler.h: * assembler/AbstractMacroAssembler.h: * assembler/MacroAssemblerCodeRef.cpp: * assembler/MacroAssemblerCodeRef.h: * b3/B3MathExtras.cpp: * bytecode/LLIntCallLinkInfo.h: * disassembler/Disassembler.h: * ftl/FTLJITCode.cpp: * interpreter/InterpreterInlines.h: * jit/ExecutableAllocator.h: * jit/JITOperations.cpp: * jit/ThunkGenerator.h: * jit/ThunkGenerators.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: * runtime/JSCPtrTag.h: Added. * runtime/NativeFunction.h: * runtime/PtrTag.h: Removed. * runtime/VMTraps.cpp: Source/WebCore: No new tests needed. This is covered by existing tests. * cssjit/CSSPtrTag.h: * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): Source/WTF: This is in preparation for doing pointer profiling at the WTF layer as well. Also deleted an unused ptrTag() function. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h. (WTF::makePtrTagHash): (JSC::ptrTagName): Deleted. (JSC::tagForPtr): Deleted. (JSC::ptrTag): Deleted. (JSC::tagCodePtr): Deleted. (JSC::untagCodePtr): Deleted. (JSC::retagCodePtr): Deleted. (JSC::removeCodePtrTag): Deleted. (JSC::tagCFunctionPtr): Deleted. (JSC::untagCFunctionPtr): Deleted. (JSC::assertIsCFunctionPtr): Deleted. (JSC::assertIsNullOrCFunctionPtr): Deleted. (JSC::assertIsNotTagged): Deleted. (JSC::assertIsTagged): Deleted. (JSC::assertIsNullOrTagged): Deleted. (JSC::assertIsTaggedWith): Deleted. (JSC::assertIsNullOrTaggedWith): Deleted. Canonical link: https://commits.webkit.org/200497@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-25 22:31:13 +00:00
using WTF::tagCFunctionPtr;
using WTF::untagCFunctionPtr;
Verify the contents of AssemblerBuffer on arm64e https://bugs.webkit.org/show_bug.cgi?id=190057 <rdar://problem/38916630> Reviewed by Mark Lam. JSTests: * stress/regress-189132.js: Source/JavaScriptCore: * assembler/ARM64Assembler.h: (JSC::ARM64Assembler::ARM64Assembler): (JSC::ARM64Assembler::fillNops): (JSC::ARM64Assembler::link): (JSC::ARM64Assembler::linkJumpOrCall): (JSC::ARM64Assembler::linkCompareAndBranch): (JSC::ARM64Assembler::linkConditionalBranch): (JSC::ARM64Assembler::linkTestAndBranch): (JSC::ARM64Assembler::unlinkedCode): Deleted. * assembler/ARMAssembler.h: (JSC::ARMAssembler::fillNops): * assembler/ARMv7Assembler.h: (JSC::ARMv7Assembler::unlinkedCode): Deleted. * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::emitNops): (JSC::AbstractMacroAssembler::AbstractMacroAssembler): * assembler/AssemblerBuffer.h: (JSC::ARM64EHash::ARM64EHash): (JSC::ARM64EHash::update): (JSC::ARM64EHash::hash const): (JSC::ARM64EHash::randomSeed const): (JSC::AssemblerBuffer::AssemblerBuffer): (JSC::AssemblerBuffer::putShort): (JSC::AssemblerBuffer::putIntUnchecked): (JSC::AssemblerBuffer::putInt): (JSC::AssemblerBuffer::hash const): (JSC::AssemblerBuffer::data const): (JSC::AssemblerBuffer::putIntegralUnchecked): (JSC::AssemblerBuffer::append): Deleted. * assembler/LinkBuffer.cpp: (JSC::LinkBuffer::copyCompactAndLinkCode): * assembler/MIPSAssembler.h: (JSC::MIPSAssembler::fillNops): * assembler/MacroAssemblerARM64.h: (JSC::MacroAssemblerARM64::jumpsToLink): (JSC::MacroAssemblerARM64::link): (JSC::MacroAssemblerARM64::unlinkedCode): Deleted. * assembler/MacroAssemblerARMv7.h: (JSC::MacroAssemblerARMv7::jumpsToLink): (JSC::MacroAssemblerARMv7::unlinkedCode): Deleted. * assembler/X86Assembler.h: (JSC::X86Assembler::fillNops): Source/WTF: * wtf/PtrTag.h: (WTF::tagInt): Canonical link: https://commits.webkit.org/205025@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236589 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-09-28 05:34:38 +00:00
using WTF::tagInt;
using WTF::untagInt;
Push the definition of PtrTag down to the WTF layer. https://bugs.webkit.org/show_bug.cgi?id=184976 <rdar://problem/39723901> Reviewed by Saam Barati. Source/JavaScriptCore: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/ARM64Assembler.h: * assembler/AbstractMacroAssembler.h: * assembler/MacroAssemblerCodeRef.cpp: * assembler/MacroAssemblerCodeRef.h: * b3/B3MathExtras.cpp: * bytecode/LLIntCallLinkInfo.h: * disassembler/Disassembler.h: * ftl/FTLJITCode.cpp: * interpreter/InterpreterInlines.h: * jit/ExecutableAllocator.h: * jit/JITOperations.cpp: * jit/ThunkGenerator.h: * jit/ThunkGenerators.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: * runtime/JSCPtrTag.h: Added. * runtime/NativeFunction.h: * runtime/PtrTag.h: Removed. * runtime/VMTraps.cpp: Source/WebCore: No new tests needed. This is covered by existing tests. * cssjit/CSSPtrTag.h: * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): Source/WTF: This is in preparation for doing pointer profiling at the WTF layer as well. Also deleted an unused ptrTag() function. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h. (WTF::makePtrTagHash): (JSC::ptrTagName): Deleted. (JSC::tagForPtr): Deleted. (JSC::ptrTag): Deleted. (JSC::tagCodePtr): Deleted. (JSC::untagCodePtr): Deleted. (JSC::retagCodePtr): Deleted. (JSC::removeCodePtrTag): Deleted. (JSC::tagCFunctionPtr): Deleted. (JSC::untagCFunctionPtr): Deleted. (JSC::assertIsCFunctionPtr): Deleted. (JSC::assertIsNullOrCFunctionPtr): Deleted. (JSC::assertIsNotTagged): Deleted. (JSC::assertIsTagged): Deleted. (JSC::assertIsNullOrTagged): Deleted. (JSC::assertIsTaggedWith): Deleted. (JSC::assertIsNullOrTaggedWith): Deleted. Canonical link: https://commits.webkit.org/200497@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-25 22:31:13 +00:00
using WTF::assertIsCFunctionPtr;
using WTF::assertIsNullOrCFunctionPtr;
using WTF::assertIsNotTagged;
using WTF::isTaggedWith;
Push the definition of PtrTag down to the WTF layer. https://bugs.webkit.org/show_bug.cgi?id=184976 <rdar://problem/39723901> Reviewed by Saam Barati. Source/JavaScriptCore: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/ARM64Assembler.h: * assembler/AbstractMacroAssembler.h: * assembler/MacroAssemblerCodeRef.cpp: * assembler/MacroAssemblerCodeRef.h: * b3/B3MathExtras.cpp: * bytecode/LLIntCallLinkInfo.h: * disassembler/Disassembler.h: * ftl/FTLJITCode.cpp: * interpreter/InterpreterInlines.h: * jit/ExecutableAllocator.h: * jit/JITOperations.cpp: * jit/ThunkGenerator.h: * jit/ThunkGenerators.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntPCRanges.h: * runtime/JSCPtrTag.h: Added. * runtime/NativeFunction.h: * runtime/PtrTag.h: Removed. * runtime/VMTraps.cpp: Source/WebCore: No new tests needed. This is covered by existing tests. * cssjit/CSSPtrTag.h: * cssjit/SelectorCompiler.h: (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction): (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext): (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext): Source/WTF: This is in preparation for doing pointer profiling at the WTF layer as well. Also deleted an unused ptrTag() function. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h. (WTF::makePtrTagHash): (JSC::ptrTagName): Deleted. (JSC::tagForPtr): Deleted. (JSC::ptrTag): Deleted. (JSC::tagCodePtr): Deleted. (JSC::untagCodePtr): Deleted. (JSC::retagCodePtr): Deleted. (JSC::removeCodePtrTag): Deleted. (JSC::tagCFunctionPtr): Deleted. (JSC::untagCFunctionPtr): Deleted. (JSC::assertIsCFunctionPtr): Deleted. (JSC::assertIsNullOrCFunctionPtr): Deleted. (JSC::assertIsNotTagged): Deleted. (JSC::assertIsTagged): Deleted. (JSC::assertIsNullOrTagged): Deleted. (JSC::assertIsTaggedWith): Deleted. (JSC::assertIsNullOrTaggedWith): Deleted. Canonical link: https://commits.webkit.org/200497@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-25 22:31:13 +00:00
using WTF::assertIsTaggedWith;
using WTF::assertIsNullOrTaggedWith;
using WTF::usesPointerTagging;