Ignore:
Timestamp:
Jan 8, 2013, 6:37:29 PM (13 years ago)
Author:
[email protected]
Message:

Support op_typeof in the DFG
https://bugs.webkit.org/show_bug.cgi?id=98898

Reviewed by Filip Pizlo.

Adds a TypeOf node to the DFG to support op_typeof.

To avoid adding too much GC horror, this also makes the
common strings portion of the SmallString cache strongly
referenced.

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::execute):

We try to determine the result early here, and substitute in a constant.
Otherwise we leave the node intact, and set the result type to SpecString.

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::parseBlock):

Parse op_typeof

  • dfg/DFGCSEPhase.cpp:

(JSC::DFG::CSEPhase::performNodeCSE):

TypeOf nodes can be subjected to pure CSE

  • dfg/DFGCapabilities.h:

(JSC::DFG::canCompileOpcode):

We can handle typeof.

  • dfg/DFGNodeType.h:

(DFG):

Define the node.

  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h: Add operationTypeOf to support the non-trivial cases.
  • dfg/DFGPredictionPropagationPhase.cpp:

(JSC::DFG::PredictionPropagationPhase::propagate):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

Actual codegen

  • runtime/Operations.cpp:

(JSC::jsTypeStringForValue):
(JSC):

  • runtime/Operations.h:

(JSC):

Some refactoring to allow us to get the type string for an
object without needing a callframe.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSString.h

    r130303 r139145  
    334334    inline JSString* jsEmptyString(JSGlobalData* globalData)
    335335    {
    336         return globalData->smallStrings.emptyString(globalData);
     336        return globalData->smallStrings.emptyString();
    337337    }
    338338
     
    387387        int size = s.length();
    388388        if (!size)
    389             return globalData->smallStrings.emptyString(globalData);
     389            return globalData->smallStrings.emptyString();
    390390        if (size == 1) {
    391391            UChar c = s.characterAt(0);
     
    403403        JSGlobalData* globalData = &exec->globalData();
    404404        if (!length)
    405             return globalData->smallStrings.emptyString(globalData);
     405            return globalData->smallStrings.emptyString();
    406406        return jsSubstring(globalData, s->value(exec), offset, length);
    407407    }
     
    413413        ASSERT(offset + length <= static_cast<unsigned>(s.length()));
    414414        if (!length)
    415             return globalData->smallStrings.emptyString(globalData);
     415            return globalData->smallStrings.emptyString();
    416416        if (length == 1) {
    417417            UChar c = s.characterAt(offset);
     
    428428        ASSERT(offset + length <= static_cast<unsigned>(s.length()));
    429429        if (!length)
    430             return globalData->smallStrings.emptyString(globalData);
     430            return globalData->smallStrings.emptyString();
    431431        if (length == 1) {
    432432            UChar c = s.characterAt(offset);
     
    441441        int size = s.length();
    442442        if (!size)
    443             return globalData->smallStrings.emptyString(globalData);
     443            return globalData->smallStrings.emptyString();
    444444        if (size == 1) {
    445445            UChar c = s.characterAt(0);
Note: See TracChangeset for help on using the changeset viewer.