Bug 131051

Summary: Deleting CodeBlocks should be lazy/incremental
Product: WebKit Reporter: Mark Hahnenberg <mhahnenberg>
Component: JavaScriptCoreAssignee: Mark Hahnenberg <mhahnenberg>
Status: NEW ---    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
work in progress
none
work in progress none

Description Mark Hahnenberg 2014-04-01 12:07:51 PDT
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.
Comment 1 Mark Hahnenberg 2014-04-02 17:28:47 PDT
Created attachment 228450 [details]
work in progress
Comment 2 Mark Hahnenberg 2014-04-03 14:07:31 PDT
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.