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] Stop nulling out the CodeBlock spot inside the call frame inside WebAssembly #7991

Conversation

Constellation
Copy link
Member

@Constellation Constellation commented Dec 22, 2022

5f73a3c

[JSC] Stop nulling out the CodeBlock spot inside the call frame inside WebAssembly
https://bugs.webkit.org/show_bug.cgi?id=165321
rdar://103618930

Reviewed by Mark Lam.

We are putting nullptr unnecessarily to CodeBlock slot while Callee information is enough to say this CallFrame is wasm frame or not.
This patch removes it, and fixing places getting CodeBlock from CallFrame with the assumption that it can be nullptr when it is wasm
frame. This allows to drop unnecessary zero fill for *all* wasm functions, which is bad.

* Source/JavaScriptCore/bytecode/CodeBlock.cpp:
(JSC::CodeBlock::noticeIncomingCall):
* Source/JavaScriptCore/bytecode/Repatch.cpp:
(JSC::linkMonomorphicCall):
(JSC::linkDirectCall):
(JSC::linkVirtualFor):
(JSC::linkPolymorphicCall):
* Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp:
(JSC::DebuggerCallFrame::scope):
(JSC::DebuggerCallFrame::thisValue const):
(JSC::DebuggerCallFrame::evaluateWithScopeExtension):
(JSC::DebuggerCallFrame::sourceIDForCallFrame):
* Source/JavaScriptCore/dfg/DFGDoesGCCheck.cpp:
(JSC::DFG::DoesGCCheck::verifyCanGC):
* Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::functionName):
* Source/JavaScriptCore/interpreter/CallFrameInlines.h:
(JSC::CallFrame::codeBlock const):
* Source/JavaScriptCore/interpreter/Interpreter.cpp:
(JSC::Interpreter::unwind):
* Source/JavaScriptCore/interpreter/ShadowChicken.cpp:
(JSC::ShadowChicken::update):
* Source/JavaScriptCore/interpreter/StackVisitor.cpp:
(JSC::StackVisitor::readNonInlinedFrame):
* Source/JavaScriptCore/jit/JITExceptions.cpp:
(JSC::genericUnwind):
* Source/JavaScriptCore/jit/PolymorphicCallStubRoutine.cpp:
(JSC::PolymorphicCallStubRoutine::PolymorphicCallStubRoutine):
* Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp:
(JSC::getCallerCodeBlock):
* Source/JavaScriptCore/runtime/VM.cpp:
(JSC::VM::throwException):
* Source/JavaScriptCore/runtime/VMTraps.cpp:
(JSC::VMTraps::invalidateCodeBlocksOnStack):
* Source/JavaScriptCore/tools/VMInspector.cpp:
(JSC::VMInspector::dumpRegisters):
* Source/JavaScriptCore/wasm/WasmAirIRGeneratorBase.h:
(JSC::Wasm::ExpressionType>::AirIRGeneratorBase):
* Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::B3IRGenerator):
* Source/JavaScriptCore/wasm/js/JSToWasm.cpp:
(JSC::Wasm::createJSToWasmWrapper):
* Source/JavaScriptCore/wasm/js/WasmToJS.cpp:
(JSC::Wasm::wasmToJS):

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

8041770

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe   πŸ›  πŸ§ͺ win
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ›  gtk βœ… πŸ›  wincairo
βœ… πŸ§ͺ 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
βœ… πŸ›  watch-sim βœ… πŸ§ͺ jsc-mips-tests
βœ… πŸ›  πŸ§ͺ unsafe-merge

@Constellation Constellation self-assigned this Dec 22, 2022
@Constellation Constellation added the JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues. label Dec 22, 2022
@Constellation Constellation force-pushed the eng/JSC-Stop-nulling-out-the-CodeBlock-spot-inside-the-call-frame-inside-WebAssembly branch from 8460d97 to da1743a Compare December 22, 2022 00:56
@Constellation Constellation force-pushed the eng/JSC-Stop-nulling-out-the-CodeBlock-spot-inside-the-call-frame-inside-WebAssembly branch from da1743a to 0a9fc34 Compare December 22, 2022 00:59
Copy link

@MenloDorian MenloDorian 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

@Constellation Constellation force-pushed the eng/JSC-Stop-nulling-out-the-CodeBlock-spot-inside-the-call-frame-inside-WebAssembly branch 2 times, most recently from 75f373a to d2475d6 Compare December 22, 2022 02:16
@Constellation Constellation force-pushed the eng/JSC-Stop-nulling-out-the-CodeBlock-spot-inside-the-call-frame-inside-WebAssembly branch 2 times, most recently from 4744d66 to d1cceeb Compare December 22, 2022 02:20
@Constellation Constellation force-pushed the eng/JSC-Stop-nulling-out-the-CodeBlock-spot-inside-the-call-frame-inside-WebAssembly branch from d1cceeb to 8041770 Compare December 22, 2022 02:25
@Constellation Constellation added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Dec 22, 2022
…e WebAssembly

https://bugs.webkit.org/show_bug.cgi?id=165321
rdar://103618930

Reviewed by Mark Lam.

We are putting nullptr unnecessarily to CodeBlock slot while Callee information is enough to say this CallFrame is wasm frame or not.
This patch removes it, and fixing places getting CodeBlock from CallFrame with the assumption that it can be nullptr when it is wasm
frame. This allows to drop unnecessary zero fill for *all* wasm functions, which is bad.

* Source/JavaScriptCore/bytecode/CodeBlock.cpp:
(JSC::CodeBlock::noticeIncomingCall):
* Source/JavaScriptCore/bytecode/Repatch.cpp:
(JSC::linkMonomorphicCall):
(JSC::linkDirectCall):
(JSC::linkVirtualFor):
(JSC::linkPolymorphicCall):
* Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp:
(JSC::DebuggerCallFrame::scope):
(JSC::DebuggerCallFrame::thisValue const):
(JSC::DebuggerCallFrame::evaluateWithScopeExtension):
(JSC::DebuggerCallFrame::sourceIDForCallFrame):
* Source/JavaScriptCore/dfg/DFGDoesGCCheck.cpp:
(JSC::DFG::DoesGCCheck::verifyCanGC):
* Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::functionName):
* Source/JavaScriptCore/interpreter/CallFrameInlines.h:
(JSC::CallFrame::codeBlock const):
* Source/JavaScriptCore/interpreter/Interpreter.cpp:
(JSC::Interpreter::unwind):
* Source/JavaScriptCore/interpreter/ShadowChicken.cpp:
(JSC::ShadowChicken::update):
* Source/JavaScriptCore/interpreter/StackVisitor.cpp:
(JSC::StackVisitor::readNonInlinedFrame):
* Source/JavaScriptCore/jit/JITExceptions.cpp:
(JSC::genericUnwind):
* Source/JavaScriptCore/jit/PolymorphicCallStubRoutine.cpp:
(JSC::PolymorphicCallStubRoutine::PolymorphicCallStubRoutine):
* Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp:
(JSC::getCallerCodeBlock):
* Source/JavaScriptCore/runtime/VM.cpp:
(JSC::VM::throwException):
* Source/JavaScriptCore/runtime/VMTraps.cpp:
(JSC::VMTraps::invalidateCodeBlocksOnStack):
* Source/JavaScriptCore/tools/VMInspector.cpp:
(JSC::VMInspector::dumpRegisters):
* Source/JavaScriptCore/wasm/WasmAirIRGeneratorBase.h:
(JSC::Wasm::ExpressionType>::AirIRGeneratorBase):
* Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::B3IRGenerator):
* Source/JavaScriptCore/wasm/js/JSToWasm.cpp:
(JSC::Wasm::createJSToWasmWrapper):
* Source/JavaScriptCore/wasm/js/WasmToJS.cpp:
(JSC::Wasm::wasmToJS):

Canonical link: https://commits.webkit.org/258233@main
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/JSC-Stop-nulling-out-the-CodeBlock-spot-inside-the-call-frame-inside-WebAssembly branch from 8041770 to 5f73a3c Compare December 22, 2022 04:54
@webkit-commit-queue
Copy link
Collaborator

Committed 258233@main (5f73a3c): https://commits.webkit.org/258233@main

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

@webkit-early-warning-system webkit-early-warning-system merged commit 5f73a3c into WebKit:main Dec 22, 2022
@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 Dec 22, 2022
@Constellation Constellation deleted the eng/JSC-Stop-nulling-out-the-CodeBlock-spot-inside-the-call-frame-inside-WebAssembly branch December 22, 2022 19:07
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