Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (294179 => 294180)
--- trunk/Source/_javascript_Core/ChangeLog 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/ChangeLog 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,3 +1,173 @@
+2022-05-13 Mark Lam <mark....@apple.com>
+
+ Enhance the ARM64Disassembler to print pc indices and better branch target labels.
+ https://bugs.webkit.org/show_bug.cgi?id=240370
+
+ Reviewed by Saam Barati.
+
+ Disassemblies used to look like this:
+
+ 0x10e480ff8: ldurb w17, [x0, #7]
+ 0x10e480ffc: cmp w17, #0
+ 0x10e481000: b.hi 0x10e48103c
+ 0x10e481004: stur x0, [fp, #-72]
+ ...
+ 0x10e481040: movk x3, #0xfffe, lsl #48
+ 0x10e481044: b 0x10e4814f4
+ 0x10e481048: nop
+
+ With this patch, it will now look like this:
+
+ <748> 0x10e120aec: ldurb w17, [x0, #7]
+ <752> 0x10e120af0: cmp w17, #0
+ <756> 0x10e120af4: b.hi 0x10e120b30 -> <816>
+ <760> 0x10e120af8: stur x0, [fp, #-80]
+ ...
+ <820> 0x10e120b34: movk x3, #0xfffe, lsl #48
+ <824> 0x10e120b38: b 0x10e120fc8 -> <1992>
+ <828> 0x10e120b3c: nop
+
+ 1. Each instruction pc is now prefixed with a pc index i.e. the offset of the
+ pc address from the start of the compilation unit e.g. <756>.
+
+ 2. Relative branches now show the branch target as a pc index (effectively, an
+ internal label in this compilation unit) in addition to the pc address e.g.
+ the "-> <816>" in:
+ <756> 0x10e120af4: b.hi 0x10e120b30 -> <816>
+
+ Also fixed a formatting bug where the space between relative branch instructions
+ and their target pc was short 2 spaces.
+
+ 3. If the relative branch target is a known thunk, the disassembler will now
+ print the thunk label e.g.
+
+ <828> 0x10e12033c: bl 0x10e0f0a00 -> <thunk: get_from_scope thunk>
+ <1476> 0x10e120dc4: cbnz x16, 0x10e104100 -> <thunk: handleExceptionWithCallFrameRollback>
+ <2368> 0x10e121140: b 0x10e10c000 -> <thunk: DFG OSR exit generation thunk>
+
+ Introduced a FINALIZE_THUNK macro that will be used instead of FINALIZE_CODE in
+ thunk generators. By doing so, thunk labels will automatically be registered
+ with the disassembler, and will be used for the above look up.
+
+ Thunk label registration is only done if disassembly is enabled.
+
+ 4. If the branch target is neither an internal label nor a thunk, then the
+ disassembler will print some useful info about it to the best of its
+ knowledge e.g.
+
+ <168> 0x10e1002e8: b 0x10e120b60 -> <JIT PC>
+ <168> 0x10e1002e8: b 0x10e120b60 -> <LLInt PC>
+ <168> 0x10e1002e8: b 0x10e120b60 -> <unknown>
+
+ 5. The disassemble() function now takes 2 additional arguments: codeStart, and
+ codeEnd. These are needed so that the disassembler can compute the pc index
+ for each instruction, as well as determine if a branch target is internal to
+ this compilation unit, or pointing out of it.
+
+ This feature is currently only supported for the ARM64 disassembler.
+
+ Printing of JIT operation labels (via movz + movk + indirect branch) is not yet
+ supported.
+
+ * assembler/LinkBuffer.cpp:
+ (JSC::LinkBuffer::finalizeCodeWithDisassemblyImpl):
+ * assembler/LinkBuffer.h:
+ (JSC::LinkBuffer::setIsThunk):
+ * b3/air/AirDisassembler.cpp:
+ (JSC::B3::Air::Disassembler::dump):
+ * dfg/DFGDisassembler.cpp:
+ (JSC::DFG::Disassembler::dumpDisassembly):
+ * dfg/DFGThunks.cpp:
+ (JSC::DFG::osrExitGenerationThunkGenerator):
+ (JSC::DFG::osrEntryThunkGenerator):
+ * disassembler/ARM64/A64DOpcode.cpp:
+ (JSC::ARM64Disassembler::A64DOpcode::appendPCRelativeOffset):
+ (JSC::ARM64Disassembler::A64DOpcodeConditionalBranchImmediate::format):
+ * disassembler/ARM64/A64DOpcode.h:
+ (JSC::ARM64Disassembler::A64DOpcode::A64DOpcode):
+ (JSC::ARM64Disassembler::A64DOpcode::appendPCRelativeOffset): Deleted.
+ * disassembler/ARM64Disassembler.cpp:
+ (JSC::tryToDisassemble):
+ * disassembler/CapstoneDisassembler.cpp:
+ (JSC::tryToDisassemble):
+ * disassembler/Disassembler.cpp:
+ (JSC::disassemble):
+ (JSC::disassembleAsynchronously):
+ (JSC::ensureThunkLabelMap):
+ (JSC::registerThunkLabel):
+ (JSC::labelForThunk):
+ * disassembler/Disassembler.h:
+ (JSC::tryToDisassemble):
+ * disassembler/RISCV64Disassembler.cpp:
+ (JSC::tryToDisassemble):
+ * disassembler/X86Disassembler.cpp:
+ (JSC::tryToDisassemble):
+ * ftl/FTLThunks.cpp:
+ (JSC::FTL::genericGenerationThunkGenerator):
+ (JSC::FTL::slowPathCallThunkGenerator):
+ * jit/JIT.cpp:
+ (JSC::JIT::consistencyCheckGenerator):
+ * jit/JITCall.cpp:
+ (JSC::JIT::returnFromBaselineGenerator):
+ * jit/JITDisassembler.cpp:
+ (JSC::JITDisassembler::dump):
+ (JSC::JITDisassembler::dumpDisassembly):
+ * jit/JITDisassembler.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::valueIsFalseyGenerator):
+ (JSC::JIT::valueIsTruthyGenerator):
+ (JSC::JIT::op_throw_handlerGenerator):
+ (JSC::JIT::op_enter_handlerGenerator):
+ (JSC::JIT::op_check_traps_handlerGenerator):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::slow_op_get_by_val_callSlowOperationThenCheckExceptionGenerator):
+ (JSC::JIT::slow_op_get_private_name_callSlowOperationThenCheckExceptionGenerator):
+ (JSC::JIT::slow_op_put_by_val_callSlowOperationThenCheckExceptionGenerator):
+ (JSC::JIT::slow_op_put_private_name_callSlowOperationThenCheckExceptionGenerator):
+ (JSC::JIT::slow_op_del_by_id_callSlowOperationThenCheckExceptionGenerator):
+ (JSC::JIT::slow_op_del_by_val_callSlowOperationThenCheckExceptionGenerator):
+ (JSC::JIT::slow_op_get_by_id_callSlowOperationThenCheckExceptionGenerator):
+ (JSC::JIT::slow_op_get_by_id_with_this_callSlowOperationThenCheckExceptionGenerator):
+ (JSC::JIT::slow_op_put_by_id_callSlowOperationThenCheckExceptionGenerator):
+ (JSC::JIT::generateOpResolveScopeThunk):
+ (JSC::JIT::slow_op_resolve_scopeGenerator):
+ (JSC::JIT::generateOpGetFromScopeThunk):
+ (JSC::JIT::slow_op_get_from_scopeGenerator):
+ (JSC::JIT::slow_op_put_to_scopeGenerator):
+ * jit/SlowPathCall.cpp:
+ (JSC::JITSlowPathCall::generateThunk):
+ * jit/SpecializedThunkJIT.h:
+ (JSC::SpecializedThunkJIT::finalize):
+ * jit/ThunkGenerator.h:
+ * jit/ThunkGenerators.cpp:
+ (JSC::handleExceptionGenerator):
+ (JSC::handleExceptionWithCallFrameRollbackGenerator):
+ (JSC::popThunkStackPreservesAndHandleExceptionGenerator):
+ (JSC::checkExceptionGenerator):
+ (JSC::throwExceptionFromCallSlowPathGenerator):
+ (JSC::linkCallThunkGenerator):
+ (JSC::linkPolymorphicCallThunkGenerator):
+ (JSC::virtualThunkFor):
+ (JSC::nativeForGenerator):
+ (JSC::arityFixupGenerator):
+ (JSC::unreachableGenerator):
+ (JSC::stringGetByValGenerator):
+ (JSC::boundFunctionCallGenerator):
+ (JSC::remoteFunctionCallGenerator):
+ * llint/LLIntThunks.cpp:
+ (JSC::LLInt::generateThunkWithJumpTo):
+ (JSC::LLInt::generateThunkWithJumpToPrologue):
+ (JSC::LLInt::generateThunkWithJumpToLLIntReturnPoint):
+ (JSC::LLInt::createJSGateThunk):
+ (JSC::LLInt::createWasmGateThunk):
+ (JSC::LLInt::createTailCallGate):
+ (JSC::LLInt::tagGateThunk):
+ (JSC::LLInt::untagGateThunk):
+ * yarr/YarrDisassembler.cpp:
+ (JSC::Yarr::YarrDisassembler::dump):
+ (JSC::Yarr::YarrDisassembler::dumpDisassembly):
+ * yarr/YarrDisassembler.h:
+
2022-05-13 Adrian Perez de Castro <ape...@igalia.com>
Non-unified build broken in debug mode
Modified: trunk/Source/_javascript_Core/assembler/LinkBuffer.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/assembler/LinkBuffer.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/assembler/LinkBuffer.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -75,7 +75,23 @@
out.printf("Generated JIT code for ");
va_list argList;
va_start(argList, format);
- out.vprintf(format, argList);
+
+ if (m_isThunk) {
+ va_list preflightArgs;
+ va_copy(preflightArgs, argList);
+ size_t stringLength = vsnprintf(nullptr, 0, format, preflightArgs);
+ va_end(preflightArgs);
+
+ char* buffer = 0;
+ CString label = CString::newUninitialized(stringLength + 1, buffer);
+ vsnprintf(buffer, stringLength + 1, format, argList);
+ buffer[stringLength] = '\0';
+ out.printf("%s", buffer);
+
+ registerThunkLabel(result.code().untaggedExecutableAddress(), WTFMove(label));
+ } else
+ out.vprintf(format, argList);
+
va_end(argList);
out.printf(":\n");
@@ -90,14 +106,17 @@
return result;
}
+ void* codeStart = entrypoint<DisassemblyPtrTag>().untaggedExecutableAddress();
+ void* codeEnd = bitwise_cast<uint8_t*>(codeStart) + size();
+
if (Options::asyncDisassembly()) {
CodeRef<DisassemblyPtrTag> codeRefForDisassembly = result.retagged<DisassemblyPtrTag>();
- disassembleAsynchronously(header, WTFMove(codeRefForDisassembly), m_size, " ");
+ disassembleAsynchronously(header, WTFMove(codeRefForDisassembly), m_size, codeStart, codeEnd, " ");
return result;
}
dataLog(header);
- disassemble(result.retaggedCode<DisassemblyPtrTag>(), m_size, " ", WTF::dataFile());
+ disassemble(result.retaggedCode<DisassemblyPtrTag>(), m_size, codeStart, codeEnd, " ", WTF::dataFile());
return result;
}
Modified: trunk/Source/_javascript_Core/assembler/LinkBuffer.h (294179 => 294180)
--- trunk/Source/_javascript_Core/assembler/LinkBuffer.h 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/assembler/LinkBuffer.h 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2009-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -342,6 +342,8 @@
m_mainThreadFinalizationTasks.append(createSharedTask<void()>(functor));
}
+ void setIsThunk() { m_isThunk = true; }
+
private:
JS_EXPORT_PRIVATE CodeRef<LinkBufferPtrTag> finalizeCodeWithoutDisassemblyImpl();
JS_EXPORT_PRIVATE CodeRef<LinkBufferPtrTag> finalizeCodeWithDisassemblyImpl(bool dumpDisassembly, const char* format, ...) WTF_ATTRIBUTE_PRINTF(3, 4);
@@ -417,6 +419,7 @@
bool m_isJumpIsland { false };
#endif
bool m_alreadyDisassembled { false };
+ bool m_isThunk { false };
Profile m_profile { Profile::Uncategorized };
MacroAssemblerCodePtr<LinkBufferPtrTag> m_code;
Vector<RefPtr<SharedTask<void(LinkBuffer&)>>> m_linkTasks;
Modified: trunk/Source/_javascript_Core/b3/air/AirDisassembler.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/b3/air/AirDisassembler.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/b3/air/AirDisassembler.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -71,6 +71,9 @@
void Disassembler::dump(Code& code, PrintStream& out, LinkBuffer& linkBuffer, const char* airPrefix, const char* asmPrefix, const ScopedLambda<void(Inst&)>& doToEachInst)
{
+ void* codeStart = linkBuffer.entrypoint<DisassemblyPtrTag>().untaggedExecutableAddress();
+ void* codeEnd = bitwise_cast<uint8_t*>(codeStart) + linkBuffer.size();
+
auto dumpAsmRange = [&] (CCallHelpers::Label startLabel, CCallHelpers::Label endLabel) {
RELEASE_ASSERT(startLabel.isSet());
RELEASE_ASSERT(endLabel.isSet());
@@ -77,7 +80,7 @@
CodeLocationLabel<DisassemblyPtrTag> start = linkBuffer.locationOf<DisassemblyPtrTag>(startLabel);
CodeLocationLabel<DisassemblyPtrTag> end = linkBuffer.locationOf<DisassemblyPtrTag>(endLabel);
RELEASE_ASSERT(end.dataLocation<uintptr_t>() >= start.dataLocation<uintptr_t>());
- disassemble(start, end.dataLocation<uintptr_t>() - start.dataLocation<uintptr_t>(), asmPrefix, out);
+ disassemble(start, end.dataLocation<uintptr_t>() - start.dataLocation<uintptr_t>(), codeStart, codeEnd, asmPrefix, out);
};
for (BasicBlock* block : m_blocks) {
Modified: trunk/Source/_javascript_Core/dfg/DFGDisassembler.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/dfg/DFGDisassembler.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/dfg/DFGDisassembler.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -162,11 +162,14 @@
prefixBuffer[i + prefixLength] = ' ';
prefixBuffer[prefixLength + amountOfNodeWhiteSpace] = 0;
+ void* codeStart = linkBuffer.entrypoint<DisassemblyPtrTag>().untaggedExecutableAddress();
+ void* codeEnd = bitwise_cast<uint8_t*>(codeStart) + linkBuffer.size();
+
CodeLocationLabel<DisassemblyPtrTag> start = linkBuffer.locationOf<DisassemblyPtrTag>(previousLabel);
CodeLocationLabel<DisassemblyPtrTag> end = linkBuffer.locationOf<DisassemblyPtrTag>(currentLabel);
previousLabel = currentLabel;
ASSERT(end.dataLocation<uintptr_t>() >= start.dataLocation<uintptr_t>());
- disassemble(start, end.dataLocation<uintptr_t>() - start.dataLocation<uintptr_t>(), prefixBuffer.data(), out);
+ disassemble(start, end.dataLocation<uintptr_t>() - start.dataLocation<uintptr_t>(), codeStart, codeEnd, prefixBuffer.data(), out);
}
} } // namespace JSC::DFG
Modified: trunk/Source/_javascript_Core/dfg/DFGThunks.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/dfg/DFGThunks.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/dfg/DFGThunks.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -127,7 +127,7 @@
patchBuffer.link(functionCall, FunctionPtr<OperationPtrTag>(operationCompileOSRExit));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "DFG OSR exit generation thunk");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "DFG OSR exit generation thunk");
}
MacroAssemblerCodeRef<JITThunkPtrTag> osrEntryThunkGenerator(VM& vm)
@@ -175,7 +175,7 @@
jit.farJump(GPRInfo::regT1, GPRInfo::callFrameRegister);
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::DFGOSREntry);
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "DFG OSR entry thunk");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "DFG OSR entry thunk");
}
} } // namespace JSC::DFG
Modified: trunk/Source/_javascript_Core/disassembler/ARM64/A64DOpcode.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/disassembler/ARM64/A64DOpcode.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/disassembler/ARM64/A64DOpcode.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,6 +29,10 @@
#include "A64DOpcode.h"
+#include "Disassembler.h"
+#include "ExecutableAllocator.h"
+#include "GPRInfo.h"
+#include "LLIntPCRanges.h"
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
@@ -187,6 +191,28 @@
return m_formatBuffer;
}
+void A64DOpcode::appendPCRelativeOffset(uint32_t* pc, int32_t immediate)
+{
+ uint32_t* targetPC = pc + immediate;
+ constexpr size_t bufferSize = 101;
+ char buffer[bufferSize];
+ const char* targetInfo = buffer;
+ if (!m_startPC)
+ targetInfo = "";
+ else if (targetPC >= m_startPC && targetPC < m_endPC)
+ snprintf(buffer, bufferSize - 1, " -> <%u>", static_cast<unsigned>((targetPC - m_startPC) * sizeof(uint32_t)));
+ else if (const char* thunkLabel = labelForThunk(targetPC))
+ snprintf(buffer, bufferSize - 1, " -> <thunk: %s>", thunkLabel);
+ else if (isJITPC(targetPC))
+ targetInfo = " -> <JIT PC>";
+ else if (LLInt::isLLIntPC(targetPC))
+ targetInfo = " -> <LLInt PC>";
+ else
+ targetInfo = " -> <unknown>";
+
+ bufferPrintf("0x%" PRIxPTR "%s", bitwise_cast<uintptr_t>(targetPC), targetInfo);
+}
+
void A64DOpcode::appendRegisterName(unsigned registerNumber, bool is64Bit)
{
if (registerNumber == 29) {
@@ -412,7 +438,7 @@
const char* A64DOpcodeConditionalBranchImmediate::format()
{
- bufferPrintf(" b.%-5.5s", conditionName(condition()));
+ bufferPrintf(" b.%-7.7s", conditionName(condition()));
appendPCRelativeOffset(m_currentPC, static_cast<int32_t>(immediate19()));
return m_formatBuffer;
}
Modified: trunk/Source/_javascript_Core/disassembler/ARM64/A64DOpcode.h (294179 => 294180)
--- trunk/Source/_javascript_Core/disassembler/ARM64/A64DOpcode.h 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/disassembler/ARM64/A64DOpcode.h 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -73,8 +73,10 @@
public:
static void init();
- A64DOpcode()
- : m_opcode(0)
+ A64DOpcode(uint32_t* startPC = nullptr, uint32_t* endPC = nullptr)
+ : m_startPC(startPC)
+ , m_endPC(endPC)
+ , m_opcode(0)
, m_bufferOffset(0)
{
init();
@@ -185,10 +187,7 @@
bufferPrintf("#0x%" PRIx64, immediate);
}
- void appendPCRelativeOffset(uint32_t* pc, int32_t immediate)
- {
- bufferPrintf("0x%" PRIxPTR, bitwise_cast<uintptr_t>(pc + immediate));
- }
+ void appendPCRelativeOffset(uint32_t* pc, int32_t immediate);
void appendShiftAmount(unsigned amount)
{
@@ -198,6 +197,8 @@
static constexpr int bufferSize = 81;
char m_formatBuffer[bufferSize];
+ uint32_t* m_startPC;
+ uint32_t* m_endPC;
uint32_t* m_currentPC;
uint32_t m_opcode;
int m_bufferOffset;
Modified: trunk/Source/_javascript_Core/disassembler/ARM64Disassembler.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/disassembler/ARM64Disassembler.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/disassembler/ARM64Disassembler.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,15 +33,24 @@
namespace JSC {
-bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, const char* prefix, PrintStream& out)
+bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, void* codeStart, void* codeEnd, const char* prefix, PrintStream& out)
{
- A64DOpcode arm64Opcode;
-
uint32_t* currentPC = codePtr.untaggedExecutableAddress<uint32_t*>();
size_t byteCount = size;
+ uint32_t* armCodeStart = bitwise_cast<uint32_t*>(codeStart);
+ uint32_t* armCodeEnd = bitwise_cast<uint32_t*>(codeEnd);
+ A64DOpcode arm64Opcode(armCodeStart, armCodeEnd);
+
+ unsigned pcOffset = (currentPC - armCodeStart) * sizeof(uint32_t);
+ char pcInfo[25];
while (byteCount) {
- out.printf("%s%#16llx: %s\n", prefix, static_cast<unsigned long long>(bitwise_cast<uintptr_t>(currentPC)), arm64Opcode.disassemble(currentPC));
+ if (codeStart)
+ snprintf(pcInfo, sizeof(pcInfo) - 1, "<%u> %#llx", pcOffset, static_cast<unsigned long long>(bitwise_cast<uintptr_t>(currentPC)));
+ else
+ snprintf(pcInfo, sizeof(pcInfo) - 1, "%#llx", static_cast<unsigned long long>(bitwise_cast<uintptr_t>(currentPC)));
+ out.printf("%s%24s: %s\n", prefix, pcInfo, arm64Opcode.disassemble(currentPC));
+ pcOffset += sizeof(uint32_t);
currentPC++;
byteCount -= sizeof(uint32_t);
}
Modified: trunk/Source/_javascript_Core/disassembler/CapstoneDisassembler.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/disassembler/CapstoneDisassembler.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/disassembler/CapstoneDisassembler.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -33,7 +33,7 @@
namespace JSC {
-bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, const char* prefix, PrintStream& out)
+bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, void*, void*, const char* prefix, PrintStream& out)
{
csh handle;
cs_insn* instructions;
Modified: trunk/Source/_javascript_Core/disassembler/Disassembler.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/disassembler/Disassembler.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/disassembler/Disassembler.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -36,9 +36,12 @@
namespace JSC {
-void disassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, const char* prefix, PrintStream& out)
+using ThunkLabelMap = HashMap<void*, CString>;
+LazyNeverDestroyed<ThunkLabelMap> thunkLabelMap;
+
+void disassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, void* codeStart, void* codeEnd, const char* prefix, PrintStream& out)
{
- if (tryToDisassemble(codePtr, size, prefix, out))
+ if (tryToDisassemble(codePtr, size, codeStart, codeEnd, prefix, out))
return;
out.printf("%sdisassembly not available for range %p...%p\n", prefix, codePtr.untaggedExecutableAddress(), codePtr.untaggedExecutableAddress<char*>() + size);
@@ -65,6 +68,8 @@
char* header { nullptr };
MacroAssemblerCodeRef<DisassemblyPtrTag> codeRef;
size_t size { 0 };
+ void* codeStart { nullptr };
+ void* codeEnd { nullptr };
const char* prefix { nullptr };
};
@@ -105,7 +110,7 @@
}
dataLog(task->header);
- disassemble(task->codeRef.code(), task->size, task->prefix, WTF::dataFile());
+ disassemble(task->codeRef.code(), task->size, task->codeStart, task->codeEnd, task->prefix, WTF::dataFile());
}
}
@@ -131,12 +136,14 @@
} // anonymous namespace
void disassembleAsynchronously(
- const CString& header, const MacroAssemblerCodeRef<DisassemblyPtrTag>& codeRef, size_t size, const char* prefix)
+ const CString& header, const MacroAssemblerCodeRef<DisassemblyPtrTag>& codeRef, size_t size, void* codeStart, void* codeEnd, const char* prefix)
{
std::unique_ptr<DisassemblyTask> task = makeUnique<DisassemblyTask>();
task->header = strdup(header.data()); // Yuck! We need this because CString does racy refcounting.
task->codeRef = codeRef;
task->size = size;
+ task->codeStart = codeStart;
+ task->codeEnd = codeEnd;
task->prefix = prefix;
asynchronousDisassembler().enqueue(WTFMove(task));
@@ -150,5 +157,28 @@
asynchronousDisassembler().waitUntilEmpty();
}
+static ThunkLabelMap& ensureThunkLabelMap()
+{
+ static std::once_flag onceKey;
+ std::call_once(onceKey, [] {
+ thunkLabelMap.construct();
+ });
+ return thunkLabelMap.get();
+}
+
+void registerThunkLabel(void* thunkAddress, CString&& label)
+{
+ ensureThunkLabelMap().add(thunkAddress, WTFMove(label));
+}
+
+const char* labelForThunk(void* thunkAddress)
+{
+ auto& map = ensureThunkLabelMap();
+ auto it = map.find(thunkAddress);
+ if (it == map.end())
+ return nullptr;
+ return it->value.data();
+}
+
} // namespace JSC
Modified: trunk/Source/_javascript_Core/disassembler/Disassembler.h (294179 => 294180)
--- trunk/Source/_javascript_Core/disassembler/Disassembler.h 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/disassembler/Disassembler.h 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,23 +37,31 @@
template<PtrTag> class MacroAssemblerCodeRef;
#if ENABLE(DISASSEMBLER)
-bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>&, size_t, const char* prefix, PrintStream&);
+bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>&, size_t, void* codeStart, void* codeEnd, const char* prefix, PrintStream&);
#else
-inline bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>&, size_t, const char*, PrintStream&)
+inline bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>&, size_t, void*, void*, const char*, PrintStream&)
{
return false;
}
#endif
+inline bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& code, size_t size, const char* prefix, PrintStream& out)
+{
+ return tryToDisassemble(code, size, nullptr, nullptr, prefix, out);
+}
+
// Prints either the disassembly, or a line of text indicating that disassembly failed and
// the range of machine code addresses.
-void disassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>&, size_t, const char* prefix, PrintStream& out);
+void disassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>&, size_t, void* codeStart, void* codeEnd, const char* prefix, PrintStream& out);
// Asynchronous disassembly. This happens on another thread, and calls the provided
// callback when the disassembly is done.
void disassembleAsynchronously(
- const CString& header, const MacroAssemblerCodeRef<DisassemblyPtrTag>&, size_t, const char* prefix);
+ const CString& header, const MacroAssemblerCodeRef<DisassemblyPtrTag>&, size_t, void* codeStart, void* codeEnd, const char* prefix);
JS_EXPORT_PRIVATE void waitForAsynchronousDisassembly();
+void registerThunkLabel(void* thunkAddress, CString&& label);
+const char* labelForThunk(void* thunkAddress);
+
} // namespace JSC
Modified: trunk/Source/_javascript_Core/disassembler/RISCV64Disassembler.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/disassembler/RISCV64Disassembler.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/disassembler/RISCV64Disassembler.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -633,7 +633,7 @@
} // namespace RISCV64Disassembler
-bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, const char* prefix, PrintStream& out)
+bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, void*, void*, const char* prefix, PrintStream& out)
{
uint32_t* currentPC = codePtr.untaggedExecutableAddress<uint32_t*>();
size_t byteCount = size;
Modified: trunk/Source/_javascript_Core/disassembler/X86Disassembler.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/disassembler/X86Disassembler.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/disassembler/X86Disassembler.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -33,7 +33,7 @@
namespace JSC {
-bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, const char* prefix, PrintStream& out)
+bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, void*, void*, const char* prefix, PrintStream& out)
{
ZydisDecoder decoder;
ZydisDecoderInit(&decoder, ZYDIS_MACHINE_MODE_LONG_64, ZYDIS_ADDRESS_WIDTH_64);
Modified: trunk/Source/_javascript_Core/ftl/FTLThunks.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/ftl/FTLThunks.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/ftl/FTLThunks.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -120,7 +120,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::FTLThunk);
patchBuffer.link(functionCall, generationFunction.retagged<OperationPtrTag>());
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "%s", name);
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "%s", name);
}
MacroAssemblerCodeRef<JITThunkPtrTag> osrExitGenerationThunkGenerator(VM& vm)
@@ -243,7 +243,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::FTLThunk);
if (key.callTarget())
patchBuffer.link(call, key.callTarget());
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "FTL slow path call thunk for %s", toCString(key).data());
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "FTL slow path call thunk for %s", toCString(key).data());
}
} } // namespace JSC::FTL
Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/jit/JIT.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2008-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -705,7 +705,7 @@
jit.ret();
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Baseline: generateConsistencyCheck");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: generateConsistencyCheck");
}
void JIT::emitConsistencyCheck()
Modified: trunk/Source/_javascript_Core/jit/JITCall.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/jit/JITCall.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/jit/JITCall.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2008-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -63,7 +63,7 @@
jit.ret();
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Baseline: op_ret_handler");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: op_ret_handler");
}
template<typename Op>
Modified: trunk/Source/_javascript_Core/jit/JITDisassembler.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/jit/JITDisassembler.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/jit/JITDisassembler.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -51,6 +51,9 @@
void JITDisassembler::dump(PrintStream& out, LinkBuffer& linkBuffer)
{
+ m_codeStart = linkBuffer.entrypoint<DisassemblyPtrTag>().untaggedExecutableAddress();
+ m_codeEnd = bitwise_cast<uint8_t*>(m_codeStart) + linkBuffer.size();
+
dumpHeader(out, linkBuffer);
dumpDisassembly(out, linkBuffer, m_startOfCode, m_labelForBytecodeIndexInMainPath[0]);
@@ -162,7 +165,7 @@
{
CodeLocationLabel<DisassemblyPtrTag> fromLocation = linkBuffer.locationOf<DisassemblyPtrTag>(from);
CodeLocationLabel<DisassemblyPtrTag> toLocation = linkBuffer.locationOf<DisassemblyPtrTag>(to);
- disassemble(fromLocation, toLocation.dataLocation<uintptr_t>() - fromLocation.dataLocation<uintptr_t>(), " ", out);
+ disassemble(fromLocation, toLocation.dataLocation<uintptr_t>() - fromLocation.dataLocation<uintptr_t>(), m_codeStart, m_codeEnd, " ", out);
}
} // namespace JSC
Modified: trunk/Source/_javascript_Core/jit/JITDisassembler.h (294179 => 294180)
--- trunk/Source/_javascript_Core/jit/JITDisassembler.h 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/jit/JITDisassembler.h 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -84,6 +84,8 @@
Vector<MacroAssembler::Label> m_labelForBytecodeIndexInSlowPath;
MacroAssembler::Label m_endOfSlowPath;
MacroAssembler::Label m_endOfCode;
+ void* m_codeStart { nullptr };
+ void* m_codeEnd { nullptr };
};
} // namespace JSC
Modified: trunk/Source/_javascript_Core/jit/JITOpcodes.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/jit/JITOpcodes.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2009-2022 Apple Inc. All rights reserved.
* Copyright (C) 2010 Patrick Gansterer <par...@paroga.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -478,7 +478,7 @@
jit.ret();
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Baseline: valueIsFalsey");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: valueIsFalsey");
}
void JIT::emit_op_jeq_null(const JSInstruction* currentInstruction)
@@ -664,7 +664,7 @@
jit.ret();
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Baseline: valueIsTruthy");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: valueIsTruthy");
}
#if USE(JSVALUE64)
@@ -734,7 +734,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
patchBuffer.link(operation, FunctionPtr<OperationPtrTag>(operationThrow));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Baseline: op_throw_handler");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: op_throw_handler");
}
#if USE(JSVALUE64)
@@ -1323,7 +1323,7 @@
if (Options::useDFGJIT())
patchBuffer.link(operationOptimizeCall, FunctionPtr<OperationPtrTag>(operationOptimize));
#endif
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Baseline: op_enter_handler");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: op_enter_handler");
}
void JIT::emit_op_get_scope(const JSInstruction* currentInstruction)
@@ -1568,7 +1568,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
patchBuffer.link(operation, FunctionPtr<OperationPtrTag>(operationHandleTraps));
patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>()));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Baseline: op_check_traps_handler");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: op_check_traps_handler");
}
void JIT::emit_op_new_regexp(const JSInstruction* currentInstruction)
Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2008-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -161,7 +161,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>()));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_by_val_callSlowOperationThenCheckException");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_by_val_callSlowOperationThenCheckException");
}
void JIT::emit_op_get_private_name(const JSInstruction* currentInstruction)
@@ -255,7 +255,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>()));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_private_name_callSlowOperationThenCheckException");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_private_name_callSlowOperationThenCheckException");
}
void JIT::emit_op_set_private_brand(const JSInstruction* currentInstruction)
@@ -477,7 +477,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>()));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_put_by_val_callSlowOperationThenCheckException");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_put_by_val_callSlowOperationThenCheckException");
}
void JIT::emit_op_put_private_name(const JSInstruction* currentInstruction)
@@ -577,7 +577,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>()));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_put_private_name_callSlowOperationThenCheckException");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_put_private_name_callSlowOperationThenCheckException");
}
void JIT::emit_op_put_getter_by_id(const JSInstruction* currentInstruction)
@@ -754,7 +754,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>()));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_del_by_id_callSlowOperationThenCheckException");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_del_by_id_callSlowOperationThenCheckException");
}
void JIT::emit_op_del_by_val(const JSInstruction* currentInstruction)
@@ -865,7 +865,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>()));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_del_by_val_prepareCall");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_del_by_val_prepareCall");
}
void JIT::emit_op_try_get_by_id(const JSInstruction* currentInstruction)
@@ -1090,7 +1090,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>()));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_by_id_callSlowOperationThenCheckException");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_by_id_callSlowOperationThenCheckException");
}
void JIT::emit_op_get_by_id_with_this(const JSInstruction* currentInstruction)
@@ -1190,7 +1190,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>()));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_by_id_with_this_callSlowOperationThenCheckException");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_by_id_with_this_callSlowOperationThenCheckException");
}
void JIT::emit_op_put_by_id(const JSInstruction* currentInstruction)
@@ -1298,7 +1298,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>()));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_put_by_id_callSlowOperationThenCheckException");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_put_by_id_callSlowOperationThenCheckException");
}
void JIT::emit_op_in_by_id(const JSInstruction* currentInstruction)
@@ -1688,7 +1688,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
patchBuffer.link(slowCase, CodeLocationLabel(vm.getCTIStub(slow_op_resolve_scopeGenerator).retaggedCode<NoPtrTag>()));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "resolve_scope thunk");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "resolve_scope thunk");
}
MacroAssemblerCodeRef<JITThunkPtrTag> JIT::slow_op_resolve_scopeGenerator(VM& vm)
@@ -1726,7 +1726,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
patchBuffer.link(operation, FunctionPtr<OperationPtrTag>(operationResolveScopeForBaseline));
patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>()));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_resolve_scope");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_resolve_scope");
}
void JIT::emit_op_get_from_scope(const JSInstruction* currentInstruction)
@@ -1904,7 +1904,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
patchBuffer.link(slowCase, CodeLocationLabel(vm.getCTIStub(slow_op_get_from_scopeGenerator).retaggedCode<NoPtrTag>()));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "get_from_scope thunk");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "get_from_scope thunk");
}
MacroAssemblerCodeRef<JITThunkPtrTag> JIT::slow_op_get_from_scopeGenerator(VM& vm)
@@ -1957,7 +1957,7 @@
patchBuffer.link(operation, FunctionPtr<OperationPtrTag>(operationGetFromScope));
auto handler = vm.getCTIStub(popThunkStackPreservesAndHandleExceptionGenerator);
patchBuffer.link(jumpToHandler, CodeLocationLabel(handler.retaggedCode<NoPtrTag>()));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_from_scope");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_from_scope");
}
void JIT::emit_op_put_to_scope(const JSInstruction* currentInstruction)
@@ -2156,7 +2156,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
patchBuffer.link(operation, FunctionPtr<OperationPtrTag>(operationPutToScope));
patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>()));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_put_to_scope");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_put_to_scope");
}
void JIT::emit_op_get_from_arguments(const JSInstruction* currentInstruction)
Modified: trunk/Source/_javascript_Core/jit/SlowPathCall.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/jit/SlowPathCall.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/jit/SlowPathCall.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2021-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -94,7 +94,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
patchBuffer.link(call, FunctionPtr<OperationPtrTag>(slowPathFunction));
patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>()));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "SlowPathCall");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "SlowPathCall");
}
} // namespace JSC
Modified: trunk/Source/_javascript_Core/jit/SpecializedThunkJIT.h (294179 => 294180)
--- trunk/Source/_javascript_Core/jit/SpecializedThunkJIT.h 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/jit/SpecializedThunkJIT.h 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -159,7 +159,7 @@
patchBuffer.link(m_failures, CodeLocationLabel<JITThunkPtrTag>(fallback));
for (unsigned i = 0; i < m_calls.size(); i++)
patchBuffer.link(m_calls[i].first, m_calls[i].second);
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Specialized thunk for %s", thunkKind);
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Specialized thunk for %s", thunkKind);
}
// Assumes that the target function uses fpRegister0 as the first argument
Modified: trunk/Source/_javascript_Core/jit/ThunkGenerator.h (294179 => 294180)
--- trunk/Source/_javascript_Core/jit/ThunkGenerator.h 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/jit/ThunkGenerator.h 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -35,6 +35,9 @@
using ThunkGenerator = MacroAssemblerCodeRef<JITThunkPtrTag> (*)(VM&);
+#define FINALIZE_THUNK(linkBufferReference, resultPtrTag, ...) \
+ (linkBufferReference.setIsThunk(), FINALIZE_CODE(linkBufferReference, resultPtrTag, __VA_ARGS__))
+
} // namespace JSC
#endif // ENABLE(JIT)
Modified: trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -33,6 +33,7 @@
#include "LLIntThunks.h"
#include "MaxFrameExtentForSlowPathCall.h"
#include "SpecializedThunkJIT.h"
+#include "ThunkGenerator.h"
#include <wtf/InlineASM.h>
#include <wtf/StdIntExtras.h>
#include <wtf/StringPrintStream.h>
@@ -55,7 +56,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
patchBuffer.link(operation, FunctionPtr<OperationPtrTag>(operationLookupExceptionHandler));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "handleException");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "handleException");
}
MacroAssemblerCodeRef<JITThunkPtrTag> handleExceptionWithCallFrameRollbackGenerator(VM& vm)
@@ -71,7 +72,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
patchBuffer.link(operation, FunctionPtr<OperationPtrTag>(operationLookupExceptionHandlerFromCallerFrame));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "handleExceptionWithCallFrameRollback");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "handleExceptionWithCallFrameRollback");
}
MacroAssemblerCodeRef<JITThunkPtrTag> popThunkStackPreservesAndHandleExceptionGenerator(VM& vm)
@@ -88,7 +89,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
auto handler = vm.getCTIStub(handleExceptionGenerator);
patchBuffer.link(continuation, CodeLocationLabel(handler.retaggedCode<NoPtrTag>()));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "popThunkStackPreservesAndHandleException");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "popThunkStackPreservesAndHandleException");
}
MacroAssemblerCodeRef<JITThunkPtrTag> checkExceptionGenerator(VM& vm)
@@ -118,7 +119,7 @@
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk);
patchBuffer.link(handleException, CodeLocationLabel(vm.getCTIStub(handlerGenerator).retaggedCode<NoPtrTag>()));
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "CheckException");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "CheckException");
}
template<typename TagType>
@@ -163,7 +164,7 @@
jit.jumpToExceptionHandler(vm);
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Throw exception from call slow path thunk");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Throw exception from call slow path thunk");
}
static void slowPathFor(CCallHelpers& jit, VM& vm, Sprt_JITOperation_EGCli slowPathFunction)
@@ -232,7 +233,7 @@
slowPathFor(jit, vm, operationLinkCall);
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Link call slow path thunk");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Link call slow path thunk");
}
// For closure optimizations, we only include calls, since if you're using closures for
@@ -244,7 +245,7 @@
slowPathFor(jit, vm, operationLinkPolymorphicCall);
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Link polymorphic call slow path thunk");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Link polymorphic call slow path thunk");
}
// FIXME: We should distinguish between a megamorphic virtual call vs. a slow
@@ -333,7 +334,7 @@
slowPathFor(jit, vm, operationVirtualCall);
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::VirtualThunk);
- return FINALIZE_CODE(
+ return FINALIZE_THUNK(
patchBuffer, JITThunkPtrTag,
"Virtual %s slow path thunk",
mode == CallMode::Regular ? "call" : mode == CallMode::Tail ? "tail call" : "construct");
@@ -486,7 +487,7 @@
jit.jumpToExceptionHandler(vm);
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "%s %s%s trampoline", thunkFunctionType == ThunkFunctionType::JSFunction ? "native" : "internal", entryType == EnterViaJumpWithSavedTags ? "Tail With Saved Tags " : entryType == EnterViaJumpWithoutSavedTags ? "Tail Without Saved Tags " : "", toCString(kind).data());
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "%s %s%s trampoline", thunkFunctionType == ThunkFunctionType::JSFunction ? "native" : "internal", entryType == EnterViaJumpWithSavedTags ? "Tail With Saved Tags " : entryType == EnterViaJumpWithoutSavedTags ? "Tail Without Saved Tags " : "", toCString(kind).data());
}
MacroAssemblerCodeRef<JITThunkPtrTag> nativeCallGenerator(VM& vm)
@@ -665,7 +666,7 @@
#endif // End of USE(JSVALUE32_64) section.
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "fixup arity");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "fixup arity");
}
MacroAssemblerCodeRef<JITThunkPtrTag> unreachableGenerator(VM& vm)
@@ -675,7 +676,7 @@
jit.breakpoint();
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "unreachable thunk");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "unreachable thunk");
}
MacroAssemblerCodeRef<JITThunkPtrTag> stringGetByValGenerator(VM& vm)
@@ -726,7 +727,7 @@
jit.ret();
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
- return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "String get_by_val stub");
+ return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "String get_by_val stub");
}
static void stringCharLoad(SpecializedThunkJIT& jit)
@@ -1417,8 +1418,7 @@
LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::BoundFunctionThunk);
linkBuffer.link(noCode, CodeLocationLabel<JITThunkPtrTag>(vm.jitStubs->ctiNativeTailCallWithoutSavedTags(vm)));
- return FINALIZE_CODE(
- linkBuffer, JITThunkPtrTag, "Specialized thunk for bound function calls with no arguments");
+ return FINALIZE_THUNK(linkBuffer, JITThunkPtrTag, "Specialized thunk for bound function calls with no arguments");
}
MacroAssemblerCodeRef<JITThunkPtrTag> remoteFunctionCallGenerator(VM& vm)
@@ -1627,8 +1627,7 @@
LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::RemoteFunctionThunk);
linkBuffer.link(noCode, CodeLocationLabel<JITThunkPtrTag>(vm.jitStubs->ctiNativeTailCallWithoutSavedTags(vm)));
- return FINALIZE_CODE(
- linkBuffer, JITThunkPtrTag, "Specialized thunk for remote function calls");
+ return FINALIZE_THUNK(linkBuffer, JITThunkPtrTag, "Specialized thunk for remote function calls");
}
} // namespace JSC
Modified: trunk/Source/_javascript_Core/llint/LLIntThunks.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/llint/LLIntThunks.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/llint/LLIntThunks.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -82,7 +82,7 @@
jit.farJump(scratch, OperationPtrTag);
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::LLIntThunk);
- return FINALIZE_CODE(patchBuffer, tag, "LLInt %s thunk", thunkKind);
+ return FINALIZE_THUNK(patchBuffer, tag, "LLInt %s thunk", thunkKind);
}
template<PtrTag tag>
@@ -109,7 +109,7 @@
jit.farJump(scratch, OperationPtrTag);
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::LLIntThunk);
- return FINALIZE_CODE(patchBuffer, tag, "LLInt %s jump to prologue thunk", thunkKind);
+ return FINALIZE_THUNK(patchBuffer, tag, "LLInt %s jump to prologue thunk", thunkKind);
}
template<PtrTag tag>
@@ -119,7 +119,7 @@
assertIsTaggedWith<OperationPtrTag>(target);
jit.farJump(CCallHelpers::TrustedImmPtr(target), OperationPtrTag);
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::LLIntThunk);
- return FINALIZE_CODE(patchBuffer, tag, "LLInt %s return point thunk", thunkKind);
+ return FINALIZE_THUNK(patchBuffer, tag, "LLInt %s return point thunk", thunkKind);
}
template<PtrTag tag>
@@ -419,7 +419,7 @@
jit.farJump(GPRInfo::regT5, OperationPtrTag);
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::LLIntThunk);
- return FINALIZE_CODE(patchBuffer, NativeToJITGatePtrTag, "LLInt %s call gate thunk", name);
+ return FINALIZE_THUNK(patchBuffer, NativeToJITGatePtrTag, "LLInt %s call gate thunk", name);
}
MacroAssemblerCodeRef<NativeToJITGatePtrTag> createWasmGateThunk(void* pointer, PtrTag tag, const char* name)
@@ -431,7 +431,7 @@
jit.farJump(GPRInfo::wasmScratchGPR1, OperationPtrTag);
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::LLIntThunk);
- return FINALIZE_CODE(patchBuffer, NativeToJITGatePtrTag, "LLInt %s wasm call gate thunk", name);
+ return FINALIZE_THUNK(patchBuffer, NativeToJITGatePtrTag, "LLInt %s wasm call gate thunk", name);
}
MacroAssemblerCodeRef<NativeToJITGatePtrTag> createTailCallGate(PtrTag tag, bool untag)
@@ -445,7 +445,7 @@
jit.farJump(GPRInfo::argumentGPR7, tag);
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::LLIntThunk);
- return FINALIZE_CODE(patchBuffer, NativeToJITGatePtrTag, "LLInt tail call gate thunk");
+ return FINALIZE_THUNK(patchBuffer, NativeToJITGatePtrTag, "LLInt tail call gate thunk");
}
MacroAssemblerCodeRef<NativeToJITGatePtrTag> loopOSREntryGateThunk()
@@ -536,7 +536,7 @@
jit.farJump(GPRInfo::regT3, OperationPtrTag);
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::LLIntThunk);
- return FINALIZE_CODE(patchBuffer, NativeToJITGatePtrTag, "tag thunk");
+ return FINALIZE_THUNK(patchBuffer, NativeToJITGatePtrTag, "tag thunk");
}
MacroAssemblerCodeRef<NativeToJITGatePtrTag> untagGateThunk(void* pointer)
@@ -551,7 +551,7 @@
jit.farJump(GPRInfo::regT3, OperationPtrTag);
LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::LLIntThunk);
- return FINALIZE_CODE(patchBuffer, NativeToJITGatePtrTag, "untag thunk");
+ return FINALIZE_THUNK(patchBuffer, NativeToJITGatePtrTag, "untag thunk");
}
#endif // CPU(ARM64E)
Modified: trunk/Source/_javascript_Core/yarr/YarrDisassembler.cpp (294179 => 294180)
--- trunk/Source/_javascript_Core/yarr/YarrDisassembler.cpp 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/yarr/YarrDisassembler.cpp 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -58,6 +58,9 @@
void YarrDisassembler::dump(PrintStream& out, LinkBuffer& linkBuffer)
{
+ m_codeStart = linkBuffer.entrypoint<DisassemblyPtrTag>().untaggedExecutableAddress();
+ m_codeEnd = bitwise_cast<uint8_t*>(m_codeStart) + linkBuffer.size();
+
dumpHeader(out, linkBuffer);
dumpDisassembly(out, indentString(), linkBuffer, m_startOfCode, m_labelForGenerateYarrOp[0]);
@@ -143,7 +146,7 @@
{
CodeLocationLabel<DisassemblyPtrTag> fromLocation = linkBuffer.locationOf<DisassemblyPtrTag>(from);
CodeLocationLabel<DisassemblyPtrTag> toLocation = linkBuffer.locationOf<DisassemblyPtrTag>(to);
- disassemble(fromLocation, toLocation.dataLocation<uintptr_t>() - fromLocation.dataLocation<uintptr_t>(), prefix, out);
+ disassemble(fromLocation, toLocation.dataLocation<uintptr_t>() - fromLocation.dataLocation<uintptr_t>(), m_codeStart, m_codeEnd, prefix, out);
}
}} // namespace Yarr namespace JSC
Modified: trunk/Source/_javascript_Core/yarr/YarrDisassembler.h (294179 => 294180)
--- trunk/Source/_javascript_Core/yarr/YarrDisassembler.h 2022-05-13 22:20:39 UTC (rev 294179)
+++ trunk/Source/_javascript_Core/yarr/YarrDisassembler.h 2022-05-13 22:28:16 UTC (rev 294180)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -106,6 +106,8 @@
MacroAssembler::Label m_endOfGenerate;
MacroAssembler::Label m_endOfBacktrack;
MacroAssembler::Label m_endOfCode;
+ void* m_codeStart { nullptr };
+ void* m_codeEnd { nullptr };
unsigned m_indentLevel { 0 };
};