Closed Bug 1849287 Opened 11 months ago Closed 8 months ago

Consider introducing compound source note type

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED

People

(Reporter: arai, Unassigned)

References

(Blocks 2 open bugs)

Details

in bug 1845865, I've tried adding more colspan source notes in order to improve the column number preciseness in the error report, but it results in huge increase in the source note size.

in order to mitigate the size increase, we could look into compressing the existing source notes, by introducing compound source note type, so that multiple source note can be expressed in single byte.

for example, SrcNoteType::StepSep and SrcNoteType::Breakpoint are emitted at the same time:

https://searchfox.org/mozilla-central/rev/d81e60336d9f498ad3985491dc17c2b77969ade4/js/src/frontend/BytecodeEmitter.cpp#218,223,227

bool BytecodeEmitter::markStepBreakpoint() {
...
  if (!newSrcNote(SrcNoteType::StepSep)) {
...
  if (!newSrcNote(SrcNoteType::Breakpoint)) {

also, we emit multiple NewLines if there's 2-3 line gap.

https://searchfox.org/mozilla-central/rev/d81e60336d9f498ad3985491dc17c2b77969ade4/js/src/frontend/BytecodeEmitter.cpp#589-593

do {
  if (!newSrcNote(SrcNoteType::NewLine)) {
    return false;
  }
} while (--delta != 0);

there should be more cases where multiple source notes are added to the same opcode,
and compressing common cases should reduce the source note size.

as suggested in bug 1604121 comment, it's better looking into moving line/column/debugger notes into separate array before this.
at least having AssignOp in the same list doesn't make much sense, especially if we want to compress.

Priority: P3 → P5
See Also: → 1604121
Priority: P5 → P3
Depends on: 1849336
Depends on: 1849358
No longer blocks: 1845865
Blocks: 1604121
See Also: 1604121
No longer depends on: sm-error-messages

closing for now.
we can revisit when we found any frequently-used sequence of source notes which can be represented with single note.

Status: NEW → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.