diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-11-14 15:58:39 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-22 14:54:36 +0100 |
commit | 85fea8a68b90c817c47022ca5157ff80cb497d4d (patch) | |
tree | a35010ed51fb282d4c727631cb9ce42603d26a80 /src/qml/compiler | |
parent | bf173fe5da381c88343296ca33ef6b06389c6d20 (diff) |
Saner and simpler way to handle line numbers for JITed code
Instead of storing the current instruction pointer in the
ExecutionContext, we might as well directly store the current
line number there.
Leads to simpler code, works cross platform and should also
be faster.
Change-Id: Ifb7897cf8dbe8a962505fe876aa3ed43283ebb06
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/compiler')
-rw-r--r-- | src/qml/compiler/qv4isel_masm.cpp | 21 | ||||
-rw-r--r-- | src/qml/compiler/qv4isel_masm_p.h | 26 |
2 files changed, 2 insertions, 45 deletions
diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp index 91cc5a9b4e..aca28eac2c 100644 --- a/src/qml/compiler/qv4isel_masm.cpp +++ b/src/qml/compiler/qv4isel_masm.cpp @@ -439,15 +439,6 @@ static void printDisassembledOutputWithCalls(const char* output, const QHash<voi } #endif -void Assembler::recordLineNumber(int lineNumber) -{ - CodeLineNumerMapping mapping; - mapping.location = label(); - mapping.lineNumber = lineNumber; - codeLineNumberMappings << mapping; -} - - JSC::MacroAssemblerCodeRef Assembler::link(int *codeSize) { Label endOfCode = label(); @@ -467,14 +458,6 @@ JSC::MacroAssemblerCodeRef Assembler::link(int *codeSize) JSC::JSGlobalData dummy(_executableAllocator); JSC::LinkBuffer linkBuffer(dummy, this, 0); - QVector<uint> lineNumberMapping(codeLineNumberMappings.count() * 2); - - for (int i = 0; i < codeLineNumberMappings.count(); ++i) { - lineNumberMapping[i * 2] = linkBuffer.offsetOf(codeLineNumberMappings.at(i).location); - lineNumberMapping[i * 2 + 1] = codeLineNumberMappings.at(i).lineNumber; - } - _isel->jsUnitGenerator()->registerLineNumberMapping(_function, lineNumberMapping); - QHash<void*, const char*> functions; foreach (CallToLink ctl, _callsToLink) { linkBuffer.link(ctl.call, ctl.externalFunction); @@ -642,9 +625,9 @@ void InstructionSelection::run(int functionIndex) foreach (V4IR::Stmt *s, _block->statements) { if (s->location.isValid()) { - _as->recordLineNumber(s->location.startLine); if (int(s->location.startLine) != lastLine) { - _as->saveInstructionPointer(Assembler::ScratchRegister); + Assembler::Address lineAddr(Assembler::ContextRegister, qOffsetOf(QV4::ExecutionContext, lineNumber)); + _as->store32(Assembler::TrustedImm32(s->location.startLine), lineAddr); lastLine = s->location.startLine; } } diff --git a/src/qml/compiler/qv4isel_masm_p.h b/src/qml/compiler/qv4isel_masm_p.h index e3b41857ea..570400656a 100644 --- a/src/qml/compiler/qv4isel_masm_p.h +++ b/src/qml/compiler/qv4isel_masm_p.h @@ -466,23 +466,6 @@ public: V4IR::BasicBlock *block; }; - void saveInstructionPointer(RegisterID freeScratchRegister) { - Address ipAddr(ContextRegister, qOffsetOf(QV4::ExecutionContext, jitInstructionPointer)); - RegisterID sourceRegister = freeScratchRegister; - -#if CPU(X86_64) || CPU(X86) - callToRetrieveIP(); - peek(sourceRegister); - pop(); -#elif CPU(ARM) - move(JSC::ARMRegisters::pc, sourceRegister); -#else -#error "Port me!" -#endif - - storePtr(sourceRegister, ipAddr); - } - void callAbsolute(const char* functionName, FunctionPtr function) { CallToLink ctl; ctl.call = call(); @@ -1397,8 +1380,6 @@ public: JSC::MacroAssemblerCodeRef link(int *codeSize); - void recordLineNumber(int lineNumber); - const StackLayout stackLayout() const { return _stackLayout; } ConstantTable &constantTable() { return _constTable; } @@ -1424,13 +1405,6 @@ private: QV4::ExecutableAllocator *_executableAllocator; InstructionSelection *_isel; - - struct CodeLineNumerMapping - { - Assembler::Label location; - int lineNumber; - }; - QVector<CodeLineNumerMapping> codeLineNumberMappings; }; template <typename T> inline void prepareRelativeCall(const T &, Assembler *){} |