RESOLVED FIXED 251289
vmEntryToJavaScript does not need to use the arity check entry.
https://bugs.webkit.org/show_bug.cgi?id=251289
Summary vmEntryToJavaScript does not need to use the arity check entry.
Mark Lam
Reported 2023-01-27 13:30:37 PST
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).
Attachments
Radar WebKit Bug Importer
Comment 1 2023-01-27 13:30:59 PST
Mark Lam
Comment 2 2023-01-27 13:51:29 PST
EWS
Comment 3 2023-01-27 19:42:03 PST
Committed 259520@main (d814f4a60054): <https://commits.webkit.org/259520@main> Reviewed commits have been landed. Closing PR #9254 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.