Open Bug 1548775 Opened 7 years ago Updated 3 years ago

Stop eagerly allocating profile strings

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

Tracking Status
firefox68 --- fix-optional

People

(Reporter: jandem, Unassigned)

References

(Depends on 1 open bug)

Details

We currently allocate these strings here:

https://searchfox.org/mozilla-central/rev/7944190ad1668a94223b950a19f1fffe8662d6b8/js/src/vm/GeckoProfiler.cpp#155
https://searchfox.org/mozilla-central/rev/7944190ad1668a94223b950a19f1fffe8662d6b8/js/src/jit/JitcodeMap.cpp#280

The strings then end up in the JitCodeMap or in the interpreter's profiler pseudo stack. The sampler thread gets the strings from there and copies them into the profiler's buffer (multiple entries with up to 8 chars). This isn't very efficient.

For the interpreter work I need a different approach. I'm considering something like this:

  • Sampler thread stores the JSScript* and bytecode offset in the buffer.

  • When we GC or finish profiling (whichever comes first) the main thread iterates this buffer and replaces all JSScript* pointers with the corresponding script string. GC could also trace the scripts but then we risk keeping them alive much longer when profiling, skewing the results.

Hey Markus, any thoughts/pointers on this?

Flags: needinfo?(mstange)
Depends on: 1548510
Depends on: 1549735

(In reply to Jan de Mooij [:jandem] from comment #1)

Hey Markus, any thoughts/pointers on this?

Answered on the email thread about this. The rough plan in comment 0 sounds good.

Flags: needinfo?(mstange)
Priority: -- → P2
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.