Bug 191439 - [JSC] isStrWhiteSpace seems redundant with Lexer<UChar>::isWhiteSpace
Summary: [JSC] isStrWhiteSpace seems redundant with Lexer<UChar>::isWhiteSpace
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ross Kirsling
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-11-08 15:14 PST by Ross Kirsling
Modified: 2018-11-08 21:31 PST (History)
7 users (show)

See Also:


Attachments
Patch (1.80 KB, patch)
2018-11-08 17:13 PST, Ross Kirsling
no flags Details | Formatted Diff | Diff
Patch for landing (2.33 KB, patch)
2018-11-08 20:16 PST, Ross Kirsling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Kirsling 2018-11-08 15:14:15 PST
isStrWhiteSpace in ParseInt.h seems redundant with Lexer<UChar>::isWhiteSpace and could probably be done away with.

Note that while Lexer<UChar>::isWhiteSpace matches the current ES spec (https://tc39.github.io/ecma262/#sec-white-space), isStrWhiteSpace additionally looks for 0x000A, 0x000D, 0x2028, and 0x2029. Not sure whether it's supposed to be doing so or not though.
Comment 1 Ross Kirsling 2018-11-08 16:48:29 PST
(In reply to Ross Kirsling from comment #0)
> Note that while Lexer<UChar>::isWhiteSpace matches the current ES spec
> (https://tc39.github.io/ecma262/#sec-white-space), isStrWhiteSpace
> additionally looks for 0x000A, 0x000D, 0x2028, and 0x2029. Not sure whether
> it's supposed to be doing so or not though.

Oops, apparently those four are covered in the very next section (https://tc39.github.io/ecma262/#sec-line-terminators).
So isStrWhiteSpace (whose name originates here: https://tc39.github.io/ecma262/#prod-StrWhiteSpace) includes line terminators and isWhiteSpace does not.

I guess we still need two functions, but we can at least have one depend on the other.
Comment 2 Ross Kirsling 2018-11-08 17:13:39 PST
Created attachment 354294 [details]
Patch
Comment 3 Ross Kirsling 2018-11-08 17:16:11 PST
(In reply to Ross Kirsling from comment #2)
> Created attachment 354294 [details]
> Patch

I thought about making isStrWhiteSpace a static Lexer method, but since the spec uses it exclusively for numeric parsing, it's probably best left where it is.
Comment 4 Saam Barati 2018-11-08 17:17:36 PST
Comment on attachment 354294 [details]
Patch

nice. r=me
Comment 5 Ross Kirsling 2018-11-08 20:16:37 PST
Created attachment 354307 [details]
Patch for landing
Comment 6 WebKit Commit Bot 2018-11-08 21:30:56 PST
Comment on attachment 354307 [details]
Patch for landing

Clearing flags on attachment: 354307

Committed r238016: <https://trac.webkit.org/changeset/238016>
Comment 7 WebKit Commit Bot 2018-11-08 21:30:57 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2018-11-08 21:31:28 PST
<rdar://problem/45934608>