[webkit-changes] [WebKit/WebKit] d814f4: vmEntryToJavaScript does not need to use the arity...
EWS
noreply at github.com
Fri Jan 27 19:42:13 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d814f4a60054948f2b0b580fae1159850f6eb97d
https://github.com/WebKit/WebKit/commit/d814f4a60054948f2b0b580fae1159850f6eb97d
Author: Mark Lam <mark.lam at apple.com>
Date: 2023-01-27 (Fri, 27 Jan 2023)
Changed paths:
M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
M Source/JavaScriptCore/dfg/DFGOperations.cpp
M Source/JavaScriptCore/ftl/FTLJITCode.h
M Source/JavaScriptCore/interpreter/Interpreter.cpp
M Source/JavaScriptCore/interpreter/Interpreter.h
M Source/JavaScriptCore/interpreter/InterpreterInlines.h
M Source/JavaScriptCore/interpreter/ProtoCallFrame.h
M Source/JavaScriptCore/interpreter/ProtoCallFrameInlines.h
M Source/JavaScriptCore/jit/JITCode.cpp
M Source/JavaScriptCore/jit/JITCode.h
R Source/JavaScriptCore/jit/JITCodeInlines.h
M Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
M Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
M Source/JavaScriptCore/runtime/Completion.cpp
M Source/JavaScriptCore/runtime/StringPrototype.cpp
M Source/JavaScriptCore/wasm/js/WebAssemblyFunction.h
Log Message:
-----------
vmEntryToJavaScript does not need to use the arity check entry.
https://bugs.webkit.org/show_bug.cgi?id=251289
<rdar://problem/104759274>
Reviewed by Geoffrey Garen and Yusuke Suzuki.
This is because we can tell the ProtoCallFrame to ensure that there is enough argument
space to meet arity requirements instead.
With this, we can also make the following changes:
1. We no longer need to look up the arity check entry in JITCode. Instead, we'll add
a m_addressForCall CodePtr in the base JITCode which is common across all JITCode
subclasses, and therefore can be accessed without a virtual call. To enable this,
we also change JITCodeWithCodeRef to not use a CodeRef. Instead, we use the
m_addressForCall CodePtr along with a m_executableMemory RefPtr in JITCodeWithCodeRef
itself to track the equivalent information.
2. Remove JITCode::execute(). Clients will not call vmEntryToJavaScript directly instead.
Other than calling vmEntryToJavaScript, the other things that JITCode::execute() does are:
a. Set vm.didEnterVM on exit. The only client that doesn't already do this is
Interpreter::executeCachedCall. So, we'll just add it there.
b. Change the return value of vmEntryToJavaScript to jsNull if an exception is present
on exit. I believe this was in to ensure that checkedReturn() does not complain.
The purpose of checkeReturn() is for a legacy reason: back then, we didn't have exception
check validation to ensure that exceptions are checked in all the right places.
checkedReturn() adds an ASSERT to help ensure that we don't return a nullptr. However, a
null check doesn't really provide much of a guarantee that the return value is valid. So,
we'll just remove checkedReturn() especially since we now have exception check validation.
3. We also change the return paths in vmEntrytoJavaScript for errors and unhandled exceptions
to always return jsUndefined. This is not strictly needed but it is extremely low cost, and
helps make debugging an unchecked exception easier (as opposed to returning whatever random
value was in the register).
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/dfg/DFGOperations.cpp:
* Source/JavaScriptCore/ftl/FTLJITCode.h:
* Source/JavaScriptCore/interpreter/Interpreter.cpp:
(JSC::eval):
(JSC::Interpreter::executeProgram):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::executeEval):
(JSC::Interpreter::executeModuleProgram):
* Source/JavaScriptCore/interpreter/Interpreter.h:
(JSC::Interpreter::checkedReturn): Deleted.
* Source/JavaScriptCore/interpreter/InterpreterInlines.h:
(JSC::Interpreter::executeCachedCall):
* Source/JavaScriptCore/interpreter/ProtoCallFrame.h:
* Source/JavaScriptCore/interpreter/ProtoCallFrameInlines.h:
(JSC::ProtoCallFrame::init):
* Source/JavaScriptCore/jit/JITCode.cpp:
(JSC::JITCode::JITCode):
(JSC::JITCodeWithCodeRef::JITCodeWithCodeRef):
(JSC::JITCodeWithCodeRef::~JITCodeWithCodeRef):
(JSC::JITCodeWithCodeRef::executableAddressAtOffset):
(JSC::JITCodeWithCodeRef::dataAddressAtOffset):
(JSC::JITCodeWithCodeRef::offsetOf):
(JSC::JITCodeWithCodeRef::size):
(JSC::JITCodeWithCodeRef::contains):
(JSC::JITCodeWithCodeRef::swapCodeRefForDebugger):
(JSC::DirectJITCode::DirectJITCode):
(JSC::DirectJITCode::initializeCodeRefForDFG):
(JSC::DirectJITCode::addressForCall):
(JSC::NativeJITCode::addressForCall):
* Source/JavaScriptCore/jit/JITCode.h:
(JSC::JITCode::addressForCall const):
* Source/JavaScriptCore/jit/JITCodeInlines.h: Removed.
* Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm:
* Source/JavaScriptCore/llint/LowLevelInterpreter64.asm:
* Source/JavaScriptCore/runtime/Completion.cpp:
(JSC::evaluate):
* Source/JavaScriptCore/runtime/StringPrototype.cpp:
* Source/JavaScriptCore/wasm/js/WebAssemblyFunction.h:
Canonical link: https://commits.webkit.org/259520@main
More information about the webkit-changes
mailing list