Bug 228550 - LLInt get_by_id unset IC looks inadventently disabled
Summary: LLInt get_by_id unset IC looks inadventently disabled
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Angelos Oikonomopoulos
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-07-28 06:10 PDT by Angelos Oikonomopoulos
Modified: 2021-08-04 06:11 PDT (History)
7 users (show)

See Also:


Attachments
Patch (1.39 KB, patch)
2021-07-28 06:11 PDT, Angelos Oikonomopoulos
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Angelos Oikonomopoulos 2021-07-28 06:10:35 PDT
LLInt get_by_id IC looks inadventently disabled
Comment 1 Angelos Oikonomopoulos 2021-07-28 06:11:05 PDT
Created attachment 434424 [details]
Patch
Comment 2 Angelos Oikonomopoulos 2021-07-28 06:16:13 PDT
This commit

https://github.com/WebKit/WebKit/commit/22d3ec3ad0249d03d9a909c909fb1ccc246e1de5#diff-95ecbe05ccde2fa9490e1bac06bc5a159fabc13dc58aa4e7a33114fd95176d0aR775

appears to accidentally disable unsetMode for the IC in performLLIntGetByID. Specifically, we can only switch to unsetMode in setupGetByIdPrototypeCache, but the only call to setupGetByIdPrototypeCache is guarded by

     if (!LLINT_ALWAYS_ACCESS_SLOW
         && baseValue.isCell()
         && slot.isCacheable()
         && !slot.isUnset()) {

in the body of performLLIntGetByID.
Comment 3 Saam Barati 2021-07-28 10:32:39 PDT
(In reply to Angelos Oikonomopoulos from comment #0)
> LLInt get_by_id IC looks inadventently disabled

The name of this bug seems off. I think you mean just proto loads.
Comment 4 Angelos Oikonomopoulos 2021-07-29 04:49:39 PDT
(In reply to Saam Barati from comment #3)
> (In reply to Angelos Oikonomopoulos from comment #0)
> > LLInt get_by_id IC looks inadventently disabled
> 
> The name of this bug seems off. I think you mean just proto loads.

I meant unsetMode. Updated the name.
Comment 5 Saam Barati 2021-07-29 11:20:24 PDT
Comment on attachment 434424 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=434424&action=review

> Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:775
> -        && slot.isCacheable()
> -        && !slot.isUnset()) {
> +        && slot.isCacheable()) {

I don't see how this is doing anything. In the below code, we only check for isValue before doing proto loads. What am I missing?
Comment 6 Angelos Oikonomopoulos 2021-07-30 02:16:11 PDT
(In reply to Saam Barati from comment #5)
> Comment on attachment 434424 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=434424&action=review
> 
> > Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:775
> > -        && slot.isCacheable()
> > -        && !slot.isUnset()) {
> > +        && slot.isCacheable()) {
> 
> I don't see how this is doing anything. In the below code, we only check for
> isValue before doing proto loads. What am I missing?

Going by your use of 'only', what you're missing may be that

} else if (UNLIKELY(metadata.hitCountForLLIntCaching && slot.isValue())) {

is nested within

if (!LLINT_ALWAYS_ACCESS_SLOW
        && baseValue.isCell()
        && slot.isCacheable()
        && !slot.isUnset()) {

?
Comment 7 Saam Barati 2021-07-30 08:25:04 PDT
(In reply to Angelos Oikonomopoulos from comment #6)
> (In reply to Saam Barati from comment #5)
> > Comment on attachment 434424 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=434424&action=review
> > 
> > > Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:775
> > > -        && slot.isCacheable()
> > > -        && !slot.isUnset()) {
> > > +        && slot.isCacheable()) {
> > 
> > I don't see how this is doing anything. In the below code, we only check for
> > isValue before doing proto loads. What am I missing?
> 
> Going by your use of 'only', what you're missing may be that
> 
> } else if (UNLIKELY(metadata.hitCountForLLIntCaching && slot.isValue())) {
> 
> is nested within
> 
> if (!LLINT_ALWAYS_ACCESS_SLOW
>         && baseValue.isCell()
>         && slot.isCacheable()
>         && !slot.isUnset()) {
> 
> ?

slot.isValue() implies !slot.isUnset(). You can't be both a value and unset. So I don't see how removing !slot.isUnset() changes anything to be different in the proto load case, since we check slot.isValue()
Comment 8 Angelos Oikonomopoulos 2021-07-30 08:29:20 PDT
Fair enough, the patch is a no-op then. But AFAICT unsetMode remains effectively disabled, since the only call to setupGetByIdPrototypeCache is guarded by the slot.isValue() check.
Comment 9 Saam Barati 2021-07-30 12:28:15 PDT
(In reply to Angelos Oikonomopoulos from comment #8)
> Fair enough, the patch is a no-op then. But AFAICT unsetMode remains
> effectively disabled, since the only call to setupGetByIdPrototypeCache is
> guarded by the slot.isValue() check.

Right. Maybe that call to setupGetByIdPrototypeCache shouldn't be guarded by isValue()?
Comment 10 Saam Barati 2021-07-30 12:30:30 PDT
Clearing "r?" for now
Comment 11 Radar WebKit Bug Importer 2021-08-04 06:11:17 PDT
<rdar://problem/81511696>