Deleting many CodeBlocks synchronously during GC can dramatically increase pause times. We should use a similar approach to JSCell sweeping instead to mitigate these costs.
Created attachment 228450 [details] work in progress
Created attachment 228542 [details] work in progress Putting this on hold for the moment. To future me (or whomever picks this up): There's a couple of issues with this patch. (1) You need to make sure that no code assumes that m_alternative (and any other referenced CodeBlocks) is in a consistent state. For example, ProfiledCodeBlockJettisoningWatchpoint can fire after clearing the CodeBlock's m_alternative field but before the CodeBlock is fully destroyed (along with the Watchpoint itself). (2) You also need to make the ref-count of a CodeBlock and its notion of isLive is the same. deleteAllCompiledCode is a tricky thing to get right for this.