[Webkit-unassigned] [Bug 251289] New: vmEntryToJavaScript does not need to use the arity check entry.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jan 27 13:30:37 PST 2023


https://bugs.webkit.org/show_bug.cgi?id=251289

            Bug ID: 251289
           Summary: vmEntryToJavaScript does not need to use the arity
                    check entry.
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mark.lam at apple.com

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).

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230127/679353f8/attachment.htm>


More information about the webkit-unassigned mailing list