Bug 22897 - Clear bytecode vector after JITing
Summary: Clear bytecode vector after JITing
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-16 23:09 PST by Sam Weinig
Modified: 2008-12-17 13:31 PST (History)
0 users

See Also:


Attachments
patch (3.95 KB, patch)
2008-12-16 23:10 PST, Sam Weinig
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2008-12-16 23:09:05 PST
Clearing the bytecode vector after JITing will save about 4.8MB on Membuster head.
Comment 1 Sam Weinig 2008-12-16 23:10:02 PST
Created attachment 26087 [details]
patch
Comment 2 Darin Adler 2008-12-17 10:00:21 PST
Comment on attachment 26087 [details]
patch

> +        (JSC::CodeBlock::handlerForBytecodeOffset): Don't assert that the offset
> +        is less than the size of the bytecode vector since it may have been cleared
> +        and therefore 0.

I think it would be better to keep around the size of the bytecode vector in a separate variable in debug versions so we could keep these assertions.

r=me
Comment 3 Geoffrey Garen 2008-12-17 11:41:20 PST
Comment on attachment 26087 [details]
patch

>      m_codeBlock->setJITCode(codeRef);
> +#if !ENABLE(OPCODE_SAMPLING)
> +    m_codeBlock->instructions().clear();
> +#endif

I think it would be better to do this:

#if ENABLE(OPCODE_SAMPLING)
    // Don't clear instructions -- we need them for sampling.
#elsif !defined(NDEBUG)
    if (!s_dumpsGeneratedCode)
        m_codeBlock->instructions().clear();
#else
    m_codeBlock->instructions().clear();
#endif
Comment 4 Geoffrey Garen 2008-12-17 11:41:56 PST
> I think it would be better to do this:

That way, you can still dump code in debug builds.
Comment 5 Sam Weinig 2008-12-17 13:31:45 PST
Fixed in r39366.