Changeset 225844 in webkit


Ignore:
Timestamp:
Dec 13, 2017 9:19:24 AM (6 years ago)
Author:
sbarati@apple.com
Message:

TypeCheckHoistingPhase needs to emit a CheckStructureOrEmpty if it's doing it for |this|
https://bugs.webkit.org/show_bug.cgi?id=180734
<rdar://problem/35640547>

Reviewed by Yusuke Suzuki.

JSTests:

  • stress/type-check-hoisting-phase-hoist-check-structure-on-tdz-this-value.js: Added.

(isPropertyOfType):
(
getProperties):
(getObjects):
(
getRandomObject):
(theClass.):
(theClass):
(childClass):
(counter.catch):

Source/JavaScriptCore:

The |this| value may be TDZ. If type check hoisting phase
hoists a CheckStructure to it, it will crash. This patch
makes it so we emit CheckStructureOrEmpty for |this|.

  • dfg/DFGTypeCheckHoistingPhase.cpp:

(JSC::DFG::TypeCheckHoistingPhase::run):

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r225834 r225844  
     12017-12-13  Saam Barati  <sbarati@apple.com>
     2
     3        TypeCheckHoistingPhase needs to emit a CheckStructureOrEmpty if it's doing it for |this|
     4        https://bugs.webkit.org/show_bug.cgi?id=180734
     5        <rdar://problem/35640547>
     6
     7        Reviewed by Yusuke Suzuki.
     8
     9        * stress/type-check-hoisting-phase-hoist-check-structure-on-tdz-this-value.js: Added.
     10        (__isPropertyOfType):
     11        (__getProperties):
     12        (__getObjects):
     13        (__getRandomObject):
     14        (theClass.):
     15        (theClass):
     16        (childClass):
     17        (counter.catch):
     18
    1192017-12-12  Saam Barati  <sbarati@apple.com>
    220
  • trunk/Source/JavaScriptCore/ChangeLog

    r225840 r225844  
     12017-12-13  Saam Barati  <sbarati@apple.com>
     2
     3        TypeCheckHoistingPhase needs to emit a CheckStructureOrEmpty if it's doing it for |this|
     4        https://bugs.webkit.org/show_bug.cgi?id=180734
     5        <rdar://problem/35640547>
     6
     7        Reviewed by Yusuke Suzuki.
     8
     9        The |this| value may be TDZ. If type check hoisting phase
     10        hoists a CheckStructure to it, it will crash. This patch
     11        makes it so we emit CheckStructureOrEmpty for |this|.
     12
     13        * dfg/DFGTypeCheckHoistingPhase.cpp:
     14        (JSC::DFG::TypeCheckHoistingPhase::run):
     15
    1162017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
    217
  • trunk/Source/JavaScriptCore/dfg/DFGTypeCheckHoistingPhase.cpp

    r225307 r225844  
    145145                        OpInfo(variable), Edge(node));
    146146                    if (iter->value.m_structure) {
     147                        auto checkOp = CheckStructure;
     148                        VirtualRegister local = node->variableAccessData()->local();
     149                        auto* inlineCallFrame = node->origin.semantic.inlineCallFrame;
     150                        if ((local - (inlineCallFrame ? inlineCallFrame->stackOffset : 0)) == virtualRegisterForArgument(0)) {
     151                            // |this| can be the TDZ value. The call entrypoint won't have |this| as TDZ,
     152                            // but a catch or a loop OSR entry may have |this| be TDZ.
     153                            checkOp = CheckStructureOrEmpty;
     154                        }
     155
    147156                        insertionSet.insertNode(
    148                             indexInBlock + 1, SpecNone, CheckStructure, origin,
     157                            indexInBlock + 1, SpecNone, checkOp, origin,
    149158                            OpInfo(m_graph.addStructureSet(iter->value.m_structure)),
    150159                            Edge(getLocal, CellUse));
Note: See TracChangeset for help on using the changeset viewer.