Bug 136141 - r171362 accidentally increased the size of InlineCallFrame
Summary: r171362 accidentally increased the size of InlineCallFrame
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-21 17:50 PDT by Mark Lam
Modified: 2014-08-21 22:30 PDT (History)
2 users (show)

See Also:


Attachments
The patch (3.39 KB, patch)
2014-08-21 17:54 PDT, Mark Lam
mark.lam: review-
Details | Formatted Diff | Diff
patch 2: with correct limits (3.41 KB, patch)
2014-08-21 17:58 PDT, Mark Lam
no flags Details | Formatted Diff | Diff
patch 3: with better assertion. (3.28 KB, patch)
2014-08-21 21:44 PDT, Mark Lam
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.