Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c76c52f5b10d32ef151be0ed3323d41f01872e14
https://github.com/WebKit/WebKit/commit/c76c52f5b10d32ef151be0ed3323d41f01872e14
Author: Vassili Bykov <[email protected]>
Date: 2026-09-21 (Mon, 21 Sep 2026)
Changed paths:
A JSTests/stress/line-start-table-not-built-by-ordinary-parse.js
M LayoutTests/js/dom/script-start-end-locations-expected.txt
M Source/JavaScriptCore/API/JSScript.mm
M Source/JavaScriptCore/CMakeLists.txt
M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
M
Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.Promise-Combined.js-result
M
Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-Builtin.prototype-Combined.js-result
M
Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-BuiltinConstructor-Combined.js-result
M
Source/JavaScriptCore/Scripts/tests/builtins/expected/JavaScriptCore-InternalClashingNames-Combined.js-result
M
Source/JavaScriptCore/Scripts/wkbuiltins/builtins_generate_combined_implementation.py
M Source/JavaScriptCore/Scripts/wkbuiltins/builtins_generator.py
M Source/JavaScriptCore/Sources.txt
M Source/JavaScriptCore/builtins/BuiltinExecutables.cpp
M Source/JavaScriptCore/builtins/BuiltinExecutables.h
M Source/JavaScriptCore/bytecode/CodeBlock.cpp
M Source/JavaScriptCore/bytecode/CodeBlock.h
M Source/JavaScriptCore/bytecode/ExpressionInfo.cpp
M Source/JavaScriptCore/bytecode/ExpressionInfo.h
M Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp
M Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h
M Source/JavaScriptCore/bytecode/UnlinkedCodeBlockGenerator.cpp
M Source/JavaScriptCore/bytecode/UnlinkedCodeBlockGenerator.h
M Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp
M Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h
M Source/JavaScriptCore/bytecode/UnlinkedGlobalCodeBlock.h
M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
M Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
M Source/JavaScriptCore/debugger/Debugger.cpp
M Source/JavaScriptCore/debugger/DebuggerParseData.cpp
M Source/JavaScriptCore/debugger/DebuggerParseData.h
M Source/JavaScriptCore/jsc.cpp
M Source/JavaScriptCore/parser/ASTBuilder.h
M Source/JavaScriptCore/parser/Lexer.cpp
M Source/JavaScriptCore/parser/Lexer.h
M Source/JavaScriptCore/parser/NodeConstructors.h
M Source/JavaScriptCore/parser/Nodes.cpp
M Source/JavaScriptCore/parser/Nodes.h
M Source/JavaScriptCore/parser/Parser.cpp
M Source/JavaScriptCore/parser/Parser.h
M Source/JavaScriptCore/parser/ParserFunctionInfo.h
M Source/JavaScriptCore/parser/ParserTokens.h
A Source/JavaScriptCore/parser/SourceCharacters.cpp
A Source/JavaScriptCore/parser/SourceCharacters.h
M Source/JavaScriptCore/parser/SourceCode.h
M Source/JavaScriptCore/parser/SourceProvider.cpp
M Source/JavaScriptCore/parser/SourceProvider.h
M Source/JavaScriptCore/parser/SourceProviderCacheItem.h
M Source/JavaScriptCore/parser/SyntaxChecker.h
M Source/JavaScriptCore/runtime/CachedTypes.cpp
M Source/JavaScriptCore/runtime/CodeCache.cpp
M Source/JavaScriptCore/runtime/FileBasedFuzzerAgent.cpp
M Source/JavaScriptCore/runtime/FunctionExecutable.cpp
M Source/JavaScriptCore/runtime/FunctionExecutable.h
M Source/JavaScriptCore/runtime/GlobalExecutable.h
M Source/JavaScriptCore/runtime/JSGlobalObject.cpp
M Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
M Source/JavaScriptCore/runtime/LiteralParser.cpp
M Source/JavaScriptCore/runtime/ParseInt.h
M Source/JavaScriptCore/runtime/RegExp.cpp
M Source/JavaScriptCore/runtime/SamplingProfiler.h
M Source/JavaScriptCore/runtime/ScriptExecutable.cpp
M Source/JavaScriptCore/runtime/ScriptExecutable.h
M Source/JavaScriptCore/tools/FunctionOverrides.cpp
M Source/JavaScriptCore/tools/FunctionOverrides.h
M Source/JavaScriptCore/tools/JSDollarVM.cpp
M Source/WebCore/bindings/js/ScriptController.cpp
M Source/WebCore/bindings/js/ScriptSourceCode.h
Log Message:
-----------
[JSC] Do not track lines and columns while parsing
https://bugs.webkit.org/show_bug.cgi?id=324564
rdar://187793434
Reviewed by Yusuke Suzuki.
Currently JS parser tracks three pieces of information for each source location
(such as the
start or the end of a token): source offset, line number, and column number.
This is redundant,
as a source offset alone uniquely identifies a location. Lines and columns are
only needed for
human-readable messages. It makes sense to stop tracking and storing them, and
reconstruct them
lazily from the offset if and when they are needed. This avoids the tracking
cost on the fast
path and eliminates the complexity of converting lines and columns between
multiple frames of
reference (html document, script element, function being reparsed).
This patch implements that change. It is stage 1 of the entire work, focused on
functional
changes. After landing, it will be followed by stage 2 with additional
refactorings. The work
is split this way to make each patch more focused and easier to review, because
both patches
have a small set of core changes that trigger many cascading changes at
dependent use sites.
Stage 1 captures all performance gains.
Key changes in this patch:
1. Many data structures lose fields for line and column tracking, associated
constructor
parameters, getters, setters, and computation logic.
2. SourceProvider carries a lazily-built LineStartTable. The table is built the
first time
a line or column number is required for the provider's source. APIs that
used to return
stored lines and columns now route to the SourceProvider.
3. Because LineStartTable is now responsible for scanning the source to
identify line breaks,
most of the related logic is moved from Lexer.h/.cpp to
SourceProvider.h/.cpp. Some
utility functions and predicates are moved to the new files
SourceCharacters.h/.cpp.
4. Line break scanning in LineStartTable includes a fix for a minor latent bug
in JSC line
tracking: an unquoted Unicode line separator (LS) character inside a string
literal is legal
and is a LineTerminator (starts a new line, ECMA-262 #11.3). The existing
JSC lexer code
allows it, but doesn't count it as a start of a new line.
The bulk of the patch are mechanical changes cascading from the above.
Testing:
- Existing tests verify no observable behavior differences.
- A new test to verify the line start table is not prematurely built by
accident:
JSTests/stress/line-start-table-not-built-by-ordinary-parse.js
Canonical link: https://commits.webkit.org/321541@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications