2018-03-09 21:35:17 +00:00
|
|
|
/*
|
2020-04-09 09:27:40 +00:00
|
|
|
* Copyright (C) 2018-2020 Apple Inc. All rights reserved.
|
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
|
|
|
|
|
2019-03-20 23:32:26 +00:00
|
|
|
#include <wtf/Assertions.h>
|
|
|
|
#include <wtf/DataLog.h>
|
2018-03-09 21:35:17 +00:00
|
|
|
|
2018-04-25 22:31:13 +00:00
|
|
|
namespace WTF {
|
2018-03-09 21:35:17 +00:00
|
|
|
|
2018-04-25 22:31:13 +00:00
|
|
|
#define FOR_EACH_BASE_WTF_PTRTAG(v) \
|
2018-03-21 19:33:01 +00:00
|
|
|
v(NoPtrTag) \
|
|
|
|
v(CFunctionPtrTag) \
|
2018-04-21 00:19:00 +00:00
|
|
|
|
2018-04-25 22:31:13 +00:00
|
|
|
#define FOR_EACH_ADDITIONAL_WTF_PTRTAG(v) \
|
2018-04-30 22:29:21 +00:00
|
|
|
v(FreeSpacePtrTag) \
|
|
|
|
v(HandleMemoryPtrTag) \
|
2019-03-20 23:32:26 +00:00
|
|
|
v(PlatformRegistersLRPtrTag) \
|
|
|
|
v(PlatformRegistersPCPtrTag) \
|
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) \
|
2018-04-21 00:19:00 +00:00
|
|
|
|
2018-03-09 21:35:17 +00:00
|
|
|
enum PtrTag : uintptr_t {
|
2018-04-21 00:19:00 +00:00
|
|
|
NoPtrTag,
|
|
|
|
CFunctionPtrTag,
|
2018-04-25 22:31:13 +00:00
|
|
|
};
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-03-20 23:32:26 +00:00
|
|
|
#if CPU(ARM64E)
|
|
|
|
#define WTF_PTRTAG_HASH(tag) ptrauth_string_discriminator(#tag)
|
|
|
|
|
|
|
|
#else // not CPU(ARM64E)
|
|
|
|
|
2018-04-25 22:31:13 +00:00
|
|
|
template<size_t N>
|
|
|
|
constexpr uintptr_t makePtrTagHash(const char (&str)[N])
|
|
|
|
{
|
|
|
|
uintptr_t result = 134775813;
|
2018-04-26 22:59:04 +00:00
|
|
|
for (size_t i = 0; i < N; ++i)
|
|
|
|
result += ((result * str[i]) ^ (result >> 16));
|
2018-04-25 22:31:13 +00:00
|
|
|
return result & 0xffff;
|
|
|
|
}
|
2018-04-21 00:19:00 +00:00
|
|
|
|
2018-04-25 22:31:13 +00:00
|
|
|
#define WTF_PTRTAG_HASH(tag) WTF::makePtrTagHash(#tag)
|
2019-03-20 23:32:26 +00:00
|
|
|
#endif // not CPU(ARM64E)
|
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, "");
|
2018-03-09 21:35:17 +00:00
|
|
|
|
2018-03-21 19:33:01 +00:00
|
|
|
static_assert(static_cast<uintptr_t>(NoPtrTag) == static_cast<uintptr_t>(0), "");
|
2018-04-18 03:31:09 +00:00
|
|
|
static_assert(static_cast<uintptr_t>(CFunctionPtrTag) == static_cast<uintptr_t>(1), "");
|
2018-03-21 19:33:01 +00:00
|
|
|
|
2018-04-26 22:59:04 +00:00
|
|
|
#if COMPILER(MSVC)
|
|
|
|
#pragma warning(push)
|
|
|
|
#pragma warning(disable:4307)
|
|
|
|
#endif
|
|
|
|
|
2018-04-25 22:31:13 +00:00
|
|
|
FOR_EACH_ADDITIONAL_WTF_PTRTAG(WTF_DECLARE_PTRTAG)
|
2018-03-21 19:33:01 +00:00
|
|
|
|
2018-04-26 22:59:04 +00:00
|
|
|
#if COMPILER(MSVC)
|
|
|
|
#pragma warning(pop)
|
|
|
|
#endif
|
|
|
|
|
2019-03-20 23:32:26 +00:00
|
|
|
struct PtrTagLookup {
|
2020-05-19 18:49:07 +00:00
|
|
|
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;
|
2019-03-20 23:32:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#if CPU(ARM64E)
|
2020-10-11 05:27:28 +00:00
|
|
|
#define ENABLE_PTRTAG_DEBUGGING ASSERT_ENABLED
|
2019-03-20 23:32:26 +00:00
|
|
|
|
|
|
|
WTF_EXPORT_PRIVATE void registerPtrTagLookup(PtrTagLookup*);
|
|
|
|
WTF_EXPORT_PRIVATE void reportBadTag(const void*, PtrTag expectedTag);
|
|
|
|
|
2020-09-01 18:51:49 +00:00
|
|
|
#if ENABLE(PTRTAG_DEBUGGING)
|
2021-08-20 15:56:05 +00:00
|
|
|
|
|
|
|
WTF_EXPORT_PRIVATE const char* ptrTagName(PtrTag);
|
|
|
|
WTF_EXPORT_PRIVATE const char* tagForPtr(const void*);
|
|
|
|
|
2019-03-20 23:32:26 +00:00
|
|
|
constexpr bool enablePtrTagDebugAssert = true;
|
2020-05-19 17:53:51 +00:00
|
|
|
#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;
|
2020-05-19 17:53:51 +00:00
|
|
|
#define REPORT_BAD_TAG(success, ptr, expectedTag)
|
2019-03-20 23:32:26 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define WTF_PTRTAG_ASSERT(action, ptr, expectedTag, assertion) \
|
|
|
|
do { \
|
2020-10-11 05:27:28 +00:00
|
|
|
if constexpr (action == PtrTagAction::ReleaseAssert \
|
2019-03-20 23:32:26 +00:00
|
|
|
|| (WTF::enablePtrTagDebugAssert && action == PtrTagAction::DebugAssert)) { \
|
|
|
|
bool passed = (assertion); \
|
2020-05-19 17:53:51 +00:00
|
|
|
REPORT_BAD_TAG(passed, ptr, expectedTag); \
|
2019-03-20 23:32:26 +00:00
|
|
|
RELEASE_ASSERT(passed && #assertion); \
|
|
|
|
} \
|
|
|
|
} while (false)
|
2020-10-11 05:27:28 +00:00
|
|
|
#else
|
2019-03-20 23:32:26 +00:00
|
|
|
|
2020-10-11 05:27:28 +00:00
|
|
|
inline void registerPtrTagLookup(PtrTagLookup*) { }
|
|
|
|
inline void reportBadTag(const void*, PtrTag) { }
|
2019-05-08 20:07:53 +00:00
|
|
|
|
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
|
2019-06-12 18:40:56 +00:00
|
|
|
|
2020-10-11 05:27:28 +00:00
|
|
|
enum class PtrTagAction {
|
|
|
|
ReleaseAssert,
|
|
|
|
DebugAssert,
|
|
|
|
NoAssert,
|
|
|
|
};
|
2019-06-12 18:40:56 +00:00
|
|
|
|
2020-10-11 05:27:28 +00:00
|
|
|
constexpr PtrTag AnyPtrTag = static_cast<PtrTag>(-1); // Only used for assertion messages.
|
2019-06-12 18:40:56 +00:00
|
|
|
|
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)
|
|
|
|
{
|
2020-10-11 05:27:28 +00:00
|
|
|
#if CPU(ARM64E)
|
2019-03-20 23:32:26 +00:00
|
|
|
return bitwise_cast<T>(ptrauth_strip(ptr, ptrauth_key_process_dependent_code));
|
2020-10-11 05:27:28 +00:00
|
|
|
#else
|
|
|
|
return bitwise_cast<T>(ptr);
|
|
|
|
#endif
|
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)
|
|
|
|
{
|
2020-10-11 05:27:28 +00:00
|
|
|
#if CPU(ARM64E)
|
2019-03-20 23:32:26 +00:00
|
|
|
return ptrauth_strip(ptr, ptrauth_key_process_dependent_code);
|
2020-10-11 05:27:28 +00:00
|
|
|
#else
|
|
|
|
return ptr;
|
|
|
|
#endif
|
2019-03-20 23:32:26 +00:00
|
|
|
}
|
|
|
|
|
2020-10-11 05:27:28 +00:00
|
|
|
template<PtrTagAction tagAction, PtrTag tag, typename PtrType>
|
|
|
|
inline PtrType tagCodePtrImpl(PtrType ptr)
|
2019-03-20 23:32:26 +00:00
|
|
|
{
|
|
|
|
if (!ptr)
|
|
|
|
return nullptr;
|
|
|
|
WTF_PTRTAG_ASSERT(tagAction, ptr, NoPtrTag, removeCodePtrTag(ptr) == ptr);
|
2020-10-11 05:27:28 +00:00
|
|
|
return PtrTagTraits<tag>::tagCodePtr(ptr);
|
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)
|
|
|
|
{
|
2020-10-11 05:27:28 +00:00
|
|
|
return bitwise_cast<T>(tagCodePtrImpl<PtrTagAction::DebugAssert, tag>(ptr));
|
2019-03-20 23:32:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<PtrTag tag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
|
2020-10-11 05:27:28 +00:00
|
|
|
inline PtrType tagCodePtr(PtrType ptr) { return tagCodePtrImpl<PtrTagAction::DebugAssert, tag>(ptr); }
|
2019-03-20 23:32:26 +00:00
|
|
|
|
2020-10-11 05:27:28 +00:00
|
|
|
template<PtrTagAction tagAction, PtrTag tag, typename PtrType>
|
|
|
|
inline PtrType untagCodePtrImpl(PtrType ptr)
|
2019-03-20 23:32:26 +00:00
|
|
|
{
|
|
|
|
if (!ptr)
|
|
|
|
return nullptr;
|
2020-10-11 05:27:28 +00:00
|
|
|
PtrType result = PtrTagTraits<tag>::untagCodePtr(ptr);
|
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)
|
|
|
|
{
|
2020-10-11 05:27:28 +00:00
|
|
|
return bitwise_cast<T>(untagCodePtrImpl<PtrTagAction::DebugAssert, tag>(ptr));
|
2019-03-20 23:32:26 +00:00
|
|
|
}
|
|
|
|
|
2020-10-09 01:18:14 +00:00
|
|
|
template<PtrTag tag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
|
2020-10-11 05:27:28 +00:00
|
|
|
inline PtrType untagCodePtr(PtrType ptr) { return untagCodePtrImpl<PtrTagAction::DebugAssert, tag>(ptr); }
|
2020-10-09 05:08:11 +00:00
|
|
|
|
2020-10-11 05:27:28 +00:00
|
|
|
template<PtrTagAction tagAction, PtrTag oldTag, PtrTag newTag, typename PtrType>
|
|
|
|
inline PtrType retagCodePtrImplHelper(PtrType ptr)
|
2019-03-20 23:32:26 +00:00
|
|
|
{
|
2020-10-11 05:27:28 +00:00
|
|
|
if constexpr (oldTag == newTag || (oldTag == NoPtrTag && newTag == NoPtrTag))
|
2019-03-20 23:32:26 +00:00
|
|
|
return ptr;
|
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)
|
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);
|
2020-10-11 05:27:28 +00:00
|
|
|
if constexpr (newTag == CFunctionPtrTag)
|
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);
|
2020-10-11 05:27:28 +00:00
|
|
|
#else
|
|
|
|
return tagCodePtrImpl<tagAction, newTag>(untagCodePtrImpl<tagAction, oldTag>(ptr));
|
|
|
|
#endif
|
2019-03-20 23:32:26 +00:00
|
|
|
}
|
|
|
|
|
2020-10-11 05:27:28 +00:00
|
|
|
template<PtrTagAction tagAction, PtrTag oldTag, PtrTag newTag, typename PtrType>
|
|
|
|
inline PtrType retagCodePtrImpl(PtrType ptr)
|
2019-03-20 23:32:26 +00:00
|
|
|
{
|
|
|
|
if (!ptr)
|
|
|
|
return nullptr;
|
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))));
|
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)
|
|
|
|
{
|
2020-10-11 05:27:28 +00:00
|
|
|
return bitwise_cast<T>(retagCodePtrImpl<PtrTagAction::DebugAssert, oldTag, newTag>(ptr));
|
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>>
|
2020-10-11 05:27:28 +00:00
|
|
|
inline PtrType retagCodePtr(PtrType ptr) { return retagCodePtrImpl<PtrTagAction::DebugAssert, oldTag, newTag>(ptr); }
|
2018-03-09 21:35:17 +00:00
|
|
|
|
2020-10-09 05:08:11 +00:00
|
|
|
template<typename PtrType>
|
|
|
|
void assertIsCFunctionPtr(PtrType value)
|
|
|
|
{
|
|
|
|
void* ptr = bitwise_cast<void*>(value);
|
2020-10-11 05:27:28 +00:00
|
|
|
WTF_PTRTAG_ASSERT(PtrTagAction::DebugAssert, ptr, CFunctionPtrTag, ptr == (tagCodePtrImpl<PtrTagAction::NoAssert, CFunctionPtrTag>(removeCodePtrTag(ptr))));
|
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);
|
2020-10-11 05:27:28 +00:00
|
|
|
return ptr == tagCodePtrImpl<PtrTagAction::NoAssert, tag>(removeCodePtrTag(ptr));
|
2020-10-09 05:08:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<PtrTag tag, typename PtrType>
|
|
|
|
void assertIsTaggedWith(PtrType value)
|
|
|
|
{
|
2020-11-04 02:31:56 +00:00
|
|
|
UNUSED_PARAM(value);
|
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);
|
|
|
|
}
|
|
|
|
|
2020-10-11 05:27:28 +00:00
|
|
|
template<PtrTagAction tagAction, PtrTag tag, typename PtrType>
|
|
|
|
inline PtrType tagCFunctionPtrImpl(PtrType ptr)
|
2019-03-20 23:32:26 +00:00
|
|
|
{
|
|
|
|
if (!ptr)
|
|
|
|
return nullptr;
|
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);
|
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)
|
|
|
|
{
|
2020-10-11 05:27:28 +00:00
|
|
|
return bitwise_cast<T>(tagCFunctionPtrImpl<PtrTagAction::DebugAssert, tag>(ptr));
|
2019-03-20 23:32:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<PtrTag tag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
|
2020-10-11 05:27:28 +00:00
|
|
|
inline PtrType tagCFunctionPtr(PtrType ptr) { return tagCFunctionPtrImpl<PtrTagAction::DebugAssert, tag>(ptr); }
|
2019-03-20 23:32:26 +00:00
|
|
|
|
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)
|
|
|
|
{
|
2020-10-11 05:27:28 +00:00
|
|
|
return tagCFunctionPtrImpl<PtrTagAction::DebugAssert, newTag>(func);
|
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));
|
|
|
|
}
|
|
|
|
|
2020-10-11 05:27:28 +00:00
|
|
|
template<PtrTagAction tagAction, PtrTag tag, typename PtrType>
|
|
|
|
inline PtrType untagCFunctionPtrImpl(PtrType ptr)
|
2019-03-20 23:32:26 +00:00
|
|
|
{
|
|
|
|
if (!ptr)
|
|
|
|
return nullptr;
|
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);
|
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)
|
|
|
|
{
|
2020-10-11 05:27:28 +00:00
|
|
|
return bitwise_cast<T>(untagCFunctionPtrImpl<PtrTagAction::DebugAssert, tag>(ptr));
|
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)
|
|
|
|
{
|
2020-10-11 05:27:28 +00:00
|
|
|
return bitwise_cast<T>(untagCFunctionPtrImpl<tagAction, tag>(ptr));
|
2019-03-20 23:32:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<PtrTag tag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
|
2020-10-11 05:27:28 +00:00
|
|
|
inline PtrType untagCFunctionPtr(PtrType ptr) { return untagCFunctionPtrImpl<PtrTagAction::DebugAssert, tag>(ptr); }
|
|
|
|
|
|
|
|
#if CPU(ARM64E)
|
|
|
|
|
2021-08-10 18:17:15 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2020-10-27 02:13:14 +00:00
|
|
|
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));
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2020-10-09 05:08:11 +00:00
|
|
|
template <PtrTag tag, typename IntType>
|
|
|
|
inline IntType tagInt(IntType ptrInt)
|
2019-03-20 23:32:26 +00:00
|
|
|
{
|
2020-10-27 02:13:14 +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));
|
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; }
|
|
|
|
|
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))
|
|
|
|
|
2019-03-20 23:32:26 +00:00
|
|
|
#else // not CPU(ARM64E)
|
|
|
|
|
2021-08-10 18:17:15 +00:00
|
|
|
inline const void* untagReturnPC(const void* pc, const void*)
|
|
|
|
{
|
|
|
|
return pc;
|
|
|
|
}
|
|
|
|
|
2019-06-12 18:40:56 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2020-10-09 05:08:11 +00:00
|
|
|
template <PtrTag, typename IntType>
|
|
|
|
inline IntType tagInt(IntType ptrInt)
|
2018-09-28 05:34:38 +00:00
|
|
|
{
|
|
|
|
static_assert(sizeof(IntType) == sizeof(uintptr_t), "");
|
|
|
|
return ptrInt;
|
|
|
|
}
|
|
|
|
|
2020-10-27 02:13:14 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2018-08-03 00:14:11 +00:00
|
|
|
inline bool usesPointerTagging() { return false; }
|
|
|
|
|
2019-08-03 00:31:31 +00:00
|
|
|
#define WTF_VTBL_FUNCPTR_PTRAUTH(discriminator)
|
|
|
|
#define WTF_VTBL_FUNCPTR_PTRAUTH_STR(discriminatorStr)
|
|
|
|
|
2019-03-20 23:32:26 +00:00
|
|
|
#endif // CPU(ARM64E)
|
2018-03-09 21:35:17 +00:00
|
|
|
|
2018-04-25 22:31:13 +00:00
|
|
|
} // namespace WTF
|
|
|
|
|
|
|
|
using WTF::CFunctionPtrTag;
|
|
|
|
using WTF::NoPtrTag;
|
2019-03-20 23:32:26 +00:00
|
|
|
using WTF::PlatformRegistersLRPtrTag;
|
|
|
|
using WTF::PlatformRegistersPCPtrTag;
|
2018-04-25 22:31:13 +00:00
|
|
|
using WTF::PtrTag;
|
2020-10-11 05:27:28 +00:00
|
|
|
using WTF::PtrTagCallerType;
|
|
|
|
using WTF::PtrTagCalleeType;
|
2018-03-09 21:35:17 +00:00
|
|
|
|
2019-03-20 23:32:26 +00:00
|
|
|
using WTF::reportBadTag;
|
2018-04-25 22:31:13 +00:00
|
|
|
|
2021-08-10 18:17:15 +00:00
|
|
|
using WTF::untagReturnPC;
|
2019-06-12 18:40:56 +00:00
|
|
|
using WTF::tagArrayPtr;
|
|
|
|
using WTF::untagArrayPtr;
|
|
|
|
using WTF::retagArrayPtr;
|
|
|
|
using WTF::removeArrayPtrTag;
|
|
|
|
|
2018-04-25 22:31:13 +00:00
|
|
|
using WTF::tagCodePtr;
|
|
|
|
using WTF::untagCodePtr;
|
|
|
|
using WTF::retagCodePtr;
|
|
|
|
using WTF::removeCodePtrTag;
|
2020-04-09 09:27:40 +00:00
|
|
|
using WTF::tagCFunction;
|
2018-04-25 22:31:13 +00:00
|
|
|
using WTF::tagCFunctionPtr;
|
|
|
|
using WTF::untagCFunctionPtr;
|
2018-09-28 05:34:38 +00:00
|
|
|
using WTF::tagInt;
|
2020-10-27 02:13:14 +00:00
|
|
|
using WTF::untagInt;
|
2018-04-25 22:31:13 +00:00
|
|
|
|
|
|
|
using WTF::assertIsCFunctionPtr;
|
|
|
|
using WTF::assertIsNullOrCFunctionPtr;
|
|
|
|
using WTF::assertIsNotTagged;
|
2018-08-03 00:14:11 +00:00
|
|
|
using WTF::isTaggedWith;
|
2018-04-25 22:31:13 +00:00
|
|
|
using WTF::assertIsTaggedWith;
|
|
|
|
using WTF::assertIsNullOrTaggedWith;
|
2018-08-03 00:14:11 +00:00
|
|
|
using WTF::usesPointerTagging;
|