diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-04-11 14:13:24 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-10-16 13:35:34 +0200 |
commit | ad3e13d97367aade27b328306a19d78f68331fa8 (patch) | |
tree | c7b0b0571f36526e49dc112f29122098a80feda1 /src/qml/jit/qv4assemblercommon.cpp | |
parent | 8c614803451ead4ef186d3992dc8fd8d0b93fa37 (diff) |
JSRuntime: Provide an optional symbol table
The method names are only used for debugging purposes. We don't need to
pass them through production code. Centralize the names of all the
runtime methods in a symbol table and only look them up when actually
printing them.
Change-Id: I0d9d7db04b961841242acdbaaa7a2ba29b1f4ff2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jit/qv4assemblercommon.cpp')
-rw-r--r-- | src/qml/jit/qv4assemblercommon.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/qml/jit/qv4assemblercommon.cpp b/src/qml/jit/qv4assemblercommon.cpp index 800ee22cd7..e75f35a665 100644 --- a/src/qml/jit/qv4assemblercommon.cpp +++ b/src/qml/jit/qv4assemblercommon.cpp @@ -96,8 +96,9 @@ private: static void printDisassembledOutputWithCalls(QByteArray processedOutput, const QHash<const void*, const char*>& functions) { - for (QHash<const void*, const char*>::ConstIterator it = functions.begin(), end = functions.end(); - it != end; ++it) { + const auto symbols = Runtime::symbolTable(); + const QByteArray padding(" ; "); + for (auto it = functions.begin(), end = functions.end(); it != end; ++it) { const QByteArray ptrString = "0x" + QByteArray::number(quintptr(it.key()), 16); int idx = 0; while (idx >= 0) { @@ -107,7 +108,9 @@ static void printDisassembledOutputWithCalls(QByteArray processedOutput, idx = processedOutput.indexOf('\n', idx); if (idx < 0) break; - processedOutput = processedOutput.insert(idx, QByteArrayLiteral(" ; ") + it.value()); + const char *functionName = it.value(); + processedOutput = processedOutput.insert( + idx, padding + QByteArray(functionName ? functionName : symbols[it.key()])); } } @@ -302,27 +305,29 @@ void JIT::PlatformAssemblerCommon::passPointerAsArg(void *ptr, int arg) storePtr(TrustedImmPtr(ptr), argStackAddress(arg)); } -void PlatformAssemblerCommon::callRuntime(const char *functionName, const void *funcPtr) +void PlatformAssemblerCommon::callRuntime(const void *funcPtr, const char *functionName) { #ifndef QT_NO_DEBUG Q_ASSERT(remainingArgcForCall == 0); remainingArgcForCall = NoCall; #endif - callRuntimeUnchecked(functionName, funcPtr); + callRuntimeUnchecked(funcPtr, functionName); if (argcOnStackForCall > 0) { addPtr(TrustedImm32(argcOnStackForCall), StackPointerRegister); argcOnStackForCall = 0; } } -void PlatformAssemblerCommon::callRuntimeUnchecked(const char *functionName, const void *funcPtr) +void PlatformAssemblerCommon::callRuntimeUnchecked(const void *funcPtr, const char *functionName) { + Q_ASSERT(functionName || Runtime::symbolTable().contains(funcPtr)); functions.insert(funcPtr, functionName); callAbsolute(funcPtr); } -void PlatformAssemblerCommon::tailCallRuntime(const char *functionName, const void *funcPtr) +void PlatformAssemblerCommon::tailCallRuntime(const void *funcPtr, const char *functionName) { + Q_ASSERT(functionName || Runtime::symbolTable().contains(funcPtr)); functions.insert(funcPtr, functionName); setTailCallArg(EngineRegister, 1); setTailCallArg(CppStackFrameRegister, 0); |