Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a4bf1d39d6f57d2cb705176836db4e3a3745a8b2
https://github.com/WebKit/WebKit/commit/a4bf1d39d6f57d2cb705176836db4e3a3745a8b2
Author: Yusuke Suzuki <[email protected]>
Date: 2026-10-06 (Tue, 06 Oct 2026)
Changed paths:
M Source/JavaScriptCore/parser/Lexer.cpp
M Source/JavaScriptCore/parser/Lexer.h
M Source/JavaScriptCore/parser/Parser.cpp
M Source/JavaScriptCore/parser/Parser.h
Log Message:
-----------
[JSC] Scan large data array fast
https://bugs.webkit.org/show_bug.cgi?id=326495
rdar://189278998
Reviewed by Yijia Huang.
It is common that very large-sized data array is in JS file like,
var array = [10,20,30,40,50,60,...];
For each array element, we are calling parseAssignmentExpression, which
is full-fledged parsing function. But pattern here is skewed: primitive
values can be seen frequently in a particular pattern. If your current
token is Integer (for example) and you have next character ',', then you
do not need to go deep, it is number element. So we add a fast path
`parseArrayElement` which parses primitive elements
quickly inside array literal. We also add
`parseSimpleArrayElementsAfterComma` which cooperatively scans large
numeric data array by lexing via special lexer function
`scanSimpleArrayElementFollowedByComma`.
* Source/JavaScriptCore/parser/Lexer.cpp:
(JSC::Lexer<T>::lexWithoutClearingLineTerminator):
* Source/JavaScriptCore/parser/Lexer.h:
(JSC::Lexer<T>::scanSimpleArrayElementFollowedByComma):
* Source/JavaScriptCore/parser/Parser.cpp:
(JSC::Parser<LexerType>::parseArrayElement):
(JSC::Parser<LexerType>::parseSimpleArrayElementsAfterComma):
(JSC::Parser<LexerType>::parseArrayLiteral):
* Source/JavaScriptCore/parser/Parser.h:
Canonical link: https://commits.webkit.org/322915@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications