Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JSC] ResolveNode can't always skip the extra move #10853

Conversation

tadeuzagallo
Copy link
Member

@tadeuzagallo tadeuzagallo commented Mar 1, 2023

e7b74be

[JSC] ResolveNode can't always skip the extra move
https://bugs.webkit.org/show_bug.cgi?id=253142
rdar://106076478

Reviewed by Keith Miller.

In http://commits.webkit.org/260555@main I landed an optimization avoid the extra
move in ResolveNode. However, that's not valid when we actually need the TDZ check.
If the check fails, we throw an exception, but we already wrote to the destination.
As a compromise, we still avoid the move unless we actually need the TDZ check.

* JSTests/stress/tdz-check-catch-read.js: Added.
(f):
* Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:
(JSC::ResolveNode::emitBytecode):

Canonical link: https://commits.webkit.org/261006@main

9b1d9e8

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ›  gtk
βœ… πŸ§ͺ webkitperl   πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ gtk-wk2
  πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk1 βœ… πŸ§ͺ api-gtk
βœ… πŸ›  πŸ§ͺ jsc βœ… πŸ›  tv βœ… πŸ§ͺ mac-wk2 βœ… πŸ›  jsc-armv7
βœ… πŸ›  πŸ§ͺ jsc-arm64 βœ… πŸ›  tv-sim   πŸ§ͺ mac-AS-debug-wk2 βœ… πŸ§ͺ jsc-armv7-tests
βœ… πŸ›  watch βœ… πŸ§ͺ mac-wk2-stress βœ… πŸ›  jsc-mips
❌ πŸ›  πŸ§ͺ merge βœ… πŸ›  watch-sim βœ… πŸ§ͺ jsc-mips-tests

@tadeuzagallo tadeuzagallo requested a review from a team as a code owner March 1, 2023 09:53
@tadeuzagallo tadeuzagallo self-assigned this Mar 1, 2023
@tadeuzagallo tadeuzagallo added the JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues. label Mar 1, 2023
@tadeuzagallo tadeuzagallo force-pushed the eng/JSC-ResolveNode-cant-always-skip-the-extra-move branch from 79b3eb5 to e334508 Compare March 1, 2023 11:10
Copy link
Contributor

@kmiller68 kmiller68 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me

let b=((a=b),{t(){b}})
}catch{
}
a._
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To verify I understand the bug correctly, without this change (and with the other change), a is JSValue() here and not the original value?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's right. We evaluate a = b (= JSValue()) then check_tdz throws, but we already assigned

@tadeuzagallo tadeuzagallo force-pushed the eng/JSC-ResolveNode-cant-always-skip-the-extra-move branch from e334508 to 9b1d9e8 Compare March 1, 2023 14:20
@tadeuzagallo tadeuzagallo added the merge-queue Applied to send a pull request to merge-queue label Mar 1, 2023
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/JSC-ResolveNode-cant-always-skip-the-extra-move branch from 9b1d9e8 to 1c91dd0 Compare March 1, 2023 15:20
https://bugs.webkit.org/show_bug.cgi?id=253142
rdar://106076478

Reviewed by Keith Miller.

In http://commits.webkit.org/260555@main I landed an optimization avoid the extra
move in ResolveNode. However, that's not valid when we actually need the TDZ check.
If the check fails, we throw an exception, but we already wrote to the destination.
As a compromise, we still avoid the move unless we actually need the TDZ check.

* JSTests/stress/tdz-check-catch-read.js: Added.
(f):
* Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:
(JSC::ResolveNode::emitBytecode):

Canonical link: https://commits.webkit.org/261006@main
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/JSC-ResolveNode-cant-always-skip-the-extra-move branch from 1c91dd0 to e7b74be Compare March 1, 2023 15:23
@webkit-commit-queue
Copy link
Collaborator

Committed 261006@main (e7b74be): https://commits.webkit.org/261006@main

Reviewed commits have been landed. Closing PR #10853 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system merged commit e7b74be into WebKit:main Mar 1, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Mar 1, 2023
@tadeuzagallo tadeuzagallo deleted the eng/JSC-ResolveNode-cant-always-skip-the-extra-move branch May 17, 2023 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues.
Projects
None yet
4 participants