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] Make megamorphic IC stateless #28714

Conversation

Constellation
Copy link
Member

@Constellation Constellation commented May 17, 2024

6e5a36b

[JSC] Make megamorphic IC stateless
https://bugs.webkit.org/show_bug.cgi?id=274316
rdar://128277946

Reviewed by Keith Miller.

We store expected UniquedStringImpl into InlineCacheHandler (must not keep it as Ref! lifetime is managed by StructureStubInfo) in megamorphic IC
when Handler IC is enabled. And we retrieve it from GPRInfo::handlerGPR. So we can share one code for all of megamorphic IC, thus it becomes stateless.

* Source/JavaScriptCore/bytecode/InlineCacheCompiler.cpp:
(JSC::isStateless):
(JSC::InlineCacheHandler::InlineCacheHandler):
(JSC::InlineCacheCompiler::generateWithGuard):
(JSC::InlineCacheCompiler::regenerate):
* Source/JavaScriptCore/bytecode/InlineCacheCompiler.h:

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

a231c2e

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

@Constellation Constellation requested a review from a team as a code owner May 17, 2024 16:29
@Constellation Constellation self-assigned this May 17, 2024
@Constellation Constellation added the JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues. label May 17, 2024
@Constellation Constellation force-pushed the eng/JSC-Make-megamorphic-IC-stateless branch from 2def74d to 3c0e06e Compare May 17, 2024 16:29
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.


static Ref<InlineCacheHandler> createSlowPath(VM&, AccessType);

CodePtr<JITStubRoutinePtrTag> m_callTarget;
CodePtr<JITStubRoutinePtrTag> m_jumpTarget;
UniquedStringImpl* m_uid { nullptr };
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice if we could use CheckedPtr<UniquedStringImpl> here but I guess StringImpl isn't CanMakeCheckedPtr

@Constellation Constellation force-pushed the eng/JSC-Make-megamorphic-IC-stateless branch from 3c0e06e to a231c2e Compare May 18, 2024 00:23
@Constellation Constellation added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label May 18, 2024
https://bugs.webkit.org/show_bug.cgi?id=274316
rdar://128277946

Reviewed by Keith Miller.

We store expected UniquedStringImpl into InlineCacheHandler (must not keep it as Ref! lifetime is managed by StructureStubInfo) in megamorphic IC
when Handler IC is enabled. And we retrieve it from GPRInfo::handlerGPR. So we can share one code for all of megamorphic IC, thus it becomes stateless.

* Source/JavaScriptCore/bytecode/InlineCacheCompiler.cpp:
(JSC::isStateless):
(JSC::InlineCacheHandler::InlineCacheHandler):
(JSC::InlineCacheCompiler::generateWithGuard):
(JSC::InlineCacheCompiler::regenerate):
* Source/JavaScriptCore/bytecode/InlineCacheCompiler.h:

Canonical link: https://commits.webkit.org/278946@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/JSC-Make-megamorphic-IC-stateless branch from a231c2e to 6e5a36b Compare May 18, 2024 04:25
@webkit-commit-queue
Copy link
Collaborator

Committed 278946@main (6e5a36b): https://commits.webkit.org/278946@main

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

@webkit-commit-queue webkit-commit-queue merged commit 6e5a36b into WebKit:main May 18, 2024
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label May 18, 2024
@Constellation Constellation deleted the eng/JSC-Make-megamorphic-IC-stateless branch May 19, 2024 03:23
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