Bug 156896 - [JSC] Optimize number parsing and string parsing in LiteralParser
Summary: [JSC] Optimize number parsing and string parsing in LiteralParser
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-22 01:02 PDT by Yusuke Suzuki
Modified: 2016-04-22 17:45 PDT (History)
11 users (show)

See Also:


Attachments
Patch (6.31 KB, patch)
2016-04-22 01:14 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-yosemite (929.75 KB, application/zip)
2016-04-22 01:38 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews106 for mac-yosemite-wk2 (1.16 MB, application/zip)
2016-04-22 01:44 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews116 for mac-yosemite (946.24 KB, application/zip)
2016-04-22 02:02 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews122 for ios-simulator-wk2 (599.09 KB, application/zip)
2016-04-22 02:19 PDT, Build Bot
no flags Details
Patch (6.48 KB, patch)
2016-04-22 04:54 PDT, Yusuke Suzuki
mark.lam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2016-04-22 01:02:36 PDT
[JSC] Optimize number parsing and string parsing in LiteralParser
Comment 1 Yusuke Suzuki 2016-04-22 01:14:11 PDT
Created attachment 277021 [details]
Patch
Comment 2 Yusuke Suzuki 2016-04-22 01:16:20 PDT
Performance measurement is included in the ChangeLog.
Comment 3 Build Bot 2016-04-22 01:38:40 PDT
Comment on attachment 277021 [details]
Patch

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

New failing tests:
js/regress/JSONP-negative-0.html
Comment 4 Build Bot 2016-04-22 01:38:44 PDT
Created attachment 277023 [details]
Archive of layout-test-results from ews102 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 5 Build Bot 2016-04-22 01:44:54 PDT
Comment on attachment 277021 [details]
Patch

Attachment 277021 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/1200815

New failing tests:
js/regress/JSONP-negative-0.html
Comment 6 Build Bot 2016-04-22 01:44:58 PDT
Created attachment 277024 [details]
Archive of layout-test-results from ews106 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 7 Build Bot 2016-04-22 02:02:05 PDT
Comment on attachment 277021 [details]
Patch

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

New failing tests:
js/regress/JSONP-negative-0.html
Comment 8 Build Bot 2016-04-22 02:02:09 PDT
Created attachment 277025 [details]
Archive of layout-test-results from ews116 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews116  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 9 Build Bot 2016-04-22 02:19:31 PDT
Comment on attachment 277021 [details]
Patch

Attachment 277021 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/1200895

New failing tests:
js/regress/JSONP-negative-0.html
Comment 10 Build Bot 2016-04-22 02:19:34 PDT
Created attachment 277027 [details]
Archive of layout-test-results from ews122 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews122  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.4
Comment 11 Yusuke Suzuki 2016-04-22 04:54:51 PDT
Created attachment 277044 [details]
Patch
Comment 12 Mark Lam 2016-04-22 09:45:14 PDT
Comment on attachment 277044 [details]
Patch

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

r=me

> Source/JavaScriptCore/runtime/LiteralParser.cpp:531
>      } else if (m_ptr < m_end && (*m_ptr != 'e' && *m_ptr != 'E') && (m_ptr - token.start) < 10) {
> -        double result = 0;
> +        int32_t result = 0;
>          token.type = TokNumber;
>          token.end = m_ptr;
>          const CharType* digit = token.start;
> -        int negative = 1;
> +        bool negative = false;
>          if (*digit == '-') {
> -            negative = -1;
> +            negative = true;
>              digit++;
>          }
>          
>          while (digit < m_ptr)
>              result = result * 10 + (*digit++) - '0';

The correctness of this implementations relies on us never changing the max chars parsed to another value from 10.  Is there a way we can assert this in case someone makes the mistake of changing it in the future?
Comment 13 Yusuke Suzuki 2016-04-22 17:45:13 PDT
Committed r199941: <http://trac.webkit.org/changeset/199941>