Bug 158084 - Simplify and inline minimumValueForLength()
Summary: Simplify and inline minimumValueForLength()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-25 13:47 PDT by Chris Dumez
Modified: 2016-05-25 14:24 PDT (History)
4 users (show)

See Also:


Attachments
Patch (8.69 KB, patch)
2016-05-25 13:48 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2016-05-25 13:47:01 PDT
Simplify and inline minimumValueForLength(). Based on iOS PLT profiles, we spend up to 0.7% of CPU time during page loads in this function.
Comment 1 Chris Dumez 2016-05-25 13:48:28 PDT
Created attachment 279803 [details]
Patch
Comment 2 WebKit Commit Bot 2016-05-25 14:12:13 PDT
Comment on attachment 279803 [details]
Patch

Clearing flags on attachment: 279803

Committed r201401: <http://trac.webkit.org/changeset/201401>
Comment 3 WebKit Commit Bot 2016-05-25 14:12:18 PDT
All reviewed patches have been landed.  Closing bug.
Comment 4 Said Abou-Hallawa 2016-05-25 14:24:37 PDT
Comment on attachment 279803 [details]
Patch

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

I think also there is no real need for the sources LengthFunctions.h and LengthFunctions.cpp. All the functions in these files can be moved to Length.h and LengthSize.h. The names of the functions should be shorter and clearer. Instead of having 
    inline LayoutUnit minimumValueForLength(const Length& length, LayoutUnit maximumValue)
We can have
    inline LayoutUnit Length::minimumValue(LayoutUnit maximumValue) const;

> Source/WebCore/css/LengthFunctions.h:38
> +int minimumIntValueForLength(const Length&, LayoutUnit maximumValue);

This function is called only twice in the windows code. Can't we make the casting inline?

> Source/WebCore/css/LengthFunctions.h:39
>  int intValueForLength(const Length&, LayoutUnit maximumValue);

I am not sure why do we need intValueForLength() especially all what it does is just casting which can be inline. Also it is only used in 6 places; 4 of them in in one block of code.