Ignore:
Timestamp:
Jun 27, 2012, 5:49:55 PM (13 years ago)
Author:
[email protected]
Message:

Javascript SHA-512 gives wrong hash on second and subsequent runs unless Web Inspector Javascript Debugging is on
https://bugs.webkit.org/show_bug.cgi?id=90053
<rdar://problem/11764613>

Source/JavaScriptCore:

Reviewed by Mark Hahnenberg.

The problem is that the code was assuming that the recovery should be Undefined if the source of
the SetLocal was !shouldGenerate(). But that's wrong, since the DFG optimizer may skip around a
UInt32ToNumber node (hence making it !shouldGenerate()) and keep the source of that node alive.
In that case we should base the recovery on the source of the UInt32ToNumber. The logic for this
was already in place but the fast check for !shouldGenerate() broke it.

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):

LayoutTests:

Reviewed by Mark Hahnenberg.

  • fast/js/dfg-uint32-to-number-skip-then-exit-expected.txt: Added.
  • fast/js/dfg-uint32-to-number-skip-then-exit.html: Added.
  • fast/js/script-tests/dfg-uint32-to-number-skip-then-exit.js: Added.

(foo):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r121307 r121391  
    13981398            return ValueRecovery::constant(valueOfJSConstant(valueSource.nodeIndex()));
    13991399       
    1400         if (!nodePtr->shouldGenerate()) {
    1401             // It's legitimately dead. As in, nobody will ever use this node, or operand,
    1402             // ever. Set it to Undefined to make the GC happy after the OSR.
    1403             return ValueRecovery::constant(jsUndefined());
    1404         }
    1405    
    1406         GenerationInfo* infoPtr = &m_generationInfo[nodePtr->virtualRegister()];
    1407         if (!infoPtr->alive() || infoPtr->nodeIndex() != valueSource.nodeIndex()) {
     1400        GenerationInfo* infoPtr;
     1401        if (nodePtr->shouldGenerate())
     1402            infoPtr = &m_generationInfo[nodePtr->virtualRegister()];
     1403        else
     1404            infoPtr = 0;
     1405        if (!infoPtr || !infoPtr->alive() || infoPtr->nodeIndex() != valueSource.nodeIndex()) {
    14081406            // Try to see if there is an alternate node that would contain the value we want.
    14091407            // There are four possibilities:
     
    14321430                NodeIndex nodeIndex = nodePtr->child1().index();
    14331431                nodePtr = &at(nodeIndex);
    1434                 infoPtr = &m_generationInfo[nodePtr->virtualRegister()];
    1435                 if (infoPtr->alive() && infoPtr->nodeIndex() == nodeIndex)
    1436                     found = true;
     1432                if (nodePtr->shouldGenerate()) {
     1433                    infoPtr = &m_generationInfo[nodePtr->virtualRegister()];
     1434                    if (infoPtr->alive() && infoPtr->nodeIndex() == nodeIndex)
     1435                        found = true;
     1436                }
    14371437            }
    14381438       
     
    14831483                if (nodeIndexToUse != NoNode) {
    14841484                    nodePtr = &at(nodeIndexToUse);
    1485                     infoPtr = &m_generationInfo[nodePtr->virtualRegister()];
    1486                     ASSERT(infoPtr->alive() && infoPtr->nodeIndex() == nodeIndexToUse);
    1487                     found = true;
     1485                    if (nodePtr->shouldGenerate()) {
     1486                        infoPtr = &m_generationInfo[nodePtr->virtualRegister()];
     1487                        ASSERT(infoPtr->alive() && infoPtr->nodeIndex() == nodeIndexToUse);
     1488                        found = true;
     1489                    }
    14881490                }
    14891491            }
Note: See TracChangeset for help on using the changeset viewer.