mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 14:19:48 +00:00
LibJS/Bytecode: Keep instruction source mappings in Executable
Instead of storing source offsets with each instruction, we now keep them in a side table in Executable. This shrinks each instruction by 8 bytes, further improving locality.
This commit is contained in:
parent
4cf4ea92a7
commit
5a08544138
Notes:
sideshowbarker
2024-07-17 02:28:18 +09:00
Author: https://github.com/awesomekling
Commit: 5a08544138
Pull-request: https://github.com/SerenityOS/serenity/pull/24240
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/trflynn89 ✅
8 changed files with 27 additions and 14 deletions
|
@ -106,11 +106,13 @@ UnrealizedSourceRange Executable::source_range_at(size_t offset) const
|
|||
return {};
|
||||
auto it = InstructionStreamIterator(bytecode.span().slice(offset), this);
|
||||
VERIFY(!it.at_end());
|
||||
auto& instruction = *it;
|
||||
auto mapping = source_map.get(offset);
|
||||
if (!mapping.has_value())
|
||||
return {};
|
||||
return UnrealizedSourceRange {
|
||||
.source_code = source_code,
|
||||
.start_offset = instruction.source_record().source_start_offset,
|
||||
.end_offset = instruction.source_record().source_end_offset,
|
||||
.start_offset = mapping->source_start_offset,
|
||||
.end_offset = mapping->source_end_offset,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue