-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Invalidate IsInstInlineCache
in Object.setPrototypeOf
#6858
base: master
Are you sure you want to change the base?
Invalidate IsInstInlineCache
in Object.setPrototypeOf
#6858
Conversation
Thank you for the submission, I'm going to have think a bit more about this (probably on monday) This certainly fixes the specific case, but I'd like to throw some more complex cases at it AND also see if we can test whether it's removing caches it shouldn't (which will be slightly harder to test). |
Yes, that's a good idea! The logic defenently doesn't remove everything all the time. |
Sorry that I'm not done with this yet, I've been struggling to think of how to do the additional tests I'd like to do, there is no obvious good way to verify cache hits, so, awkwardly we may need to add one (for debug builds only) in order to test this sufficiently. |
No problem, I’m struggling with that as well. |
If you want to try and do it:
|
Sorry, that it took me so long, but I still had some work to do. The Problem is, that jit abstracts the calls to the test functions away. EDIT: I'm now preventing the fast path in jit, kind of like it's done in some other scenarios for testing. |
I'm not ignoring this - thank you for your efforts, I've still got some more cases I'd like to check and out of time for today will look a bit further when I can. |
Apologies for the massive delay - I've paused working on other code changes until I've sorted apple silicon support which is taking me longer than I hoped... |
@rhuanjl |
Using
Object.setPrototypeOf
may result ininstanceof
returning the wrong result, as theIsInstInlineCache
is not invalidated (See #5915).Steps:
function -> IsInstInlineCache[]
dictionary using the newThreadContext.MapIsInstInlineCaches
functiontype
type
isnull
ChakraCore/lib/Runtime/Library/JavascriptFunction.cpp
Lines 3365 to 3367 in 0cfe82d
ThreadContext.UnregisterIsInstInlineCache
(correctsnext
) and ...memset
I couldn't come up with a scenario where the
function
could be affected (x instance of function
).Therefore, the following code should not be necessary (not included in latest commit):
ChakraCore/lib/Runtime/Library/JavascriptObject.cpp
Lines 255 to 272 in 2d7e459
@rhuanjl
Fixes #5915