mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 03:09:08 +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:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user