Closed Bug 1292710 Opened 8 years ago Closed 2 years ago

Make TraceLogger VM events toggleable at runtime

Categories

(Core :: JavaScript Engine: JIT, enhancement, P5)

enhancement

Tracking

()

RESOLVED WONTFIX

People

(Reporter: mismith, Unassigned)

References

Details

Assignee: nobody → mismith
How best to do this?
Depends on: 1287161
Flags: needinfo?(hv1989)
For the moment I think the best way would be to always generate the code but out of line (i.e. after the return statement in the wrapper). In the vmwrapper we would put a patchable nop. Upon enabling the tracing of VMCalls or VMSpecific we can replace this nop with a jump to this out of line code. When wanting to disable it, we can just put a nop there again.

1) In order to toggle a "nop" into jump and back we need a place we can adjust. This is done with:
masm.nopPatchableToNearJump()

2) Having the offset we can use the following instruction to adjust the jump to nop or to a specific location:
MacroAssembler::patchNopToNearJump

3) We have a list of all VMFunctions in VMFunction::functions, making it possible to iterate and toggle it at runtime.

4) When toggling don't forget to make that part of the code writable using AutoWritableJitCode. By default we lock it to be only executable.

There are possible optimization of this basic approach. Since this approach might adds a lot of code on every VM wrapper. We might decrease the amount of code later if it it is too large. I.e. make the out of line code just a call to a global "tl enter/exit vm wrapper" and use return to get back.
Flags: needinfo?(hv1989)
Priority: -- → P5
Assignee: lists → nobody
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.