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

Changeset 205064 in webkit


Ignore:
Timestamp:
Aug 26, 2016, 5:36:15 PM (10 years ago)
Author:
benjamin@webkit.org
Message:

[JSC] Implement CompareStrictEq(String, Untyped) in FTL
https://bugs.webkit.org/show_bug.cgi?id=161229

Reviewed by Geoffrey Garen.

JSTests:

  • stress/compare-strict-eq-on-various-types.js: Added.

Source/JavaScriptCore:

Add (String, Untyped) uses to FTL CompareStrictEq.
This was the last use type not implemented, the node is fully
supported by FTL after this patch.

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
(JSC::FTL::DFG::LowerDFGToB3::compileStringToUntypedStrictEquality):

(JSC::FTL::DFG::LowerDFGToB3::nonSpeculativeCompare):
Remove the type checks when possible.

Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r205027 r205064  
     12016-08-26  Benjamin Poulain  <benjamin@webkit.org>
     2
     3        [JSC] Implement CompareStrictEq(String, Untyped) in FTL
     4        https://bugs.webkit.org/show_bug.cgi?id=161229
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * stress/compare-strict-eq-on-various-types.js: Added.
     9
    1102016-08-26  Yusuke Suzuki  <utatane.tea@gmail.com>
    211
  • trunk/Source/JavaScriptCore/ChangeLog

    r205062 r205064  
     12016-08-26  Benjamin Poulain  <benjamin@webkit.org>
     2
     3        [JSC] Implement CompareStrictEq(String, Untyped) in FTL
     4        https://bugs.webkit.org/show_bug.cgi?id=161229
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Add (String, Untyped) uses to FTL CompareStrictEq.
     9        This was the last use type not implemented, the node is fully
     10        supported by FTL after this patch.
     11
     12        * ftl/FTLCapabilities.cpp:
     13        (JSC::FTL::canCompile):
     14        * ftl/FTLLowerDFGToB3.cpp:
     15        (JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
     16        (JSC::FTL::DFG::LowerDFGToB3::compileStringToUntypedStrictEquality):
     17
     18        (JSC::FTL::DFG::LowerDFGToB3::nonSpeculativeCompare):
     19        Remove the type checks when possible.
     20
    1212016-08-26  Johan K. Jensen  <johan_jensen@apple.com>
    222
  • trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp

    r204439 r205064  
    247247    case PutDynamicVar:
    248248    case CompareEqPtr:
     249    case CompareStrictEq:
    249250        // These are OK.
    250251        break;
     
    387388            break;
    388389        if (node->child1().useKind() == OtherUse || node->child2().useKind() == OtherUse)
    389             break;
    390         return CannotCompile;
    391     case CompareStrictEq:
    392         if (node->isBinaryUseKind(Int32Use))
    393             break;
    394         if (node->isBinaryUseKind(Int52RepUse))
    395             break;
    396         if (node->isBinaryUseKind(DoubleRepUse))
    397             break;
    398         if (node->isBinaryUseKind(StringIdentUse))
    399             break;
    400         if (node->isBinaryUseKind(StringUse))
    401             break;
    402         if (node->isBinaryUseKind(ObjectUse, UntypedUse))
    403             break;
    404         if (node->isBinaryUseKind(UntypedUse, ObjectUse))
    405             break;
    406         if (node->isBinaryUseKind(ObjectUse))
    407             break;
    408         if (node->isBinaryUseKind(BooleanUse))
    409             break;
    410         if (node->isBinaryUseKind(UntypedUse))
    411             break;
    412         if (node->isBinaryUseKind(SymbolUse))
    413             break;
    414         if (node->isBinaryUseKind(SymbolUse, UntypedUse))
    415             break;
    416         if (node->isBinaryUseKind(UntypedUse, SymbolUse))
    417             break;
    418         if (node->isBinaryUseKind(MiscUse, UntypedUse))
    419             break;
    420         if (node->isBinaryUseKind(UntypedUse, MiscUse))
    421             break;
    422         if (node->isBinaryUseKind(StringIdentUse, NotStringVarUse))
    423             break;
    424         if (node->isBinaryUseKind(NotStringVarUse, StringIdentUse))
    425390            break;
    426391        return CannotCompile;
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r204958 r205064  
    51035103        }
    51045104
    5105         if (m_node->isBinaryUseKind(UntypedUse)) {
    5106             nonSpeculativeCompare(
    5107                 [&] (LValue left, LValue right) {
    5108                     return m_out.equal(left, right);
    5109                 },
    5110                 operationCompareStrictEq);
    5111             return;
    5112         }
    5113 
    51145105        if (m_node->isBinaryUseKind(SymbolUse)) {
    51155106            LValue leftSymbol = lowSymbol(m_node->child1());
     
    51765167            return;
    51775168        }
    5178        
    5179         DFG_CRASH(m_graph, m_node, "Bad use kinds");
    5180     }
    5181    
     5169
     5170        if (m_node->isBinaryUseKind(StringUse, UntypedUse)) {
     5171            compileStringToUntypedStrictEquality(m_node->child1(), m_node->child2());
     5172            return;
     5173        }
     5174        if (m_node->isBinaryUseKind(UntypedUse, StringUse)) {
     5175            compileStringToUntypedStrictEquality(m_node->child2(), m_node->child1());
     5176            return;
     5177        }
     5178
     5179        DFG_ASSERT(m_graph, m_node, m_node->isBinaryUseKind(UntypedUse));
     5180        nonSpeculativeCompare(
     5181            [&] (LValue left, LValue right) {
     5182                return m_out.equal(left, right);
     5183            },
     5184            operationCompareStrictEq);
     5185    }
     5186
     5187    void compileStringToUntypedStrictEquality(Edge stringEdge, Edge untypedEdge)
     5188    {
     5189        ASSERT(stringEdge.useKind() == StringUse);
     5190        ASSERT(untypedEdge.useKind() == UntypedUse);
     5191
     5192        LValue leftString = lowCell(stringEdge);
     5193        LValue rightValue = lowJSValue(untypedEdge);
     5194        SpeculatedType rightValueType = provenType(untypedEdge);
     5195
     5196        // Verify left is string.
     5197        speculateString(stringEdge, leftString);
     5198
     5199        LBasicBlock testUntypedEdgeIsCell = m_out.newBlock();
     5200        LBasicBlock testUntypedEdgeIsString = m_out.newBlock();
     5201        LBasicBlock testStringEquality = m_out.newBlock();
     5202        LBasicBlock continuation = m_out.newBlock();
     5203
     5204        // Given left is string. If the value are strictly equal, rightValue has to be the same string.
     5205        ValueFromBlock fastTrue = m_out.anchor(m_out.booleanTrue);
     5206        m_out.branch(m_out.equal(leftString, rightValue), unsure(continuation), unsure(testUntypedEdgeIsCell));
     5207
     5208        LBasicBlock lastNext = m_out.appendTo(testUntypedEdgeIsCell, testUntypedEdgeIsString);
     5209        ValueFromBlock fastFalse = m_out.anchor(m_out.booleanFalse);
     5210        m_out.branch(isNotCell(rightValue, rightValueType), unsure(continuation), unsure(testUntypedEdgeIsString));
     5211
     5212        // Check if the untyped edge is a string.
     5213        m_out.appendTo(testUntypedEdgeIsString, testStringEquality);
     5214        m_out.branch(isNotString(rightValue, rightValueType), unsure(continuation), unsure(testStringEquality));
     5215
     5216        // Full String compare.
     5217        m_out.appendTo(testStringEquality, continuation);
     5218        ValueFromBlock slowResult = m_out.anchor(stringsEqual(leftString, rightValue));
     5219        m_out.jump(continuation);
     5220
     5221        // Continuation.
     5222        m_out.appendTo(continuation, lastNext);
     5223        setBoolean(m_out.phi(Int32, fastTrue, fastFalse, slowResult));
     5224    }
     5225
    51825226    void compileCompareEqPtr()
    51835227    {
     
    81438187        LBasicBlock continuation = m_out.newBlock();
    81448188       
    8145         m_out.branch(isNotInt32(left), rarely(slowPath), usually(leftIsInt));
     8189        m_out.branch(isNotInt32(left, provenType(m_node->child1())), rarely(slowPath), usually(leftIsInt));
    81468190       
    81478191        LBasicBlock lastNext = m_out.appendTo(leftIsInt, fastPath);
    8148         m_out.branch(isNotInt32(right), rarely(slowPath), usually(fastPath));
     8192        m_out.branch(isNotInt32(right, provenType(m_node->child2())), rarely(slowPath), usually(fastPath));
    81498193       
    81508194        m_out.appendTo(fastPath, slowPath);
Note: See TracChangeset for help on using the changeset viewer.