Changeset 294180 in webkit
- Timestamp:
- May 13, 2022, 3:28:16 PM (3 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r294177 r294180 1 2022-05-13 Mark Lam <mark.lam@apple.com> 2 3 Enhance the ARM64Disassembler to print pc indices and better branch target labels. 4 https://bugs.webkit.org/show_bug.cgi?id=240370 5 6 Reviewed by Saam Barati. 7 8 Disassemblies used to look like this: 9 10 0x10e480ff8: ldurb w17, [x0, #7] 11 0x10e480ffc: cmp w17, #0 12 0x10e481000: b.hi 0x10e48103c 13 0x10e481004: stur x0, [fp, #-72] 14 ... 15 0x10e481040: movk x3, #0xfffe, lsl #48 16 0x10e481044: b 0x10e4814f4 17 0x10e481048: nop 18 19 With this patch, it will now look like this: 20 21 <748> 0x10e120aec: ldurb w17, [x0, #7] 22 <752> 0x10e120af0: cmp w17, #0 23 <756> 0x10e120af4: b.hi 0x10e120b30 -> <816> 24 <760> 0x10e120af8: stur x0, [fp, #-80] 25 ... 26 <820> 0x10e120b34: movk x3, #0xfffe, lsl #48 27 <824> 0x10e120b38: b 0x10e120fc8 -> <1992> 28 <828> 0x10e120b3c: nop 29 30 1. Each instruction pc is now prefixed with a pc index i.e. the offset of the 31 pc address from the start of the compilation unit e.g. <756>. 32 33 2. Relative branches now show the branch target as a pc index (effectively, an 34 internal label in this compilation unit) in addition to the pc address e.g. 35 the "-> <816>" in: 36 <756> 0x10e120af4: b.hi 0x10e120b30 -> <816> 37 38 Also fixed a formatting bug where the space between relative branch instructions 39 and their target pc was short 2 spaces. 40 41 3. If the relative branch target is a known thunk, the disassembler will now 42 print the thunk label e.g. 43 44 <828> 0x10e12033c: bl 0x10e0f0a00 -> <thunk: get_from_scope thunk> 45 <1476> 0x10e120dc4: cbnz x16, 0x10e104100 -> <thunk: handleExceptionWithCallFrameRollback> 46 <2368> 0x10e121140: b 0x10e10c000 -> <thunk: DFG OSR exit generation thunk> 47 48 Introduced a FINALIZE_THUNK macro that will be used instead of FINALIZE_CODE in 49 thunk generators. By doing so, thunk labels will automatically be registered 50 with the disassembler, and will be used for the above look up. 51 52 Thunk label registration is only done if disassembly is enabled. 53 54 4. If the branch target is neither an internal label nor a thunk, then the 55 disassembler will print some useful info about it to the best of its 56 knowledge e.g. 57 58 <168> 0x10e1002e8: b 0x10e120b60 -> <JIT PC> 59 <168> 0x10e1002e8: b 0x10e120b60 -> <LLInt PC> 60 <168> 0x10e1002e8: b 0x10e120b60 -> <unknown> 61 62 5. The disassemble() function now takes 2 additional arguments: codeStart, and 63 codeEnd. These are needed so that the disassembler can compute the pc index 64 for each instruction, as well as determine if a branch target is internal to 65 this compilation unit, or pointing out of it. 66 67 This feature is currently only supported for the ARM64 disassembler. 68 69 Printing of JIT operation labels (via movz + movk + indirect branch) is not yet 70 supported. 71 72 * assembler/LinkBuffer.cpp: 73 (JSC::LinkBuffer::finalizeCodeWithDisassemblyImpl): 74 * assembler/LinkBuffer.h: 75 (JSC::LinkBuffer::setIsThunk): 76 * b3/air/AirDisassembler.cpp: 77 (JSC::B3::Air::Disassembler::dump): 78 * dfg/DFGDisassembler.cpp: 79 (JSC::DFG::Disassembler::dumpDisassembly): 80 * dfg/DFGThunks.cpp: 81 (JSC::DFG::osrExitGenerationThunkGenerator): 82 (JSC::DFG::osrEntryThunkGenerator): 83 * disassembler/ARM64/A64DOpcode.cpp: 84 (JSC::ARM64Disassembler::A64DOpcode::appendPCRelativeOffset): 85 (JSC::ARM64Disassembler::A64DOpcodeConditionalBranchImmediate::format): 86 * disassembler/ARM64/A64DOpcode.h: 87 (JSC::ARM64Disassembler::A64DOpcode::A64DOpcode): 88 (JSC::ARM64Disassembler::A64DOpcode::appendPCRelativeOffset): Deleted. 89 * disassembler/ARM64Disassembler.cpp: 90 (JSC::tryToDisassemble): 91 * disassembler/CapstoneDisassembler.cpp: 92 (JSC::tryToDisassemble): 93 * disassembler/Disassembler.cpp: 94 (JSC::disassemble): 95 (JSC::disassembleAsynchronously): 96 (JSC::ensureThunkLabelMap): 97 (JSC::registerThunkLabel): 98 (JSC::labelForThunk): 99 * disassembler/Disassembler.h: 100 (JSC::tryToDisassemble): 101 * disassembler/RISCV64Disassembler.cpp: 102 (JSC::tryToDisassemble): 103 * disassembler/X86Disassembler.cpp: 104 (JSC::tryToDisassemble): 105 * ftl/FTLThunks.cpp: 106 (JSC::FTL::genericGenerationThunkGenerator): 107 (JSC::FTL::slowPathCallThunkGenerator): 108 * jit/JIT.cpp: 109 (JSC::JIT::consistencyCheckGenerator): 110 * jit/JITCall.cpp: 111 (JSC::JIT::returnFromBaselineGenerator): 112 * jit/JITDisassembler.cpp: 113 (JSC::JITDisassembler::dump): 114 (JSC::JITDisassembler::dumpDisassembly): 115 * jit/JITDisassembler.h: 116 * jit/JITOpcodes.cpp: 117 (JSC::JIT::valueIsFalseyGenerator): 118 (JSC::JIT::valueIsTruthyGenerator): 119 (JSC::JIT::op_throw_handlerGenerator): 120 (JSC::JIT::op_enter_handlerGenerator): 121 (JSC::JIT::op_check_traps_handlerGenerator): 122 * jit/JITPropertyAccess.cpp: 123 (JSC::JIT::slow_op_get_by_val_callSlowOperationThenCheckExceptionGenerator): 124 (JSC::JIT::slow_op_get_private_name_callSlowOperationThenCheckExceptionGenerator): 125 (JSC::JIT::slow_op_put_by_val_callSlowOperationThenCheckExceptionGenerator): 126 (JSC::JIT::slow_op_put_private_name_callSlowOperationThenCheckExceptionGenerator): 127 (JSC::JIT::slow_op_del_by_id_callSlowOperationThenCheckExceptionGenerator): 128 (JSC::JIT::slow_op_del_by_val_callSlowOperationThenCheckExceptionGenerator): 129 (JSC::JIT::slow_op_get_by_id_callSlowOperationThenCheckExceptionGenerator): 130 (JSC::JIT::slow_op_get_by_id_with_this_callSlowOperationThenCheckExceptionGenerator): 131 (JSC::JIT::slow_op_put_by_id_callSlowOperationThenCheckExceptionGenerator): 132 (JSC::JIT::generateOpResolveScopeThunk): 133 (JSC::JIT::slow_op_resolve_scopeGenerator): 134 (JSC::JIT::generateOpGetFromScopeThunk): 135 (JSC::JIT::slow_op_get_from_scopeGenerator): 136 (JSC::JIT::slow_op_put_to_scopeGenerator): 137 * jit/SlowPathCall.cpp: 138 (JSC::JITSlowPathCall::generateThunk): 139 * jit/SpecializedThunkJIT.h: 140 (JSC::SpecializedThunkJIT::finalize): 141 * jit/ThunkGenerator.h: 142 * jit/ThunkGenerators.cpp: 143 (JSC::handleExceptionGenerator): 144 (JSC::handleExceptionWithCallFrameRollbackGenerator): 145 (JSC::popThunkStackPreservesAndHandleExceptionGenerator): 146 (JSC::checkExceptionGenerator): 147 (JSC::throwExceptionFromCallSlowPathGenerator): 148 (JSC::linkCallThunkGenerator): 149 (JSC::linkPolymorphicCallThunkGenerator): 150 (JSC::virtualThunkFor): 151 (JSC::nativeForGenerator): 152 (JSC::arityFixupGenerator): 153 (JSC::unreachableGenerator): 154 (JSC::stringGetByValGenerator): 155 (JSC::boundFunctionCallGenerator): 156 (JSC::remoteFunctionCallGenerator): 157 * llint/LLIntThunks.cpp: 158 (JSC::LLInt::generateThunkWithJumpTo): 159 (JSC::LLInt::generateThunkWithJumpToPrologue): 160 (JSC::LLInt::generateThunkWithJumpToLLIntReturnPoint): 161 (JSC::LLInt::createJSGateThunk): 162 (JSC::LLInt::createWasmGateThunk): 163 (JSC::LLInt::createTailCallGate): 164 (JSC::LLInt::tagGateThunk): 165 (JSC::LLInt::untagGateThunk): 166 * yarr/YarrDisassembler.cpp: 167 (JSC::Yarr::YarrDisassembler::dump): 168 (JSC::Yarr::YarrDisassembler::dumpDisassembly): 169 * yarr/YarrDisassembler.h: 170 1 171 2022-05-13 Adrian Perez de Castro <aperez@igalia.com> 2 172 -
trunk/Source/JavaScriptCore/assembler/LinkBuffer.cpp
r288261 r294180 1 1 /* 2 * Copyright (C) 2012-202 1Apple Inc. All rights reserved.2 * Copyright (C) 2012-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 76 76 va_list argList; 77 77 va_start(argList, format); 78 out.vprintf(format, argList); 78 79 if (m_isThunk) { 80 va_list preflightArgs; 81 va_copy(preflightArgs, argList); 82 size_t stringLength = vsnprintf(nullptr, 0, format, preflightArgs); 83 va_end(preflightArgs); 84 85 char* buffer = 0; 86 CString label = CString::newUninitialized(stringLength + 1, buffer); 87 vsnprintf(buffer, stringLength + 1, format, argList); 88 buffer[stringLength] = '\0'; 89 out.printf("%s", buffer); 90 91 registerThunkLabel(result.code().untaggedExecutableAddress(), WTFMove(label)); 92 } else 93 out.vprintf(format, argList); 94 79 95 va_end(argList); 80 96 out.printf(":\n"); … … 91 107 } 92 108 109 void* codeStart = entrypoint<DisassemblyPtrTag>().untaggedExecutableAddress(); 110 void* codeEnd = bitwise_cast<uint8_t*>(codeStart) + size(); 111 93 112 if (Options::asyncDisassembly()) { 94 113 CodeRef<DisassemblyPtrTag> codeRefForDisassembly = result.retagged<DisassemblyPtrTag>(); 95 disassembleAsynchronously(header, WTFMove(codeRefForDisassembly), m_size, " ");114 disassembleAsynchronously(header, WTFMove(codeRefForDisassembly), m_size, codeStart, codeEnd, " "); 96 115 return result; 97 116 } 98 117 99 118 dataLog(header); 100 disassemble(result.retaggedCode<DisassemblyPtrTag>(), m_size, " ", WTF::dataFile());119 disassemble(result.retaggedCode<DisassemblyPtrTag>(), m_size, codeStart, codeEnd, " ", WTF::dataFile()); 101 120 102 121 return result; -
trunk/Source/JavaScriptCore/assembler/LinkBuffer.h
r289417 r294180 1 1 /* 2 * Copyright (C) 2009-202 1Apple Inc. All rights reserved.2 * Copyright (C) 2009-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 343 343 } 344 344 345 void setIsThunk() { m_isThunk = true; } 346 345 347 private: 346 348 JS_EXPORT_PRIVATE CodeRef<LinkBufferPtrTag> finalizeCodeWithoutDisassemblyImpl(); … … 418 420 #endif 419 421 bool m_alreadyDisassembled { false }; 422 bool m_isThunk { false }; 420 423 Profile m_profile { Profile::Uncategorized }; 421 424 MacroAssemblerCodePtr<LinkBufferPtrTag> m_code; -
trunk/Source/JavaScriptCore/b3/air/AirDisassembler.cpp
r261755 r294180 1 1 /* 2 * Copyright (C) 2017-202 0Apple Inc. All rights reserved.2 * Copyright (C) 2017-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 72 72 void Disassembler::dump(Code& code, PrintStream& out, LinkBuffer& linkBuffer, const char* airPrefix, const char* asmPrefix, const ScopedLambda<void(Inst&)>& doToEachInst) 73 73 { 74 void* codeStart = linkBuffer.entrypoint<DisassemblyPtrTag>().untaggedExecutableAddress(); 75 void* codeEnd = bitwise_cast<uint8_t*>(codeStart) + linkBuffer.size(); 76 74 77 auto dumpAsmRange = [&] (CCallHelpers::Label startLabel, CCallHelpers::Label endLabel) { 75 78 RELEASE_ASSERT(startLabel.isSet()); … … 78 81 CodeLocationLabel<DisassemblyPtrTag> end = linkBuffer.locationOf<DisassemblyPtrTag>(endLabel); 79 82 RELEASE_ASSERT(end.dataLocation<uintptr_t>() >= start.dataLocation<uintptr_t>()); 80 disassemble(start, end.dataLocation<uintptr_t>() - start.dataLocation<uintptr_t>(), asmPrefix, out);83 disassemble(start, end.dataLocation<uintptr_t>() - start.dataLocation<uintptr_t>(), codeStart, codeEnd, asmPrefix, out); 81 84 }; 82 85 -
trunk/Source/JavaScriptCore/dfg/DFGDisassembler.cpp
r261895 r294180 1 1 /* 2 * Copyright (C) 2012-20 18Apple Inc. All rights reserved.2 * Copyright (C) 2012-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 163 163 prefixBuffer[prefixLength + amountOfNodeWhiteSpace] = 0; 164 164 165 void* codeStart = linkBuffer.entrypoint<DisassemblyPtrTag>().untaggedExecutableAddress(); 166 void* codeEnd = bitwise_cast<uint8_t*>(codeStart) + linkBuffer.size(); 167 165 168 CodeLocationLabel<DisassemblyPtrTag> start = linkBuffer.locationOf<DisassemblyPtrTag>(previousLabel); 166 169 CodeLocationLabel<DisassemblyPtrTag> end = linkBuffer.locationOf<DisassemblyPtrTag>(currentLabel); 167 170 previousLabel = currentLabel; 168 171 ASSERT(end.dataLocation<uintptr_t>() >= start.dataLocation<uintptr_t>()); 169 disassemble(start, end.dataLocation<uintptr_t>() - start.dataLocation<uintptr_t>(), prefixBuffer.data(), out);172 disassemble(start, end.dataLocation<uintptr_t>() - start.dataLocation<uintptr_t>(), codeStart, codeEnd, prefixBuffer.data(), out); 170 173 } 171 174 -
trunk/Source/JavaScriptCore/dfg/DFGThunks.cpp
r293009 r294180 1 1 /* 2 * Copyright (C) 2011-202 1Apple Inc. All rights reserved.2 * Copyright (C) 2011-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 128 128 patchBuffer.link(functionCall, FunctionPtr<OperationPtrTag>(operationCompileOSRExit)); 129 129 130 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "DFG OSR exit generation thunk");130 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "DFG OSR exit generation thunk"); 131 131 } 132 132 … … 176 176 177 177 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::DFGOSREntry); 178 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "DFG OSR entry thunk");178 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "DFG OSR entry thunk"); 179 179 } 180 180 -
trunk/Source/JavaScriptCore/disassembler/ARM64/A64DOpcode.cpp
r279773 r294180 1 1 /* 2 * Copyright (C) 2012-202 1Apple Inc. All rights reserved.2 * Copyright (C) 2012-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 30 30 #include "A64DOpcode.h" 31 31 32 #include "Disassembler.h" 33 #include "ExecutableAllocator.h" 34 #include "GPRInfo.h" 35 #include "LLIntPCRanges.h" 32 36 #include <stdarg.h> 33 37 #include <stdint.h> … … 188 192 } 189 193 194 void A64DOpcode::appendPCRelativeOffset(uint32_t* pc, int32_t immediate) 195 { 196 uint32_t* targetPC = pc + immediate; 197 constexpr size_t bufferSize = 101; 198 char buffer[bufferSize]; 199 const char* targetInfo = buffer; 200 if (!m_startPC) 201 targetInfo = ""; 202 else if (targetPC >= m_startPC && targetPC < m_endPC) 203 snprintf(buffer, bufferSize - 1, " -> <%u>", static_cast<unsigned>((targetPC - m_startPC) * sizeof(uint32_t))); 204 else if (const char* thunkLabel = labelForThunk(targetPC)) 205 snprintf(buffer, bufferSize - 1, " -> <thunk: %s>", thunkLabel); 206 else if (isJITPC(targetPC)) 207 targetInfo = " -> <JIT PC>"; 208 else if (LLInt::isLLIntPC(targetPC)) 209 targetInfo = " -> <LLInt PC>"; 210 else 211 targetInfo = " -> <unknown>"; 212 213 bufferPrintf("0x%" PRIxPTR "%s", bitwise_cast<uintptr_t>(targetPC), targetInfo); 214 } 215 190 216 void A64DOpcode::appendRegisterName(unsigned registerNumber, bool is64Bit) 191 217 { … … 413 439 const char* A64DOpcodeConditionalBranchImmediate::format() 414 440 { 415 bufferPrintf(" b.%- 5.5s", conditionName(condition()));441 bufferPrintf(" b.%-7.7s", conditionName(condition())); 416 442 appendPCRelativeOffset(m_currentPC, static_cast<int32_t>(immediate19())); 417 443 return m_formatBuffer; -
trunk/Source/JavaScriptCore/disassembler/ARM64/A64DOpcode.h
r279773 r294180 1 1 /* 2 * Copyright (C) 2012-202 1Apple Inc. All rights reserved.2 * Copyright (C) 2012-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 74 74 static void init(); 75 75 76 A64DOpcode() 77 : m_opcode(0) 76 A64DOpcode(uint32_t* startPC = nullptr, uint32_t* endPC = nullptr) 77 : m_startPC(startPC) 78 , m_endPC(endPC) 79 , m_opcode(0) 78 80 , m_bufferOffset(0) 79 81 { … … 186 188 } 187 189 188 void appendPCRelativeOffset(uint32_t* pc, int32_t immediate) 189 { 190 bufferPrintf("0x%" PRIxPTR, bitwise_cast<uintptr_t>(pc + immediate)); 191 } 190 void appendPCRelativeOffset(uint32_t* pc, int32_t immediate); 192 191 193 192 void appendShiftAmount(unsigned amount) … … 199 198 200 199 char m_formatBuffer[bufferSize]; 200 uint32_t* m_startPC; 201 uint32_t* m_endPC; 201 202 uint32_t* m_currentPC; 202 203 uint32_t m_opcode; -
trunk/Source/JavaScriptCore/disassembler/ARM64Disassembler.cpp
r287510 r294180 1 1 /* 2 * Copyright (C) 2012-20 18Apple Inc. All rights reserved.2 * Copyright (C) 2012-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 34 34 namespace JSC { 35 35 36 bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, const char* prefix, PrintStream& out)36 bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, void* codeStart, void* codeEnd, const char* prefix, PrintStream& out) 37 37 { 38 A64DOpcode arm64Opcode;39 40 38 uint32_t* currentPC = codePtr.untaggedExecutableAddress<uint32_t*>(); 41 39 size_t byteCount = size; 42 40 41 uint32_t* armCodeStart = bitwise_cast<uint32_t*>(codeStart); 42 uint32_t* armCodeEnd = bitwise_cast<uint32_t*>(codeEnd); 43 A64DOpcode arm64Opcode(armCodeStart, armCodeEnd); 44 45 unsigned pcOffset = (currentPC - armCodeStart) * sizeof(uint32_t); 46 char pcInfo[25]; 43 47 while (byteCount) { 44 out.printf("%s%#16llx: %s\n", prefix, static_cast<unsigned long long>(bitwise_cast<uintptr_t>(currentPC)), arm64Opcode.disassemble(currentPC)); 48 if (codeStart) 49 snprintf(pcInfo, sizeof(pcInfo) - 1, "<%u> %#llx", pcOffset, static_cast<unsigned long long>(bitwise_cast<uintptr_t>(currentPC))); 50 else 51 snprintf(pcInfo, sizeof(pcInfo) - 1, "%#llx", static_cast<unsigned long long>(bitwise_cast<uintptr_t>(currentPC))); 52 out.printf("%s%24s: %s\n", prefix, pcInfo, arm64Opcode.disassemble(currentPC)); 53 pcOffset += sizeof(uint32_t); 45 54 currentPC++; 46 55 byteCount -= sizeof(uint32_t); -
trunk/Source/JavaScriptCore/disassembler/CapstoneDisassembler.cpp
r287510 r294180 34 34 namespace JSC { 35 35 36 bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, const char* prefix, PrintStream& out)36 bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, void*, void*, const char* prefix, PrintStream& out) 37 37 { 38 38 csh handle; -
trunk/Source/JavaScriptCore/disassembler/Disassembler.cpp
r277958 r294180 1 1 /* 2 * Copyright (C) 2012-20 18Apple Inc. All rights reserved.2 * Copyright (C) 2012-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 37 37 namespace JSC { 38 38 39 void disassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, const char* prefix, PrintStream& out) 39 using ThunkLabelMap = HashMap<void*, CString>; 40 LazyNeverDestroyed<ThunkLabelMap> thunkLabelMap; 41 42 void disassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, void* codeStart, void* codeEnd, const char* prefix, PrintStream& out) 40 43 { 41 if (tryToDisassemble(codePtr, size, prefix, out))44 if (tryToDisassemble(codePtr, size, codeStart, codeEnd, prefix, out)) 42 45 return; 43 46 … … 66 69 MacroAssemblerCodeRef<DisassemblyPtrTag> codeRef; 67 70 size_t size { 0 }; 71 void* codeStart { nullptr }; 72 void* codeEnd { nullptr }; 68 73 const char* prefix { nullptr }; 69 74 }; … … 106 111 107 112 dataLog(task->header); 108 disassemble(task->codeRef.code(), task->size, task-> prefix, WTF::dataFile());113 disassemble(task->codeRef.code(), task->size, task->codeStart, task->codeEnd, task->prefix, WTF::dataFile()); 109 114 } 110 115 } … … 132 137 133 138 void disassembleAsynchronously( 134 const CString& header, const MacroAssemblerCodeRef<DisassemblyPtrTag>& codeRef, size_t size, const char* prefix)139 const CString& header, const MacroAssemblerCodeRef<DisassemblyPtrTag>& codeRef, size_t size, void* codeStart, void* codeEnd, const char* prefix) 135 140 { 136 141 std::unique_ptr<DisassemblyTask> task = makeUnique<DisassemblyTask>(); … … 138 143 task->codeRef = codeRef; 139 144 task->size = size; 145 task->codeStart = codeStart; 146 task->codeEnd = codeEnd; 140 147 task->prefix = prefix; 141 148 … … 151 158 } 152 159 160 static ThunkLabelMap& ensureThunkLabelMap() 161 { 162 static std::once_flag onceKey; 163 std::call_once(onceKey, [] { 164 thunkLabelMap.construct(); 165 }); 166 return thunkLabelMap.get(); 167 } 168 169 void registerThunkLabel(void* thunkAddress, CString&& label) 170 { 171 ensureThunkLabelMap().add(thunkAddress, WTFMove(label)); 172 } 173 174 const char* labelForThunk(void* thunkAddress) 175 { 176 auto& map = ensureThunkLabelMap(); 177 auto it = map.find(thunkAddress); 178 if (it == map.end()) 179 return nullptr; 180 return it->value.data(); 181 } 182 153 183 } // namespace JSC 154 184 -
trunk/Source/JavaScriptCore/disassembler/Disassembler.h
r231027 r294180 1 1 /* 2 * Copyright (C) 2012-20 18Apple Inc. All rights reserved.2 * Copyright (C) 2012-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 38 38 39 39 #if ENABLE(DISASSEMBLER) 40 bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>&, size_t, const char* prefix, PrintStream&);40 bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>&, size_t, void* codeStart, void* codeEnd, const char* prefix, PrintStream&); 41 41 #else 42 inline bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>&, size_t, const char*, PrintStream&)42 inline bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>&, size_t, void*, void*, const char*, PrintStream&) 43 43 { 44 44 return false; … … 46 46 #endif 47 47 48 inline bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& code, size_t size, const char* prefix, PrintStream& out) 49 { 50 return tryToDisassemble(code, size, nullptr, nullptr, prefix, out); 51 } 52 48 53 // Prints either the disassembly, or a line of text indicating that disassembly failed and 49 54 // the range of machine code addresses. 50 void disassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>&, size_t, const char* prefix, PrintStream& out);55 void disassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>&, size_t, void* codeStart, void* codeEnd, const char* prefix, PrintStream& out); 51 56 52 57 // Asynchronous disassembly. This happens on another thread, and calls the provided 53 58 // callback when the disassembly is done. 54 59 void disassembleAsynchronously( 55 const CString& header, const MacroAssemblerCodeRef<DisassemblyPtrTag>&, size_t, const char* prefix);60 const CString& header, const MacroAssemblerCodeRef<DisassemblyPtrTag>&, size_t, void* codeStart, void* codeEnd, const char* prefix); 56 61 57 62 JS_EXPORT_PRIVATE void waitForAsynchronousDisassembly(); 58 63 64 void registerThunkLabel(void* thunkAddress, CString&& label); 65 const char* labelForThunk(void* thunkAddress); 66 59 67 } // namespace JSC -
trunk/Source/JavaScriptCore/disassembler/RISCV64Disassembler.cpp
r287510 r294180 634 634 } // namespace RISCV64Disassembler 635 635 636 bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, const char* prefix, PrintStream& out)636 bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, void*, void*, const char* prefix, PrintStream& out) 637 637 { 638 638 uint32_t* currentPC = codePtr.untaggedExecutableAddress<uint32_t*>(); -
trunk/Source/JavaScriptCore/disassembler/X86Disassembler.cpp
r287510 r294180 34 34 namespace JSC { 35 35 36 bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, const char* prefix, PrintStream& out)36 bool tryToDisassemble(const MacroAssemblerCodePtr<DisassemblyPtrTag>& codePtr, size_t size, void*, void*, const char* prefix, PrintStream& out) 37 37 { 38 38 ZydisDecoder decoder; -
trunk/Source/JavaScriptCore/ftl/FTLThunks.cpp
r291935 r294180 121 121 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::FTLThunk); 122 122 patchBuffer.link(functionCall, generationFunction.retagged<OperationPtrTag>()); 123 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "%s", name);123 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "%s", name); 124 124 } 125 125 … … 244 244 if (key.callTarget()) 245 245 patchBuffer.link(call, key.callTarget()); 246 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "FTL slow path call thunk for %s", toCString(key).data());246 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "FTL slow path call thunk for %s", toCString(key).data()); 247 247 } 248 248 -
trunk/Source/JavaScriptCore/jit/JIT.cpp
r293009 r294180 1 1 /* 2 * Copyright (C) 2008-202 1Apple Inc. All rights reserved.2 * Copyright (C) 2008-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 706 706 707 707 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk); 708 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Baseline: generateConsistencyCheck");708 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: generateConsistencyCheck"); 709 709 } 710 710 -
trunk/Source/JavaScriptCore/jit/JITCall.cpp
r290768 r294180 1 1 /* 2 * Copyright (C) 2008-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2008-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 64 64 65 65 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk); 66 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Baseline: op_ret_handler");66 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: op_ret_handler"); 67 67 } 68 68 -
trunk/Source/JavaScriptCore/jit/JITDisassembler.cpp
r291417 r294180 1 1 /* 2 * Copyright (C) 2012-20 18Apple Inc. All rights reserved.2 * Copyright (C) 2012-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 52 52 void JITDisassembler::dump(PrintStream& out, LinkBuffer& linkBuffer) 53 53 { 54 m_codeStart = linkBuffer.entrypoint<DisassemblyPtrTag>().untaggedExecutableAddress(); 55 m_codeEnd = bitwise_cast<uint8_t*>(m_codeStart) + linkBuffer.size(); 56 54 57 dumpHeader(out, linkBuffer); 55 58 dumpDisassembly(out, linkBuffer, m_startOfCode, m_labelForBytecodeIndexInMainPath[0]); … … 163 166 CodeLocationLabel<DisassemblyPtrTag> fromLocation = linkBuffer.locationOf<DisassemblyPtrTag>(from); 164 167 CodeLocationLabel<DisassemblyPtrTag> toLocation = linkBuffer.locationOf<DisassemblyPtrTag>(to); 165 disassemble(fromLocation, toLocation.dataLocation<uintptr_t>() - fromLocation.dataLocation<uintptr_t>(), " ", out);168 disassemble(fromLocation, toLocation.dataLocation<uintptr_t>() - fromLocation.dataLocation<uintptr_t>(), m_codeStart, m_codeEnd, " ", out); 166 169 } 167 170 -
trunk/Source/JavaScriptCore/jit/JITDisassembler.h
r251690 r294180 1 1 /* 2 * Copyright (C) 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2012-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 85 85 MacroAssembler::Label m_endOfSlowPath; 86 86 MacroAssembler::Label m_endOfCode; 87 void* m_codeStart { nullptr }; 88 void* m_codeEnd { nullptr }; 87 89 }; 88 90 -
trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
r293009 r294180 1 1 /* 2 * Copyright (C) 2009-202 1Apple Inc. All rights reserved.2 * Copyright (C) 2009-2022 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> 4 4 * … … 479 479 480 480 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk); 481 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Baseline: valueIsFalsey");481 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: valueIsFalsey"); 482 482 } 483 483 … … 665 665 666 666 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk); 667 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Baseline: valueIsTruthy");667 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: valueIsTruthy"); 668 668 } 669 669 … … 735 735 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk); 736 736 patchBuffer.link(operation, FunctionPtr<OperationPtrTag>(operationThrow)); 737 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Baseline: op_throw_handler");737 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: op_throw_handler"); 738 738 } 739 739 … … 1324 1324 patchBuffer.link(operationOptimizeCall, FunctionPtr<OperationPtrTag>(operationOptimize)); 1325 1325 #endif 1326 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Baseline: op_enter_handler");1326 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: op_enter_handler"); 1327 1327 } 1328 1328 … … 1569 1569 patchBuffer.link(operation, FunctionPtr<OperationPtrTag>(operationHandleTraps)); 1570 1570 patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>())); 1571 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Baseline: op_check_traps_handler");1571 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: op_check_traps_handler"); 1572 1572 } 1573 1573 -
trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
r292445 r294180 1 1 /* 2 * Copyright (C) 2008-202 1Apple Inc. All rights reserved.2 * Copyright (C) 2008-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 162 162 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk); 163 163 patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>())); 164 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_by_val_callSlowOperationThenCheckException");164 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_by_val_callSlowOperationThenCheckException"); 165 165 } 166 166 … … 256 256 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk); 257 257 patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>())); 258 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_private_name_callSlowOperationThenCheckException");258 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_private_name_callSlowOperationThenCheckException"); 259 259 } 260 260 … … 478 478 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk); 479 479 patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>())); 480 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_put_by_val_callSlowOperationThenCheckException");480 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_put_by_val_callSlowOperationThenCheckException"); 481 481 } 482 482 … … 578 578 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk); 579 579 patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>())); 580 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_put_private_name_callSlowOperationThenCheckException");580 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_put_private_name_callSlowOperationThenCheckException"); 581 581 } 582 582 … … 755 755 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk); 756 756 patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>())); 757 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_del_by_id_callSlowOperationThenCheckException");757 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_del_by_id_callSlowOperationThenCheckException"); 758 758 } 759 759 … … 866 866 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk); 867 867 patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>())); 868 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_del_by_val_prepareCall");868 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_del_by_val_prepareCall"); 869 869 } 870 870 … … 1091 1091 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk); 1092 1092 patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>())); 1093 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_by_id_callSlowOperationThenCheckException");1093 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_by_id_callSlowOperationThenCheckException"); 1094 1094 } 1095 1095 … … 1191 1191 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk); 1192 1192 patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>())); 1193 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_by_id_with_this_callSlowOperationThenCheckException");1193 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_by_id_with_this_callSlowOperationThenCheckException"); 1194 1194 } 1195 1195 … … 1299 1299 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk); 1300 1300 patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>())); 1301 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_put_by_id_callSlowOperationThenCheckException");1301 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_put_by_id_callSlowOperationThenCheckException"); 1302 1302 } 1303 1303 … … 1689 1689 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk); 1690 1690 patchBuffer.link(slowCase, CodeLocationLabel(vm.getCTIStub(slow_op_resolve_scopeGenerator).retaggedCode<NoPtrTag>())); 1691 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "resolve_scope thunk");1691 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "resolve_scope thunk"); 1692 1692 } 1693 1693 … … 1727 1727 patchBuffer.link(operation, FunctionPtr<OperationPtrTag>(operationResolveScopeForBaseline)); 1728 1728 patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>())); 1729 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_resolve_scope");1729 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_resolve_scope"); 1730 1730 } 1731 1731 … … 1905 1905 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk); 1906 1906 patchBuffer.link(slowCase, CodeLocationLabel(vm.getCTIStub(slow_op_get_from_scopeGenerator).retaggedCode<NoPtrTag>())); 1907 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "get_from_scope thunk");1907 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "get_from_scope thunk"); 1908 1908 } 1909 1909 … … 1958 1958 auto handler = vm.getCTIStub(popThunkStackPreservesAndHandleExceptionGenerator); 1959 1959 patchBuffer.link(jumpToHandler, CodeLocationLabel(handler.retaggedCode<NoPtrTag>())); 1960 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_from_scope");1960 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_get_from_scope"); 1961 1961 } 1962 1962 … … 2157 2157 patchBuffer.link(operation, FunctionPtr<OperationPtrTag>(operationPutToScope)); 2158 2158 patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>())); 2159 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_put_to_scope");2159 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Baseline: slow_op_put_to_scope"); 2160 2160 } 2161 2161 -
trunk/Source/JavaScriptCore/jit/SlowPathCall.cpp
r290647 r294180 1 1 /* 2 * Copyright (C) 2021 Apple Inc. All rights reserved.2 * Copyright (C) 2021-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 95 95 patchBuffer.link(call, FunctionPtr<OperationPtrTag>(slowPathFunction)); 96 96 patchBuffer.link(exceptionCheck, CodeLocationLabel(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>())); 97 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "SlowPathCall");97 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "SlowPathCall"); 98 98 } 99 99 -
trunk/Source/JavaScriptCore/jit/SpecializedThunkJIT.h
r277928 r294180 1 1 /* 2 * Copyright (C) 2010-202 1Apple Inc. All rights reserved.2 * Copyright (C) 2010-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 160 160 for (unsigned i = 0; i < m_calls.size(); i++) 161 161 patchBuffer.link(m_calls[i].first, m_calls[i].second); 162 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Specialized thunk for %s", thunkKind);162 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Specialized thunk for %s", thunkKind); 163 163 } 164 164 -
trunk/Source/JavaScriptCore/jit/ThunkGenerator.h
r249175 r294180 1 1 /* 2 * Copyright (C) 2012-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2012-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 36 36 using ThunkGenerator = MacroAssemblerCodeRef<JITThunkPtrTag> (*)(VM&); 37 37 38 #define FINALIZE_THUNK(linkBufferReference, resultPtrTag, ...) \ 39 (linkBufferReference.setIsThunk(), FINALIZE_CODE(linkBufferReference, resultPtrTag, __VA_ARGS__)) 40 38 41 } // namespace JSC 39 42 -
trunk/Source/JavaScriptCore/jit/ThunkGenerators.cpp
r293203 r294180 34 34 #include "MaxFrameExtentForSlowPathCall.h" 35 35 #include "SpecializedThunkJIT.h" 36 #include "ThunkGenerator.h" 36 37 #include <wtf/InlineASM.h> 37 38 #include <wtf/StdIntExtras.h> … … 56 57 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk); 57 58 patchBuffer.link(operation, FunctionPtr<OperationPtrTag>(operationLookupExceptionHandler)); 58 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "handleException");59 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "handleException"); 59 60 } 60 61 … … 72 73 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk); 73 74 patchBuffer.link(operation, FunctionPtr<OperationPtrTag>(operationLookupExceptionHandlerFromCallerFrame)); 74 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "handleExceptionWithCallFrameRollback");75 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "handleExceptionWithCallFrameRollback"); 75 76 } 76 77 … … 89 90 auto handler = vm.getCTIStub(handleExceptionGenerator); 90 91 patchBuffer.link(continuation, CodeLocationLabel(handler.retaggedCode<NoPtrTag>())); 91 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "popThunkStackPreservesAndHandleException");92 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "popThunkStackPreservesAndHandleException"); 92 93 } 93 94 … … 119 120 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::ExtraCTIThunk); 120 121 patchBuffer.link(handleException, CodeLocationLabel(vm.getCTIStub(handlerGenerator).retaggedCode<NoPtrTag>())); 121 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "CheckException");122 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "CheckException"); 122 123 } 123 124 … … 164 165 165 166 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk); 166 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Throw exception from call slow path thunk");167 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Throw exception from call slow path thunk"); 167 168 } 168 169 … … 233 234 234 235 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk); 235 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Link call slow path thunk");236 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Link call slow path thunk"); 236 237 } 237 238 … … 245 246 246 247 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk); 247 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "Link polymorphic call slow path thunk");248 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "Link polymorphic call slow path thunk"); 248 249 } 249 250 … … 334 335 335 336 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::VirtualThunk); 336 return FINALIZE_ CODE(337 return FINALIZE_THUNK( 337 338 patchBuffer, JITThunkPtrTag, 338 339 "Virtual %s slow path thunk", … … 487 488 488 489 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk); 489 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());490 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()); 490 491 } 491 492 … … 666 667 667 668 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk); 668 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "fixup arity");669 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "fixup arity"); 669 670 } 670 671 … … 676 677 677 678 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk); 678 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "unreachable thunk");679 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "unreachable thunk"); 679 680 } 680 681 … … 727 728 728 729 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk); 729 return FINALIZE_ CODE(patchBuffer, JITThunkPtrTag, "String get_by_val stub");730 return FINALIZE_THUNK(patchBuffer, JITThunkPtrTag, "String get_by_val stub"); 730 731 } 731 732 … … 1418 1419 LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::BoundFunctionThunk); 1419 1420 linkBuffer.link(noCode, CodeLocationLabel<JITThunkPtrTag>(vm.jitStubs->ctiNativeTailCallWithoutSavedTags(vm))); 1420 return FINALIZE_CODE( 1421 linkBuffer, JITThunkPtrTag, "Specialized thunk for bound function calls with no arguments"); 1421 return FINALIZE_THUNK(linkBuffer, JITThunkPtrTag, "Specialized thunk for bound function calls with no arguments"); 1422 1422 } 1423 1423 … … 1628 1628 LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::RemoteFunctionThunk); 1629 1629 linkBuffer.link(noCode, CodeLocationLabel<JITThunkPtrTag>(vm.jitStubs->ctiNativeTailCallWithoutSavedTags(vm))); 1630 return FINALIZE_CODE( 1631 linkBuffer, JITThunkPtrTag, "Specialized thunk for remote function calls"); 1630 return FINALIZE_THUNK(linkBuffer, JITThunkPtrTag, "Specialized thunk for remote function calls"); 1632 1631 } 1633 1632 -
trunk/Source/JavaScriptCore/llint/LLIntThunks.cpp
r286901 r294180 1 1 /* 2 * Copyright (C) 2012-202 1Apple Inc. All rights reserved.2 * Copyright (C) 2012-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 83 83 84 84 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::LLIntThunk); 85 return FINALIZE_ CODE(patchBuffer, tag, "LLInt %s thunk", thunkKind);85 return FINALIZE_THUNK(patchBuffer, tag, "LLInt %s thunk", thunkKind); 86 86 } 87 87 … … 110 110 111 111 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::LLIntThunk); 112 return FINALIZE_ CODE(patchBuffer, tag, "LLInt %s jump to prologue thunk", thunkKind);112 return FINALIZE_THUNK(patchBuffer, tag, "LLInt %s jump to prologue thunk", thunkKind); 113 113 } 114 114 … … 120 120 jit.farJump(CCallHelpers::TrustedImmPtr(target), OperationPtrTag); 121 121 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::LLIntThunk); 122 return FINALIZE_ CODE(patchBuffer, tag, "LLInt %s return point thunk", thunkKind);122 return FINALIZE_THUNK(patchBuffer, tag, "LLInt %s return point thunk", thunkKind); 123 123 } 124 124 … … 420 420 421 421 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::LLIntThunk); 422 return FINALIZE_ CODE(patchBuffer, NativeToJITGatePtrTag, "LLInt %s call gate thunk", name);422 return FINALIZE_THUNK(patchBuffer, NativeToJITGatePtrTag, "LLInt %s call gate thunk", name); 423 423 } 424 424 … … 432 432 433 433 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::LLIntThunk); 434 return FINALIZE_ CODE(patchBuffer, NativeToJITGatePtrTag, "LLInt %s wasm call gate thunk", name);434 return FINALIZE_THUNK(patchBuffer, NativeToJITGatePtrTag, "LLInt %s wasm call gate thunk", name); 435 435 } 436 436 … … 446 446 447 447 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::LLIntThunk); 448 return FINALIZE_ CODE(patchBuffer, NativeToJITGatePtrTag, "LLInt tail call gate thunk");448 return FINALIZE_THUNK(patchBuffer, NativeToJITGatePtrTag, "LLInt tail call gate thunk"); 449 449 } 450 450 … … 537 537 538 538 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::LLIntThunk); 539 return FINALIZE_ CODE(patchBuffer, NativeToJITGatePtrTag, "tag thunk");539 return FINALIZE_THUNK(patchBuffer, NativeToJITGatePtrTag, "tag thunk"); 540 540 } 541 541 … … 552 552 553 553 LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::LLIntThunk); 554 return FINALIZE_ CODE(patchBuffer, NativeToJITGatePtrTag, "untag thunk");554 return FINALIZE_THUNK(patchBuffer, NativeToJITGatePtrTag, "untag thunk"); 555 555 } 556 556 -
trunk/Source/JavaScriptCore/yarr/YarrDisassembler.cpp
r234713 r294180 1 1 /* 2 * Copyright (C) 2018 Apple Inc. All rights reserved.2 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 59 59 void YarrDisassembler::dump(PrintStream& out, LinkBuffer& linkBuffer) 60 60 { 61 m_codeStart = linkBuffer.entrypoint<DisassemblyPtrTag>().untaggedExecutableAddress(); 62 m_codeEnd = bitwise_cast<uint8_t*>(m_codeStart) + linkBuffer.size(); 63 61 64 dumpHeader(out, linkBuffer); 62 65 dumpDisassembly(out, indentString(), linkBuffer, m_startOfCode, m_labelForGenerateYarrOp[0]); … … 144 147 CodeLocationLabel<DisassemblyPtrTag> fromLocation = linkBuffer.locationOf<DisassemblyPtrTag>(from); 145 148 CodeLocationLabel<DisassemblyPtrTag> toLocation = linkBuffer.locationOf<DisassemblyPtrTag>(to); 146 disassemble(fromLocation, toLocation.dataLocation<uintptr_t>() - fromLocation.dataLocation<uintptr_t>(), prefix, out);149 disassemble(fromLocation, toLocation.dataLocation<uintptr_t>() - fromLocation.dataLocation<uintptr_t>(), m_codeStart, m_codeEnd, prefix, out); 147 150 } 148 151 -
trunk/Source/JavaScriptCore/yarr/YarrDisassembler.h
r234713 r294180 1 1 /* 2 * Copyright (C) 2018 Apple Inc. All rights reserved.2 * Copyright (C) 2018-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 107 107 MacroAssembler::Label m_endOfBacktrack; 108 108 MacroAssembler::Label m_endOfCode; 109 void* m_codeStart { nullptr }; 110 void* m_codeEnd { nullptr }; 109 111 unsigned m_indentLevel { 0 }; 110 112 };
Note:
See TracChangeset
for help on using the changeset viewer.