Changeset 194996 in webkit


Ignore:
Timestamp:
Jan 13, 2016, 3:28:38 PM (9 years ago)
Author:
mark.lam@apple.com
Message:

The StringFromCharCode DFG intrinsic should support untyped operands.
https://bugs.webkit.org/show_bug.cgi?id=153046

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

The current StringFromCharCode DFG intrinsic assumes that its operand charCode
must be an Int32. This results in 26000+ BadType OSR exits in the LongSpider
crypto-aes benchmark. With support for Untyped operands, the number of OSR
exits drops to 202.

  • dfg/DFGClobberize.h:

(JSC::DFG::clobberize):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileFromCharCode):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::callOperation):

  • dfg/DFGValidate.cpp:

(JSC::DFG::Validate::validate):

  • runtime/JSCJSValueInlines.h:

(JSC::JSValue::toUInt32):

LayoutTests:

  • js/regress/ftl-polymorphic-StringFromCharCode-expected.txt: Added.
  • js/regress/ftl-polymorphic-StringFromCharCode.html: Added.
  • js/regress/script-tests/ftl-polymorphic-StringFromCharCode.js: Added.

(o1.valueOf):
(foo):

Location:
trunk
Files:
3 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r194981 r194996  
     12016-01-13  Mark Lam  <mark.lam@apple.com>
     2
     3        The StringFromCharCode DFG intrinsic should support untyped operands.
     4        https://bugs.webkit.org/show_bug.cgi?id=153046
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * js/regress/ftl-polymorphic-StringFromCharCode-expected.txt: Added.
     9        * js/regress/ftl-polymorphic-StringFromCharCode.html: Added.
     10        * js/regress/script-tests/ftl-polymorphic-StringFromCharCode.js: Added.
     11        (o1.valueOf):
     12        (foo):
     13
    1142016-01-13  Joseph Pecoraro  <pecoraro@apple.com>
    215
  • trunk/Source/JavaScriptCore/ChangeLog

    r194983 r194996  
     12016-01-13  Mark Lam  <mark.lam@apple.com>
     2
     3        The StringFromCharCode DFG intrinsic should support untyped operands.
     4        https://bugs.webkit.org/show_bug.cgi?id=153046
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        The current StringFromCharCode DFG intrinsic assumes that its operand charCode
     9        must be an Int32.  This results in 26000+ BadType OSR exits in the LongSpider
     10        crypto-aes benchmark.  With support for Untyped operands, the number of OSR
     11        exits drops to 202.
     12
     13        * dfg/DFGClobberize.h:
     14        (JSC::DFG::clobberize):
     15        * dfg/DFGFixupPhase.cpp:
     16        (JSC::DFG::FixupPhase::fixupNode):
     17        * dfg/DFGOperations.cpp:
     18        * dfg/DFGOperations.h:
     19        * dfg/DFGSpeculativeJIT.cpp:
     20        (JSC::DFG::SpeculativeJIT::compileFromCharCode):
     21        * dfg/DFGSpeculativeJIT.h:
     22        (JSC::DFG::SpeculativeJIT::callOperation):
     23        * dfg/DFGValidate.cpp:
     24        (JSC::DFG::Validate::validate):
     25        * runtime/JSCJSValueInlines.h:
     26        (JSC::JSValue::toUInt32):
     27
    1282016-01-13  Mark Lam  <mark.lam@apple.com>
    229
  • trunk/Source/JavaScriptCore/dfg/DFGClobberize.h

    r194770 r194996  
    136136    case SkipScope:
    137137    case StringCharCodeAt:
    138     case StringFromCharCode:
    139138    case CompareStrictEq:
    140139    case IsUndefined:
     
    258257        return;
    259258    }
     259
     260    case StringFromCharCode:
     261        switch (node->child1().useKind()) {
     262        case Int32Use:
     263            def(PureValue(node));
     264            return;
     265        case UntypedUse:
     266            read(World);
     267            write(Heap);
     268            return;
     269        default:
     270            DFG_CRASH(graph, node, "Bad use kind");
     271        }
     272        return;
    260273
    261274    case ArithAdd:
  • trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp

    r194983 r194996  
    603603
    604604        case StringFromCharCode:
     605            if (node->child1()->shouldSpeculateUntypedForArithmetic()) {
     606                fixEdge<UntypedUse>(node->child1());
     607                break;
     608            }
    605609            fixEdge<Int32Use>(node->child1());
    606610            break;
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp

    r194863 r194996  
    13141314}
    13151315
     1316EncodedJSValue JIT_OPERATION operationStringFromCharCodeUntyped(ExecState* exec, EncodedJSValue encodedValue)
     1317{
     1318    VM* vm = &exec->vm();
     1319    NativeCallFrameTracer tracer(vm, exec);
     1320    JSValue charValue = JSValue::decode(encodedValue);
     1321    int32_t chInt = charValue.toUInt32(exec);
     1322    return JSValue::encode(JSC::stringFromCharCode(exec, chInt));
     1323}
     1324
    13161325int64_t JIT_OPERATION operationConvertBoxedDoubleToInt52(EncodedJSValue encodedValue)
    13171326{
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.h

    r194770 r194996  
    3939
    4040JSCell* JIT_OPERATION operationStringFromCharCode(ExecState*, int32_t)  WTF_INTERNAL;
     41EncodedJSValue JIT_OPERATION operationStringFromCharCodeUntyped(ExecState*, EncodedJSValue)  WTF_INTERNAL;
    4142
    4243// These routines are provide callbacks out to C++ implementations of operations too complex to JIT.
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r194835 r194996  
    18721872void SpeculativeJIT::compileFromCharCode(Node* node)
    18731873{
    1874     SpeculateStrictInt32Operand property(this, node->child1());
     1874    Edge& child = node->child1();
     1875    if (child.useKind() == UntypedUse) {
     1876        JSValueOperand opr(this, child);
     1877        JSValueRegs oprRegs = opr.jsValueRegs();
     1878#if USE(JSVALUE64)
     1879        GPRTemporary result(this);
     1880        JSValueRegs resultRegs = JSValueRegs(result.gpr());
     1881#else
     1882        GPRTemporary resultTag(this);
     1883        GPRTemporary resultPayload(this);
     1884        JSValueRegs resultRegs = JSValueRegs(resultPayload.gpr(), resultTag.gpr());
     1885#endif
     1886        flushRegisters();
     1887        callOperation(operationStringFromCharCodeUntyped, resultRegs, oprRegs);
     1888        m_jit.exceptionCheck();
     1889       
     1890        jsValueResult(resultRegs, node);
     1891        return;
     1892    }
     1893
     1894    SpeculateStrictInt32Operand property(this, child);
    18751895    GPRReg propertyReg = property.gpr();
    18761896    GPRTemporary smallStrings(this);
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h

    r194248 r194996  
    14101410        return appendCallSetResult(operation, result);
    14111411    }
     1412    JITCompiler::Call callOperation(J_JITOperation_EJ operation, JSValueRegs result, JSValueRegs arg1)
     1413    {
     1414        return callOperation(operation, result.payloadGPR(), arg1.payloadGPR());
     1415    }
    14121416    JITCompiler::Call callOperation(J_JITOperation_EJ operation, GPRReg result, GPRReg arg1)
    14131417    {
     
    16101614        m_jit.setupArgumentsWithExecState(arg1, arg2);
    16111615        return appendCallSetResult(operation, resultPayload, resultTag);
     1616    }
     1617    JITCompiler::Call callOperation(J_JITOperation_EJ operation, JSValueRegs result, JSValueRegs arg1)
     1618    {
     1619        return callOperation(operation, result.tagGPR(), result.payloadGPR(), arg1.tagGPR(), arg1.payloadGPR());
    16121620    }
    16131621    JITCompiler::Call callOperation(J_JITOperation_EJ operation, GPRReg resultPayload, GPRReg resultTag, GPRReg arg1)
  • trunk/Source/JavaScriptCore/dfg/DFGValidate.cpp

    r194216 r194996  
    265265                    break;
    266266                case CheckStructure:
     267                case StringFromCharCode:
    267268                    VALIDATE((node), !!node->child1());
    268269                    break;
  • trunk/Source/JavaScriptCore/runtime/JSCJSValueInlines.h

    r194175 r194996  
    4747inline uint32_t JSValue::toUInt32(ExecState* exec) const
    4848{
    49     // See comment on JSC::toUInt32, above.
     49    // See comment on JSC::toUInt32, in JSCJSValue.h.
    5050    return toInt32(exec);
    5151}
Note: See TracChangeset for help on using the changeset viewer.