Bug 168627 - Intrinsicify parseInt
Summary: Intrinsicify parseInt
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-20 18:44 PST by Saam Barati
Modified: 2017-02-24 11:38 PST (History)
11 users (show)

See Also:


Attachments
WIP (260.00 KB, patch)
2017-02-21 11:20 PST, Saam Barati
no flags Details | Formatted Diff | Diff
WIP (38.62 KB, patch)
2017-02-23 13:01 PST, Saam Barati
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews117 for mac-elcapitan (1.95 MB, application/zip)
2017-02-23 14:34 PST, Build Bot
no flags Details
patch (47.80 KB, patch)
2017-02-23 15:55 PST, Saam Barati
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Saam Barati 2017-02-20 18:44:22 PST
...
Comment 1 Saam Barati 2017-02-20 20:13:28 PST
box2D calls parseInt quite often with a single integer argument. We should be good at emitting good code here. We could also be good about removing various type checks for strings, and determining if the radix is a constant.

Implementing a dumbed down parseInt Intrinsic is a 5-6% progression on box2d.
Comment 2 Saam Barati 2017-02-21 11:20:59 PST
Created attachment 302289 [details]
WIP

Note: the patch currently has some register allocation bits in it from a different bug I'm working on.
Comment 3 Saam Barati 2017-02-23 13:01:55 PST
Created attachment 302565 [details]
WIP

Might be the patch. Still need to write tests and a changelog.
Comment 4 WebKit Commit Bot 2017-02-23 13:03:07 PST
Attachment 302565 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/runtime/ParseInt.h:161:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
ERROR: Source/JavaScriptCore/runtime/ParseInt.h:164:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
ERROR: Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:2942:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
ERROR: Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp:619:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
Total errors found: 4 in 25 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Build Bot 2017-02-23 14:34:46 PST
Comment on attachment 302565 [details]
WIP

Attachment 302565 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/3181060

New failing tests:
media/modern-media-controls/volume-down-support/volume-down-support.html
Comment 6 Build Bot 2017-02-23 14:34:49 PST
Created attachment 302579 [details]
Archive of layout-test-results from ews117 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews117  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 7 Saam Barati 2017-02-23 15:55:39 PST
Created attachment 302598 [details]
patch
Comment 8 WebKit Commit Bot 2017-02-23 15:58:15 PST
Attachment 302598 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/runtime/ParseInt.h:161:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
ERROR: Source/JavaScriptCore/runtime/ParseInt.h:164:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
ERROR: Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:2941:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
ERROR: Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp:619:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
Total errors found: 4 in 29 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 WebKit Commit Bot 2017-02-23 20:09:19 PST
Comment on attachment 302598 [details]
patch

Clearing flags on attachment: 302598

Committed r212939: <http://trac.webkit.org/changeset/212939>
Comment 10 WebKit Commit Bot 2017-02-23 20:09:23 PST
All reviewed patches have been landed.  Closing bug.
Comment 11 Darin Adler 2017-02-23 20:55:53 PST
Comment on attachment 302598 [details]
patch

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

> Source/JavaScriptCore/dfg/DFGOperations.cpp:895
> +    // This version is as if radix was undefined. Hence, undefined.toNumber() === 0.
> +    return parseIntResult(parseInt(viewWithString.view, radix));

The comment here seems wrong.
Comment 12 Saam Barati 2017-02-23 21:15:03 PST
Comment on attachment 302598 [details]
patch

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

>> Source/JavaScriptCore/dfg/DFGOperations.cpp:895
>> +    return parseIntResult(parseInt(viewWithString.view, radix));
> 
> The comment here seems wrong.

Oops. Thanks for pointing this out.
(I actually spotted this locally after I uploaded the patch but forgot to upload a new patch before landing. Will fix when I'm back in front of my computer.)
Comment 13 Saam Barati 2017-02-24 11:38:48 PST
Removed comment in:
https://trac.webkit.org/changeset/212962