Bug 123629 - OSR exit profiling should be robust against all code being cleared
Summary: OSR exit profiling should be robust against all code being cleared
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Filip Pizlo
Keywords: InRadar
Depends on:
Reported: 2013-11-01 12:44 PDT by Filip Pizlo
Modified: 2013-11-01 15:09 PDT (History)
8 users (show)

See Also:

the patch (9.23 KB, patch)
2013-11-01 12:47 PDT, Filip Pizlo
msaboff: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2013-11-01 12:44:23 PDT
Patch forthcoming.

Comment 1 Filip Pizlo 2013-11-01 12:47:14 PDT
Created attachment 215750 [details]
the patch
Comment 2 Nadav Rotem 2013-11-01 13:10:32 PDT
What do  these functions do ?

CodeBlock* baselineAlternative();

CodeBlock* baselineVersion();
Comment 3 Filip Pizlo 2013-11-01 13:24:12 PDT
(In reply to comment #2)
> What do  these functions do ?

CodeBlock is an object that represents one compilation of a piece of code.  Each piece of code that we load is represented by a ScriptExecutable, and that may have zero or more CodeBlocks.  Zero CodeBlocks if the code hasn't even been parsed yet (we parse everything lazily - as late as at the time of first invocation for functions), one CodeBlock if we're just running baseline code (interpreting or baseline JIT), two CodeBlocks in the DFG case or in the FTL case but without OSR entry, or three Codeblocks in the FTL case if we have:

1) the FTL CodeBlock
2) the baseline Codeblock that we would exit to
3) the special FTL-for-OSR-entry CodeBlock for entering through some loop pre-header

> CodeBlock* baselineAlternative();

Given a CodeBlock, this returns the baseline version of the CodeBlock.  In the FTL example above, each of the three CodeBlocks will return (2).

> CodeBlock* baselineVersion();

Short version: we need to remove this but I don't want to do it in this patch.

Long version: This is basically CodeBlock::replacement()->baselineAlternative().  replacement() returns the CodeBlock that the owning ScriptExecutable claims should be used for entry on future function calls to that code.  This will return the same thing as baselineAlternative() except if we have deleted all code (this happens under memory pressure, for example - or when enabling the debugger), in which case baselineVersion() may return a newer CodeBlock.  For example you may have A->baselineVersion() where A is from before when we deleted all code, in which case this may return a newer CodeBlock B, which is from after when we deleted all code.
Comment 4 Nadav Rotem 2013-11-01 14:52:36 PDT
Okay. I will add a comment after this patch goes it.
Comment 5 Filip Pizlo 2013-11-01 15:09:21 PDT
Landed in http://trac.webkit.org/changeset/158459