Bug 209158 - AccessCase::canReplace should allow a Getter to replace an IntrinsicGetter
Summary: AccessCase::canReplace should allow a Getter to replace an IntrinsicGetter
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tadeu Zagallo
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-03-16 16:36 PDT by Tadeu Zagallo
Modified: 2020-03-17 12:45 PDT (History)
7 users (show)

See Also:


Attachments
Patch (3.68 KB, patch)
2020-03-16 16:46 PDT, Tadeu Zagallo
no flags Details | Formatted Diff | Diff
Patch for landing (3.74 KB, patch)
2020-03-17 11:56 PDT, Tadeu Zagallo
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tadeu Zagallo 2020-03-16 16:36:00 PDT
...
Comment 1 Tadeu Zagallo 2020-03-16 16:44:53 PDT
<rdar://problem/59222012>
Comment 2 Tadeu Zagallo 2020-03-16 16:46:05 PDT
Created attachment 393707 [details]
Patch
Comment 3 Keith Miller 2020-03-16 19:41:36 PDT
Comment on attachment 393707 [details]
Patch

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

> Source/JavaScriptCore/bytecode/AccessCase.cpp:681
> +        if (other.type() != type() && other.type() != IntrinsicGetter)

Isn't this just always false? I think you want an ||?
Comment 4 Keith Miller 2020-03-16 19:44:00 PDT
Comment on attachment 393707 [details]
Patch

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

>> Source/JavaScriptCore/bytecode/AccessCase.cpp:681
>> +        if (other.type() != type() && other.type() != IntrinsicGetter)
> 
> Isn't this just always false? I think you want an ||?

Nvm, I just misread this as ==.
Comment 5 Saam Barati 2020-03-16 23:53:24 PDT
Comment on attachment 393707 [details]
Patch

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

r=me

> Source/JavaScriptCore/ChangeLog:9
> +        When we override an intrinsic getter with an user defined getter, we might end up with the

"an user" => "a user"

> Source/JavaScriptCore/bytecode/AccessCase.cpp:680
> +    case Getter:

You're missing the other direction here, where |this| is InrinsicGetter, and the other is Getter

If you wanted to be fancy, you could have something like:

bool isInterchangeable(AccessType a, AccessType b)
{
    if (a == b)
        return true;
    if (a == Getter and b == IntrinsicGetter)
        return true;
    if (a == IntrinsicGettter and b == Getter)
      return true
}

and then just write this function in terms of that
Comment 6 Tadeu Zagallo 2020-03-17 11:54:34 PDT
Comment on attachment 393707 [details]
Patch

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

>> Source/JavaScriptCore/ChangeLog:9
>> +        When we override an intrinsic getter with an user defined getter, we might end up with the
> 
> "an user" => "a user"

I debated that, thanks.

>> Source/JavaScriptCore/bytecode/AccessCase.cpp:680
>> +    case Getter:
> 
> You're missing the other direction here, where |this| is InrinsicGetter, and the other is Getter
> 
> If you wanted to be fancy, you could have something like:
> 
> bool isInterchangeable(AccessType a, AccessType b)
> {
>     if (a == b)
>         return true;
>     if (a == Getter and b == IntrinsicGetter)
>         return true;
>     if (a == IntrinsicGettter and b == Getter)
>       return true
> }
> 
> and then just write this function in terms of that

I was unsure whether it was possible to go in the other direction. Fixed it now.
Comment 7 Tadeu Zagallo 2020-03-17 11:56:05 PDT
Created attachment 393773 [details]
Patch for landing
Comment 8 WebKit Commit Bot 2020-03-17 12:45:10 PDT
Comment on attachment 393773 [details]
Patch for landing

Clearing flags on attachment: 393773

Committed r258573: <https://trac.webkit.org/changeset/258573>
Comment 9 WebKit Commit Bot 2020-03-17 12:45:12 PDT
All reviewed patches have been landed.  Closing bug.