⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 257605 in webkit


Ignore:
Timestamp:
Feb 27, 2020, 5:34:05 PM (7 years ago)
Author:
Justin Michaud
Message:

Poly proto should work with property delete transitions
https://bugs.webkit.org/show_bug.cgi?id=208261

Reviewed by Saam Barati.

JSTests:

  • stress/delete-property-poly-proto.js: Added.

(A.prototype.set x):
(A):
(B):

Source/JavaScriptCore:

This patch fixes a bug where the combination of inline caching
and poly proto cause us to cache a setter call along a prototype chain that
is no longer the correct setter to call. This is exposed as a result of
https://bugs.webkit.org/show_bug.cgi?id=206430 since DefineOwnProperty used
to transition to uncacheable dictionary.

The case looks like this:
A - setter for x redefines x
|
B
|
C

We set (new C).x

Right now, we first call A's setter, then we try to figure out what the state of things
were before it was called in order to cache it. We just assume that A's setter still exists, and we cache it
without ever checking, In this patch, we ensure that the property exists and the attributes match in order to prevent crashing.

In the code, A = target, C = base.

Get is correct because it collects caching information before any calls.

The bug https://bugs.webkit.org/show_bug.cgi?id=208337 tracks the remaining semantic bugs around this code.

  • jit/Repatch.cpp:

(JSC::tryCachePutByID):

Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r257590 r257605  
     12020-02-27  Justin Michaud  <justin_michaud@apple.com>
     2
     3        Poly proto should work with property delete transitions
     4        https://bugs.webkit.org/show_bug.cgi?id=208261
     5
     6        Reviewed by Saam Barati.
     7
     8        * stress/delete-property-poly-proto.js: Added.
     9        (A.prototype.set x):
     10        (A):
     11        (B):
     12
    1132020-02-27  Ross Kirsling  <ross.kirsling@sony.com>
    214
  • trunk/Source/JavaScriptCore/ChangeLog

    r257598 r257605  
     12020-02-27  Justin Michaud  <justin_michaud@apple.com>
     2
     3        Poly proto should work with property delete transitions
     4        https://bugs.webkit.org/show_bug.cgi?id=208261
     5
     6        Reviewed by Saam Barati.
     7
     8        This patch fixes a bug where the combination of inline caching
     9        and poly proto cause us to cache a setter call along a prototype chain that
     10        is no longer the correct setter to call. This is exposed as a result of
     11        https://bugs.webkit.org/show_bug.cgi?id=206430 since DefineOwnProperty used
     12        to transition to uncacheable dictionary.
     13
     14        The case looks like this:
     15        A - setter for x redefines x
     16        |
     17        B
     18        |
     19        C
     20
     21        We set (new C).x
     22
     23        Right now, we first call A's setter, then we try to figure out what the state of things
     24        were before it was called in order to cache it. We just assume that A's setter still exists, and we cache it
     25        without ever checking, In this patch, we ensure that the property exists and the attributes match in order to prevent crashing.
     26
     27        In the code, A = target, C = base.
     28
     29        Get is correct because it collects caching information before any calls.
     30
     31        The bug https://bugs.webkit.org/show_bug.cgi?id=208337 tracks the remaining semantic bugs around this code.
     32
     33        * jit/Repatch.cpp:
     34        (JSC::tryCachePutByID):
     35
    1362020-02-27  Basuke Suzuki  <basuke.suzuki@sony.com>
    237
  • trunk/Source/JavaScriptCore/jit/Repatch.cpp

    r257399 r257605  
    689689                        if (!prototypeAccessChain)
    690690                            return GiveUpOnCache;
    691                         offset = prototypeAccessChain->slotBaseStructure(vm, baseCell->structure(vm))->get(vm, ident.impl());
     691                        unsigned attributes;
     692                        offset = prototypeAccessChain->slotBaseStructure(vm, baseCell->structure(vm))->get(vm, ident.impl(), attributes);
     693                        if (!isValidOffset(offset) || !(attributes & PropertyAttribute::Accessor))
     694                            return RetryCacheLater;
    692695                    } else {
    693696                        prototypeAccessChain = nullptr;
Note: See TracChangeset for help on using the changeset viewer.