When concurrency optimization is triggered, a new optimization job will be dispatched to a child-thread to complete.
How does Runtime know that the optimization job has been completed?
I’ve found that in runtime function StackGuard
, the optimized code will be set in JSFunction, but I don’t know how this function is triggered.
Advertisement
Answer
When an optimization job is complete, it signals that fact to the main thread. See the call to isolate_->stack_guard()->RequestInstallCode()
in optimizing-compile-dispatcher.cc
. The next stack check in a function will then notice that there is a pending request, and enter the StackGuard function you’ve already found.