Repository navigation
Conversation
webkit-early-warning-system
pushed a commit
to hyjorc1/WebKit
that referenced
this pull request
Nov 19, 2022
…a rejected promise https://bugs.webkit.org/show_bug.cgi?id=247785 rdar://102325201 Reviewed by Yusuke Suzuki. Rest parameter should be caught in async function. So, running this JavaScript program should print "caught". ``` async function f(...[[]]) { } f().catch(e => print("caught")); ``` V8 (used console.log) ``` $ node input.js caught ``` GraalJS ``` $ js input.js caught ``` https://tc39.es/ecma262/#sec-async-function-definitions ... AsyncFunctionDeclaration[Yield, Await, Default] : async [no LineTerminator here] function BindingIdentifier[?Yield, ?Await] ( FormalParameters[~Yield, +Await] ) { AsyncFunctionBody } [+Default] async [no LineTerminator here] function ( FormalParameters[~Yield, +Await] ) { AsyncFunctionBody } AsyncFunctionExpression : async [no LineTerminator here] function BindingIdentifier[~Yield, +Await]opt ( FormalParameters[~Yield, +Await] ) { AsyncFunctionBody } ... According to the spec, it indicates `FormalParameters` is used for Async Function, where `FormalParameters` can be converted to `FunctionRestParameter`. https://tc39.es/ecma262/#sec-parameter-lists ... FormalParameters[Yield, Await] : [empty] FunctionRestParameter[?Yield, ?Await] FormalParameterList[?Yield, ?Await] FormalParameterList[?Yield, ?Await] , FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] ... And based on RS: EvaluateAsyncFunctionBody, it will invoke the promise.reject callback function with abrupt value ([[value]] of non-normal completion record). https://tc39.es/ecma262/#sec-runtime-semantics-evaluateasyncfunctionbody ... 2. Let declResult be Completion(FunctionDeclarationInstantiation(functionObject, argumentsList)). 3. If declResult is an abrupt completion, then a. Perform ! Call(promiseCapability.[[Reject]], undefined, « declResult.[[Value]] »). ... In that case, any non-normal results of evaluating rest parameters should be caught and passed to the reject callback function. To resolve this problem, we should allow the emitted RestParameterNode be wrapped by the catch handler for promise. However, we should remove `m_restParameter` and emit rest parameter byte code in `initializeDefaultParameterValuesAndSetupFunctionScopeStack` if we can prove that change has no side effect. In that case, we can only use one exception handler. Current fix is to add another exception handler. And move the handler byte codes to the bottom of code block in order to make other byte codes as much compact as possible. Input: ``` async function f(arg0, ...[[]]) { } f(); ``` Dumped Byte Codes: ``` ... bb#2 Predecessors: [ WebKit#1 ] [ 20] mov dst:loc9, src:<JSValue()>(const0) ... bb#3 Predecessors: [ WebKit#2 ] [ 29] get_rest_length dst:loc11, numParametersToSkip:1 ... bb#12 Predecessors: [ WebKit#8 WebKit#9 WebKit#10 ] [ 138] new_func_exp dst:loc10, scope:loc4, functionDecl:0 ... bb#13 Predecessors: [ ] [ 170] catch exception:loc10, thrownValue:loc8 [ 174] jmp targetLabel:8(->182) Successors: [ WebKit#15 ] bb#14 Predecessors: [ WebKit#7 WebKit#11 ] [ 176] catch exception:loc10, thrownValue:loc8 [ 180] jmp targetLabel:2(->182) Successors: [ WebKit#15 ] bb#15 Predecessors: [ WebKit#13 WebKit#14 ] [ 182] mov dst:loc12, src:Undefined(const1) ... Exception Handlers: 1: { start: [ 20] end: [ 29] target: [ 170] } synthesized catch 2: { start: [ 29] end: [ 138] target: [ 176] } synthesized catch ``` * JSTests/stress/catch-rest-parameter.js: Added. (throwError): (shouldThrow): (async f): (throwError.async f): (throwError.async let): (async let): (x.async f): (x): (async shouldThrow): * Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::initializeDefaultParameterValuesAndSetupFunctionScopeStack): * Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h: Canonical link: https://commits.webkit.org/256864@main
cdumez
pushed a commit
to cdumez/WebKit
that referenced
this pull request
Jan 15, 2023
Fix TypeError in parameter destructuring in async function should be a rejected promise
https://bugs.webkit.org/show_bug.cgi?id=247785
rdar://102325201
Reviewed by Yusuke Suzuki.
Rest parameter should be caught in async function. So, running this
JavaScript program should print "caught".
```
async function f(...[[]]) { }
f().catch(e => print("caught"));
```
V8 (used console.log)
```
$ node input.js
caught
```
GraalJS
```
$ js input.js
caught
```
https://tc39.es/ecma262/#sec-async-function-definitions
...
AsyncFunctionDeclaration[Yield, Await, Default] :
async [no LineTerminator here] function BindingIdentifier[?Yield, ?Await] ( FormalParameters[~Yield, +Await] ) { AsyncFunctionBody }
[+Default] async [no LineTerminator here] function ( FormalParameters[~Yield, +Await] ) { AsyncFunctionBody }
AsyncFunctionExpression :
async [no LineTerminator here] function BindingIdentifier[~Yield, +Await]opt ( FormalParameters[~Yield, +Await] ) { AsyncFunctionBody }
...
According to the spec, it indicates `FormalParameters` is used for Async
Function, where `FormalParameters` can be converted to `FunctionRestParameter`.
https://tc39.es/ecma262/#sec-parameter-lists
...
FormalParameters[Yield, Await] :
[empty]
FunctionRestParameter[?Yield, ?Await]
FormalParameterList[?Yield, ?Await]
FormalParameterList[?Yield, ?Await] ,
FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await]
...
And based on RS: EvaluateAsyncFunctionBody, it will invoke the promise.reject
callback function with abrupt value ([[value]] of non-normal completion record).
https://tc39.es/ecma262/#sec-runtime-semantics-evaluateasyncfunctionbody
...
2. Let declResult be Completion(FunctionDeclarationInstantiation(functionObject, argumentsList)).
3. If declResult is an abrupt completion, then
a. Perform ! Call(promiseCapability.[[Reject]], undefined, « declResult.[[Value]] »).
...
In that case, any non-normal results of evaluating rest parameters should be
caught and passed to the reject callback function.
To resolve this problem, we should allow the emitted RestParameterNode be wrapped
by the catch handler for promise. However, we should remove `m_restParameter` and
emit rest parameter byte code in `initializeDefaultParameterValuesAndSetupFunctionScopeStack`
if we can prove that change has no side effect. In that case, we can only use one
exception handler.
Current fix is to add another exception handler. And move the handler byte codes to
the bottom of code block in order to make other byte codes as much compact as possible.
Input:
```
async function f(arg0, ...[[]]) { }
f();
```
Dumped Byte Codes:
```
...
bb#2
Predecessors: [ WebKit#1 ]
[ 20] mov dst:loc9, src:<JSValue()>(const0)
...
bb#3
Predecessors: [ WebKit#2 ]
[ 29] get_rest_length dst:loc11, numParametersToSkip:1
...
bb#12
Predecessors: [ WebKit#8 WebKit#9 WebKit#10 ]
[ 138] new_func_exp dst:loc10, scope:loc4, functionDecl:0
...
bb#13
Predecessors: [ ]
[ 170] catch exception:loc10, thrownValue:loc8
[ 174] jmp targetLabel:8(->182)
Successors: [ WebKit#15 ]
bb#14
Predecessors: [ WebKit#7 WebKit#11 ]
[ 176] catch exception:loc10, thrownValue:loc8
[ 180] jmp targetLabel:2(->182)
Successors: [ WebKit#15 ]
bb#15
Predecessors: [ WebKit#13 WebKit#14 ]
[ 182] mov dst:loc12, src:Undefined(const1)
...
Exception Handlers:
1: { start: [ 20] end: [ 29] target: [ 170] } synthesized catch
2: { start: [ 29] end: [ 138] target: [ 176] } synthesized catch
```
* JSTests/stress/catch-rest-parameter.js: Added.
(throwError):
(shouldThrow):
(async f):
(throwError.async f):
(throwError.async let):
(async let):
(x.async f):
(x):
(async shouldThrow):
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::initializeDefaultParameterValuesAndSetupFunctionScopeStack):
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h:
Canonical link: https://commits.webkit.org/256864@main
Canonical link: https://commits.webkit.org/252432.994@safari-7614-branch
webkit-commit-queue
pushed a commit
to Constellation/WebKit
that referenced
this pull request
Jan 24, 2023
https://bugs.webkit.org/show_bug.cgi?id=251063 rdar://104585575 Reviewed by Mark Lam and Justin Michaud. This patch enhances CallFrame::dump to support wasm frames in btjs stacktrace. The example is as follows. frame #0: 0x00000001035fca78 JavaScriptCore`JSC::functionBreakpoint(globalObject=0x000000012f410068, callFrame=0x000000016fdfa9d0) at JSDollarVM.cpp:2273:9 [opt] frame WebKit#1: 0x000000010ec44204 0x10eccc5dc frame WebKit#2: 0x000000010eccc5dc callback#Dwaxn6 [Baseline bc#50](Undefined) frame WebKit#3: 0x000000010ec4ca84 wasm-stub [WasmToJS](Wasm::Instance: 0x10d29da40) frame WebKit#4: 0x000000010ed0c060 <?>.wasm-function[1] [OMG](Wasm::Instance: 0x10d29da40) frame WebKit#5: 0x000000010ed100d0 jsToWasm#CWTx6k [FTL bc#22](Cell[JSModuleEnvironment]: 0x12f524540, Cell[WebAssemblyFunction]: 0x10d06a3a8, 1, 2, 3) frame WebKit#6: 0x000000010ec881b0 #D5ymZE [Baseline bc#733](Undefined, Cell[Generator]: 0x12f55c180, 1, Cell[Object]: 0x12f69dfc0, 0, Cell[JSLexicalEnvironment]: 0x12f52cee0) frame WebKit#7: 0x000000010ec3c008 asyncFunctionResume#A4ayYg [LLInt bc#49](Undefined, Cell[Generator]: 0x12f55c180, Cell[Object]: 0x12f69dfc0, 0) frame WebKit#8: 0x000000010ec3c008 promiseReactionJobWithoutPromise#D0yDF1 [LLInt bc#25](Undefined, Cell[Function]: 0x12f44f3c0, Cell[Object]: 0x12f69dfc0, Cell[Generator]: 0x12f55c180) frame WebKit#9: 0x000000010ec80ec0 promiseReactionJob#EdShZz [Baseline bc#74](Undefined, Undefined, Cell[Function]: 0x12f44f3c0, Cell[Object]: 0x12f69dfc0, Cell[Generator]: 0x12f55c180) frame WebKit#10: 0x000000010ec3c728 frame WebKit#11: 0x0000000103137560 JavaScriptCore`JSC::Interpreter::executeCall(JSC::JSGlobalObject*, JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) [inlined] JSC::JITCode::execute(this=<unavailable>, vm=<unavailable>, protoCallFrame=<unavailable>) at JITCodeInlines.h:42:38 [opt] frame WebKit#12: 0x0000000103137524 JavaScriptCore`JSC::Interpreter::executeCall(this=<unavailable>, lexicalGlobalObject=<unavailable>, function=<unavailable>, callData=<unavailable>, thisValue=<unavailable>, args=<unavailable>) at Interpreter.cpp:1093:27 [opt] frame WebKit#13: 0x000000010349d6d0 JavaScriptCore`JSC::runJSMicrotask(globalObject=0x000000012f410068, identifier=(m_identifier = 81), job=JSValue @ x22, argument0=JSValue @ x26, argument1=JSValue @ x25, argument2=<unavailable>, argument3=<unavailable>) at JSMicrotask.cpp:98:9 [opt] frame WebKit#14: 0x00000001039dfc54 JavaScriptCore`JSC::VM::drainMicrotasks() (.cold.1) at VM.cpp:0:9 [opt] frame WebKit#15: 0x00000001035e58a4 JavaScriptCore`JSC::VM::drainMicrotasks() [inlined] JSC::MicrotaskQueue::dequeue(this=<unavailable>) at VM.cpp:0:9 [opt] frame WebKit#16: 0x00000001035e5894 JavaScriptCore`JSC::VM::drainMicrotasks(this=0x000000012f000000) at VM.cpp:1255:46 [opt] ... * Source/JavaScriptCore/interpreter/CallFrame.cpp: (JSC::CallFrame::dump const): Canonical link: https://commits.webkit.org/259262@main
webkit-commit-queue
pushed a commit
that referenced
this pull request
Jul 8, 2024
https://bugs.webkit.org/show_bug.cgi?id=276291 Reviewed by Antti Koivisto. In 162878@main we went from isPercent() to isPercentOrCalculated() without adding support for the "calculated" part. (FIXME: we should find a common place for this) https://drafts.csswg.org/css-sizing-3/#replaced-percentage-min-contribution "If the box is replaced, a cyclic percentage in the value of any max size property or preferred size property (width/max-width/height/max-height), is resolved against zero when calculating the min-content contribution in the corresponding axis" and https://drafts.csswg.org/css-sizing-3/#min-content-zero "In addition to the replaced elements listed in HTML 14.4 [HTML], the following HTML elements are also considered to be replaced elements...select, textarea, progress, meter..." * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-item-compressible-001-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-item-compressible-002-expected.txt: * Source/WebCore/rendering/RenderFileUploadControl.cpp: (WebCore::RenderFileUploadControl::computeIntrinsicLogicalWidths const): * Source/WebCore/rendering/RenderListBox.cpp: (WebCore::RenderListBox::computeIntrinsicLogicalWidths const): * Source/WebCore/rendering/RenderMenuList.cpp: (RenderMenuList::computeIntrinsicLogicalWidths const): * Source/WebCore/rendering/RenderSlider.cpp: (WebCore::RenderSlider::computeIntrinsicLogicalWidths const): * Source/WebCore/rendering/RenderTextControl.cpp: (WebCore::RenderTextControl::computeIntrinsicLogicalWidths const): Canonical link: https://commits.webkit.org/280722@main
philn
added a commit
to philn/WebKit
that referenced
this pull request
Feb 6, 2025
Reviewed by NOBODY (OOPS!).
This was spotted by ASan, the real and imaginary AudioFloatArrays end-up using aligned_alloc() for
their storage, which expects a power-of-two size. Using fftSize / 2 + 1 makes the size
non-power-of-two, the full fftSize being power-of-two (we now have an ASSERT for this).
==1733723==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fc75c438bca bp 0x7ffed612c860 sp 0x7ffed612c028 T0)
==1733723==The signal is caused by a WRITE memory access.
==1733723==Hint: address points to the zero page.
#0 0x7fc75c438bca in __memset_avx2_unaligned_erms (/lib64/libc.so.6+0x16dbca) (BuildId: 77c77fee058b19c6f001cf2cb0371ce3b8341211)
WebKit#1 0x2fc4ce in __asan_memset (/var/home/phil/WebKit/local-build-gtk/WebKitBuild/GTK/Release/bin/WebKitWebProcess+0x2fc4ce) (BuildId: e2b0aff0c8fcab48026d63cf711cd70d0aeceb79)
WebKit#2 0x7fc77047599e in WebCore::FFTFrame::FFTFrame(unsigned int) UnifiedSource-3c72abbe-20.cpp
WebKit#3 0x7fc76d41c08b in WebCore::PeriodicWave::createBandLimitedTables(float const*, float const*, unsigned int, WebCore::ShouldDisableNormalization) UnifiedSource-f8afad56-52.cpp
WebKit#4 0x7fc76d41f371 in WebCore::PeriodicWave::generateBasicWaveform(WebCore::PeriodicWave::Type) UnifiedSource-f8afad56-52.cpp
WebKit#5 0x7fc76d41e633 in WebCore::PeriodicWave::createSine(float) UnifiedSource-f8afad56-52.cpp
WebKit#6 0x7fc76d3c2352 in WebCore::BaseAudioContext::periodicWave(WebCore::OscillatorType) UnifiedSource-f8afad56-49.cpp
WebKit#7 0x7fc76d410dbf in WebCore::OscillatorNode::setTypeForBindings(WebCore::OscillatorType) UnifiedSource-f8afad56-52.cpp
WebKit#8 0x7fc76d4102f4 in WebCore::OscillatorNode::create(WebCore::BaseAudioContext&, WebCore::OscillatorOptions const&) UnifiedSource-f8afad56-52.cpp
WebKit#9 0x7fc76d3bc210 in WebCore::BaseAudioContext::createOscillator() UnifiedSource-f8afad56-49.cpp
WebKit#10 0x7fc76acbc743 in WebCore::jsBaseAudioContextPrototypeFunction_createOscillator(JSC::JSGlobalObject*, JSC::CallFrame*) UnifiedSource-3a52ce78-11.cpp
WebKit#11 0x7fc705c10037 (<unknown module>)
* Source/WebCore/platform/audio/gstreamer/FFTFrameGStreamer.cpp:
(WebCore::FFTFrame::FFTFrame):
webkit-commit-queue
pushed a commit
to kmiller68/WebKit
that referenced
this pull request
Apr 17, 2026
https://bugs.webkit.org/show_bug.cgi?id=312485 rdar://174932570 Reviewed by Yusuke Suzuki. Use value - trunc(value) == 0.0 for isInteger, which rejects NaN and Infinity without an explicit isFinite check since NaN - NaN and Inf - Inf both produce NaN. Add MacroAssembler::isDoubleInteger helper and use it in the DFG NumberIsInteger path, removing the manual exponent-bit extraction branch. Simplify the FTL NumberIsInteger path similarly using B3 IR. Remove redundant isFinite checks from DFG and FTL NumberIsSafeInteger, since the range check against maxSafeInteger already rejects Infinity. On ARM64 the difference in codegen is roughly: isIntegerOld(double): frintz d1, d0 fmov x8, d0 mov w9, WebKit#2047 ubfx x8, x8, WebKit#52, WebKit#11 fcmp d1, d0 ccmp x8, x9, WebKit#2, eq cset w0, lo ret isIntegerNew(double): frintz d1, d0 fsub d0, d0, d1 fcmp d0, #0.0 cset w0, eq ret No new tests, no behavior change. Covered by existing tests. Canonical link: https://commits.webkit.org/311413@main
webkit-commit-queue
pushed a commit
that referenced
this pull request
Jul 12, 2026
…xItem and marginBoxAscentForFlexItem instead of reading the renderer https://bugs.webkit.org/show_bug.cgi?id=318518 Reviewed by Antti Koivisto. Following 318517, which captured each flex item's used cross size into computeCrossSizeForFlexItems's list, route the remaining post-stretch cross-axis alignment reads through that list. availableAlignmentSpaceForFlexItem and marginBoxAscentForFlexItem now take the used cross size as an argument rather than reading crossAxisExtentForFlexItem (the renderer's border box) themselves. Their post-stretch callers (handleCrossAxisAlignmentForFlexItems and performBaselineAlignment) pass crossSizes[itemIndex] -- the value captured in #11, which nothing relays out before these phases, so it is exactly what they read from the renderer before. The two callers that run outside that window pass crossAxisExtentForFlexItem directly, unchanged: crossSizeForFlexLines (#8, before the stretch pass, and only for baseline items, which are never stretched) and the out-of-flow static-position path, whose item is not in the list. So the used cross size now flows through the algorithm's list for the whole post-stretch alignment path; the only renderer cross-size reads left are #8 and the external baseline queries (firstLineBaseline / baselinePosition). No change in behavior. * Source/WebCore/rendering/RenderFlexibleBox.h: * Source/WebCore/rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::availableAlignmentSpaceForFlexItem): (WebCore::RenderFlexibleBox::marginBoxAscentForFlexItem): (WebCore::RenderFlexibleBox::staticCrossAxisPositionForPositionedFlexItem): (WebCore::RenderFlexibleBox::crossSizeForFlexLines): (WebCore::RenderFlexibleBox::handleCrossAxisAlignmentForFlexItems): (WebCore::RenderFlexibleBox::performBaselineAlignment): Canonical link: https://commits.webkit.org/316980@main
sj817
pushed a commit
to sj817/shotkit
that referenced
this pull request
Jul 27, 2026
…xItem and marginBoxAscentForFlexItem instead of reading the renderer https://bugs.webkit.org/show_bug.cgi?id=318518 Reviewed by Antti Koivisto. Following 318517, which captured each flex item's used cross size into computeCrossSizeForFlexItems's list, route the remaining post-stretch cross-axis alignment reads through that list. availableAlignmentSpaceForFlexItem and marginBoxAscentForFlexItem now take the used cross size as an argument rather than reading crossAxisExtentForFlexItem (the renderer's border box) themselves. Their post-stretch callers (handleCrossAxisAlignmentForFlexItems and performBaselineAlignment) pass crossSizes[itemIndex] -- the value captured in WebKit#11, which nothing relays out before these phases, so it is exactly what they read from the renderer before. The two callers that run outside that window pass crossAxisExtentForFlexItem directly, unchanged: crossSizeForFlexLines (#8, before the stretch pass, and only for baseline items, which are never stretched) and the out-of-flow static-position path, whose item is not in the list. So the used cross size now flows through the algorithm's list for the whole post-stretch alignment path; the only renderer cross-size reads left are #8 and the external baseline queries (firstLineBaseline / baselinePosition). No change in behavior. * Source/WebCore/rendering/RenderFlexibleBox.h: * Source/WebCore/rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::availableAlignmentSpaceForFlexItem): (WebCore::RenderFlexibleBox::marginBoxAscentForFlexItem): (WebCore::RenderFlexibleBox::staticCrossAxisPositionForPositionedFlexItem): (WebCore::RenderFlexibleBox::crossSizeForFlexLines): (WebCore::RenderFlexibleBox::handleCrossAxisAlignmentForFlexItems): (WebCore::RenderFlexibleBox::performBaselineAlignment): Canonical link: https://commits.webkit.org/316980@main
ast-hugger
added a commit
to ast-hugger/WebKit
that referenced
this pull request
Sep 21, 2026
https://bugs.webkit.org/show_bug.cgi?id=324564 rdar://187793434 Reviewed by NOBODY (OOPS!). 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 WebKit#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
ast-hugger
added a commit
to ast-hugger/WebKit
that referenced
this pull request
Sep 21, 2026
https://bugs.webkit.org/show_bug.cgi?id=324564 rdar://187793434 Reviewed by NOBODY (OOPS!). 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 WebKit#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
webkit-commit-queue
pushed a commit
to ast-hugger/WebKit
that referenced
this pull request
Sep 21, 2026
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 WebKit#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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.