src: reduce scope of code cache mutex
As indicated in the added comment, this can lead to a deadlock
otherwise. In the concrete instance in which I encountered this,
the relevant nested call is the one to require('internal/tty')
inside of the afterInspector()
function for uncaught exception
handling.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines