Bug 136141

Summary: r171362 accidentally increased the size of InlineCallFrame
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: JavaScriptCoreAssignee: Mark Lam <mark.lam>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, fpizlo
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
The patch
mark.lam: review-
patch 2: with correct limits
none
patch 3: with better assertion. none

Description Mark Lam 2014-08-21 17:50:02 PDT
r171362 increased the size of InlineCallFrame::kind to 2 bits.  This increased the size of InlineCallFrame from 72 to 80 though not intentionally.  The fix is to reduce the size of InlineCallFrame::stackOffset to 29 bits.
Comment 1 Mark Lam 2014-08-21 17:54:34 PDT
Created attachment 236948 [details]
The patch
Comment 2 Mark Lam 2014-08-21 17:57:10 PDT
Comment on attachment 236948 [details]
The patch

View in context: https://bugs.webkit.org/attachment.cgi?id=236948&action=review

> Source/JavaScriptCore/bytecode/CodeOrigin.h:164
> +    static const int maxStackOffset = (1 << 29) - 1;
> +    static const int minStackOffset = (~0 << 29);

Wrong limits.
Comment 3 Mark Lam 2014-08-21 17:58:21 PDT
Created attachment 236949 [details]
patch 2: with correct limits
Comment 4 Filip Pizlo 2014-08-21 18:17:46 PDT
Comment on attachment 236949 [details]
patch 2: with correct limits

View in context: https://bugs.webkit.org/attachment.cgi?id=236949&action=review

> Source/JavaScriptCore/bytecode/CodeOrigin.h:207
> +    void setStackOffset(signed offset)
> +    {
> +        RELEASE_ASSERT(minStackOffset <= offset && offset <= maxStackOffset);
> +        stackOffset = offset;
> +    }

Why can't this just be:

void setStackOffset(signed offset)
{
    stackOffset = offset;
    RELEASE_ASSERT(static_cast<signed>(stackOffset) == offset);
}

Then you can get rid of the minStackOffset/maxStackOffset constants.
Comment 5 Mark Lam 2014-08-21 21:11:18 PDT
(In reply to comment #4)
> Why can't this just be:
> 
> void setStackOffset(signed offset)
> {
>     stackOffset = offset;
>     RELEASE_ASSERT(static_cast<signed>(stackOffset) == offset);
> }
> 
> Then you can get rid of the minStackOffset/maxStackOffset constants.

That is an excellent and superior solution.  Will fix.
Comment 6 Mark Lam 2014-08-21 21:44:29 PDT
Created attachment 236964 [details]
patch 3: with better assertion.
Comment 7 WebKit Commit Bot 2014-08-21 22:30:14 PDT
Comment on attachment 236964 [details]
patch 3: with better assertion.

Clearing flags on attachment: 236964

Committed r172853: <http://trac.webkit.org/changeset/172853>
Comment 8 WebKit Commit Bot 2014-08-21 22:30:17 PDT
All reviewed patches have been landed.  Closing bug.