Bug 156896

Summary: [JSC] Optimize number parsing and string parsing in LiteralParser
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: New BugsAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, buildbot, commit-queue, darin, fpizlo, ggaren, keith_miller, mark.lam, msaboff, rniwa, saam
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews102 for mac-yosemite
none
Archive of layout-test-results from ews106 for mac-yosemite-wk2
none
Archive of layout-test-results from ews116 for mac-yosemite
none
Archive of layout-test-results from ews122 for ios-simulator-wk2
none
Patch mark.lam: review+

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>