Skip to content

Upgrade to latest WebKit and redo git history - #7

Merged
Jarred-Sumner merged 0 commit into
mainfrom
jarred/upgrade9
Jun 11, 2022
Merged

Jarred-Sumner merged 0 commit into
mainfrom
jarred/upgrade9

Conversation

@Jarred-Sumner

Copy link
Copy Markdown
Collaborator

Pull Request Template

File a Bug

All changes should be associated with a bug. The WebKit project is currently using Bugzilla as our bug tracker. Note that multiple changes may be associated with a single bug.

Provided Tooling

The WebKit Project strongly recommends contributors use Tools/Scripts/git-webkit to generate pull requests. See Setup and Contributing Code for how to do this.

Template

If a contributor wishes to file a pull request manually, the template is below. Manually-filed pull requests should contain their commit message as the pull request description, and their commit message should be formatted like the template below.

Additionally, the pull request should be mentioned on Bugzilla, labels applied to the pull request matching the component and version of the Bugzilla associated with the pull request and the pull request assigned to its author.

< bug title >
https://bugs.webkit.org/show_bug.cgi?id=#####

Reviewed by NOBODY (OOPS!).

* path/changed.ext:
(function):
(class.function):

@Jarred-Sumner
Jarred-Sumner merged commit 8c70a89 into main Jun 11, 2022
Jarred-Sumner pushed a commit that referenced this pull request Nov 25, 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: [ #1 ]
[  20] mov                dst:loc9, src:<JSValue()>(const0)
...

bb#3
Predecessors: [ #2 ]
[  29] get_rest_length    dst:loc11, numParametersToSkip:1
...

bb#12
Predecessors: [ #8 #9 #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: [ #15 ]

bb#14
Predecessors: [ #7 #11 ]
[ 176] catch              exception:loc10, thrownValue:loc8
[ 180] jmp                targetLabel:2(->182)
Successors: [ #15 ]

bb#15
Predecessors: [ #13 #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
Jarred-Sumner pushed a commit that referenced this pull request Jan 29, 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 #1: 0x000000010ec44204 0x10eccc5dc
    frame #2: 0x000000010eccc5dc callback#Dwaxn6 [Baseline bc#50](Undefined)
    frame #3: 0x000000010ec4ca84 wasm-stub [WasmToJS](Wasm::Instance: 0x10d29da40)
    frame #4: 0x000000010ed0c060 <?>.wasm-function[1] [OMG](Wasm::Instance: 0x10d29da40)
    frame #5: 0x000000010ed100d0 jsToWasm#CWTx6k [FTL bc#22](Cell[JSModuleEnvironment]: 0x12f524540, Cell[WebAssemblyFunction]: 0x10d06a3a8, 1, 2, 3)
    frame #6: 0x000000010ec881b0 #D5ymZE [Baseline bc#733](Undefined, Cell[Generator]: 0x12f55c180, 1, Cell[Object]: 0x12f69dfc0, 0, Cell[JSLexicalEnvironment]: 0x12f52cee0)
    frame #7: 0x000000010ec3c008 asyncFunctionResume#A4ayYg [LLInt bc#49](Undefined, Cell[Generator]: 0x12f55c180, Cell[Object]: 0x12f69dfc0, 0)
    frame #8: 0x000000010ec3c008 promiseReactionJobWithoutPromise#D0yDF1 [LLInt bc#25](Undefined, Cell[Function]: 0x12f44f3c0, Cell[Object]: 0x12f69dfc0, Cell[Generator]: 0x12f55c180)
    frame #9: 0x000000010ec80ec0 promiseReactionJob#EdShZz [Baseline bc#74](Undefined, Undefined, Cell[Function]: 0x12f44f3c0, Cell[Object]: 0x12f69dfc0, Cell[Generator]: 0x12f55c180)
    frame #10: 0x000000010ec3c728
    frame #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 #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 #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 #14: 0x00000001039dfc54 JavaScriptCore`JSC::VM::drainMicrotasks() (.cold.1) at VM.cpp:0:9 [opt]
    frame #15: 0x00000001035e58a4 JavaScriptCore`JSC::VM::drainMicrotasks() [inlined] JSC::MicrotaskQueue::dequeue(this=<unavailable>) at VM.cpp:0:9 [opt]
    frame #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
dylan-conway pushed a commit that referenced this pull request Jul 9, 2024
https://bugs.webkit.org/show_bug.cgi?id=276288

Reviewed by Antti Koivisto.

RenderSlider::computeIntrinsicLogicalWidths should check against _logical_ width value.

* LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-item-compressible-002-expected.txt:
* Source/WebCore/rendering/RenderSlider.cpp:
(WebCore::RenderSlider::computeIntrinsicLogicalWidths const):

Canonical link: https://commits.webkit.org/280718@main
Jarred-Sumner pushed a commit that referenced this pull request Aug 23, 2025
…ate-event/intercept-detach-multiple.html is crashing

https://bugs.webkit.org/show_bug.cgi?id=297414
rdar://158349001

Reviewed by Ben Nham.

The Navigation API spec in Step #7 here:
(https://html.spec.whatwg.org/multipage/browsing-the-web.html#getting-session-history-entries-for-the-navigation-api)
says that when getting the entries, we should start at index
(startingIndex - 1) and work backwards while prepending the
entries to our list. The code wasn't doing that. It was starting
at 0 and working up to (startingIndex - 1). Given that we break
if we see an entry with a different domain, that means that in
the scenario where the entries before (startingIndex - 1) are:

1. foo.com
2. foo.com#A
3. bar.com
4. foo.com#B
5. current entry (of foo.com origin)

And the origin we're filtering by is foo.com, the entries we'll
end up with are:

1. foo.com
2. foo.com#A

Whereas we should have ended up with:

1. foo.com#B

m_entries corresponds to the entries that this navigation object
can navigate the frame to. It cannot go from entry 5 to 2 because
that would have gone to 3 first and cross-origin navigation aren't
allowed by this API. So 2 should not be in the list at all.

That's what is happening in this test. The entries in the list
are incorrect and leading to an error down the line.

* LayoutTests/TestExpectations:
* Source/WebCore/page/Navigation.cpp:
(WebCore::Navigation::initializeForNewWindow):

Canonical link: https://commits.webkit.org/299078@main
pull Bot referenced this pull request in coleleavitt/WebKit Jul 19, 2026
…ems and crossSizeForFlexLines

https://bugs.webkit.org/show_bug.cgi?id=318494

Reviewed by Antti Koivisto.

Cross sizing was fused into one per-line function (returning the line's extent,
its baseline groups, and the next offset at once) wrapped by
computeCrossSizeForFlexLines. FlexLayout::layout splits it instead: #7
hypotheticalCrossSizeForFlexItems returns each item's hypothetical cross size,
and #8 crossSizeForFlexLines turns those into each line's cross size. Match that
shape -- both now return plain Vector<LayoutUnit> lists, so an FFC body ports in.

crossSizeForFlexLines keeps legacy's line-size arithmetic (the running
first/last-baseline maxes with a shared descent), so this preserves behavior
rather than adopting FFC's group max. The row-flow container height growth moves
to the line-state assembly (once per line by the line's cross size, which equals
the old per-item maximum), and the baseline sharing groups are built in
performBaselineAlignment where they are used -- safe because baseline items are
never align-self:stretch, so nothing relayouts them between sizing and alignment.
LineState no longer carries the groups.

performFlexLayout now runs its sizing and alignment phases as
performContentSizing() and performContentAlignment() lambdas, matching
FlexLayout::layout. layoutFlexLines, computeCrossSizeForFlexLines, and the
FlexLineResult struct are gone.

No change in behavior.

* Source/WebCore/rendering/RenderFlexibleBox.h:
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::LineState::LineState):
(WebCore::RenderFlexibleBox::performFlexLayout):
(WebCore::RenderFlexibleBox::hypotheticalCrossSizeForFlexItems):
(WebCore::RenderFlexibleBox::crossSizeForFlexLines):
(WebCore::RenderFlexibleBox::handleCrossAxisAlignmentForFlexItems):
(WebCore::RenderFlexibleBox::performBaselineAlignment):
(WebCore::RenderFlexibleBox::computeCrossSizeForFlexLines): Deleted.
(WebCore::RenderFlexibleBox::layoutFlexLines): Deleted.

Canonical link: https://commits.webkit.org/316954@main
samm-git pushed a commit to samm-git/WebKit that referenced this pull request Oct 22, 2026
…e / jfalse follows

https://bugs.webkit.org/show_bug.cgi?id=327327
rdar://189865582

Reviewed by Keith Miller and Tadeu Zagallo.

Currently, when we have a code like,

    function notInstance(term) {
        if (!(term instanceof Pair))
            return term;
        return term.car;
    }

`instanceof` creates a graph due to multiple complicated arms, and then
all of boolean results are combined into one phi, and then we jump based
on this phi result. However this form pessimizes the optimizations.

    oven-sh#3  MatchStructure arm         D@74: MatchStructure(D@63, Object=>true)
                                   D@76: SetLocal(D@74, loc5)
                                   D@77: Jump(T:oven-sh#7)
    oven-sh#4  value-not-object arm       D@59: JSConstant(False)
                                   D@61: SetLocal(D@59, loc5)
                                   D@62: Jump(T:oven-sh#7)
    oven-sh#5  custom hasInstance arm     D@47: InstanceOfCustom(...)
                                   D@49: SetLocal(D@47, loc5)
                                   D@50: Jump(T:oven-sh#7)

    oven-sh#7 (bc#25)  preds: oven-sh#5 oven-sh#3 oven-sh#4    D@78: GetLocal(loc5)
                                   D@79: Branch(D@78, T:oven-sh#9, F:oven-sh#8)
    oven-sh#8 (bc#28)  return term
    oven-sh#9 (bc#30)  CheckStructure(term, [Object]); GetByOffset(car); Return

In the above graph, due to unified blocks, D@74 MatchStructure's
filtering result is gone, and CheckStructure remains while we already
did Structure check via MatchStructure in one of the most common case.

So, we connect each jump directly when `instanceof` result is used with
`jtrue` / `jfalse`, like

    oven-sh#3  MatchStructure arm         D@74: MatchStructure(D@63, Object=>true)
                                   D@76: SetLocal(D@74, loc5)
                                   D@77: Branch(D@74, T:oven-sh#8, F:oven-sh#7)
    oven-sh#4  value-not-object arm       D@59: JSConstant(False)
                                   D@61: SetLocal(D@59, loc5)
                                   D@62: Branch(D@59, T:oven-sh#8, F:oven-sh#7)
    oven-sh#5  custom hasInstance arm     D@47: InstanceOfCustom(...)
                                   D@49: SetLocal(D@47, loc5)
                                   D@50: Branch(D@47, T:oven-sh#8, F:oven-sh#7)

    oven-sh#7 (bc#28)  preds: oven-sh#5 oven-sh#3 oven-sh#4    return term
    oven-sh#8 (bc#30)  preds: oven-sh#5 oven-sh#3 oven-sh#4    CheckStructure(term, [Object]); GetByOffset(car); Return

                                   D@76: SetLocal(D@74, loc5)
                                   D@77: Jump(T:oven-sh#7)
                                   D@61: SetLocal(D@59, loc5)
                                   D@62: Jump(T:oven-sh#7)
                                   D@49: SetLocal(D@47, loc5)
                                   D@50: Jump(T:oven-sh#7)

                                   D@79: Branch(D@78, T:oven-sh#9, F:oven-sh#8)

Then, eventually each MatchStructure, etc. are foled into constant, and
proper constant is propagated through the following blocks instead of
propagating the phi.

Test: JSTests/stress/instanceof-branch-fusion.js

* JSTests/stress/instanceof-branch-fusion.js: Added.
(shouldBe):
(Pair):
(Custom.Symbol.hasInstance):
(Custom):
(notInstance):
(isInstance):
(resultUsedAfterBranch):
(custom):
(loop):
(customJtrue):
(argumentDst):
(longBody):
(longBodyExpected):
(inlinedPredicate):
(inlinedCaller):
(catch):
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):

Canonical link: https://commits.webkit.org/323664@main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant