1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:57:46 +00:00

LibJS/JIT: Provide source location information for JIT code

This works by walking a backtrace until the currently executing
native executable is found, and then mapping the native address
to its bytecode instruction.
This commit is contained in:
Simon Wanner 2023-10-30 22:06:27 +01:00 committed by Andreas Kling
parent 112eadc863
commit fb7b4b9c59
8 changed files with 59 additions and 6 deletions

View file

@ -8,6 +8,7 @@
#include <AK/Noncopyable.h>
#include <AK/Types.h>
#include <LibJS/Bytecode/Instruction.h>
#include <LibJS/Runtime/Completion.h>
namespace JS::JIT {
@ -33,6 +34,7 @@ public:
void run(VM&) const;
void dump_disassembly(Bytecode::Executable const& executable) const;
BytecodeMapping const& find_mapping_entry(size_t native_offset) const;
Optional<Bytecode::InstructionStreamIterator const&> instruction_stream_iterator(Bytecode::Executable const& executable) const;
ReadonlyBytes code_bytes() const { return { m_code, m_size }; }
@ -40,6 +42,7 @@ private:
void* m_code { nullptr };
size_t m_size { 0 };
Vector<BytecodeMapping> m_mapping;
mutable OwnPtr<Bytecode::InstructionStreamIterator> m_instruction_stream_iterator;
};
}