Skip to content

Diagnosing SpiderMonkey JIT issues

Josh Matthews edited this page Apr 1, 2020 · 4 revisions

When a profile shows significant time every frame being spent in JIT compilation methods, it's time to dig into why the JIT is always compiling.

  1. Build with --features jitspew.
  2. Add cargo features for jitspew to ports/libsimpleservo/{api,capi}, components/servo, and components/script that enable js/jitspew
  3. Build with --features jitspew
  4. Set the IONFLAGS environment variable when running Servo (for UWP, add a SetEnvironmentVariable(L"IONFLAGS", L""); to the start of Servo::Servo() in support/hololens/ServoApp/ServoControl/Servo.cpp)
  5. Use https://github.com/servo/servo/issues/25971#issuecomment-599788397 and https://github.com/servo/servo/issues/25971#issuecomment-600659203 to post-process the output logs of IONFLAGS-enabled builds to identify the most frequent JIT invalidation offenders and narrow the focus of the investigation.
  6. With the help of #spidermonkey, solicit help in understanding the context for the bailouts and create a minimal testcase if possible.

Useful IONFLAGS values

  • scripts - print a message every time IonMonkey starts compiling a script. Useful to determine if the JIT is actually thrashing a bunch when performance is poor.
  • bailouts,osi - print messages that point out specific JITted functions that get invalidated at runtime. These end up trigger recompilations if they keep being run, and contain line and column numbers.
  • bl-bails - print messages that provide information about why bailouts occur that trigger invalidations. These provide insight into the kind of problems the JIT is encountering such as polymorphic use of types or numeric specializations becoming invalid over time.
  • All IONFLAGS values can be combined with , for maximal output.
Clone this wiki locally