Ignore:
Timestamp:
Apr 29, 2015, 8:55:54 AM (10 years ago)
Author:
[email protected]
Message:

TypeOf should return SpecStringIdent and the DFG should know this
https://bugs.webkit.org/show_bug.cgi?id=144376

Reviewed by Andreas Kling.

Make TypeOf return atomic strings. That's a simple change in SmallStrings.

Make the DFG know this and use it for optimization. This makes Switch(TypeOf) a bit less
bad.

  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):

  • dfg/DFGAbstractValue.cpp:

(JSC::DFG::AbstractValue::setType):

  • dfg/DFGAbstractValue.h:

(JSC::DFG::AbstractValue::setType):

  • dfg/DFGInPlaceAbstractState.cpp:

(JSC::DFG::InPlaceAbstractState::initialize):

  • dfg/DFGPredictionPropagationPhase.cpp:

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

  • runtime/SmallStrings.cpp:

(JSC::SmallStrings::initialize):

  • tests/stress/switch-typeof-indirect.js: Added.

(bar):
(foo):
(test):

  • tests/stress/switch-typeof-slightly-indirect.js: Added.

(foo):
(test):

  • tests/stress/switch-typeof.js: Added.

(foo):
(test):

File:
1 edited

Legend:

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

    r172737 r183548  
    119119}
    120120
     121void AbstractValue::setType(Graph& graph, SpeculatedType type)
     122{
     123    SpeculatedType cellType = type & SpecCell;
     124    if (cellType) {
     125        if (!(cellType & ~SpecString))
     126            m_structure = graph.m_vm.stringStructure.get();
     127        else
     128            m_structure.makeTop();
     129        m_arrayModes = ALL_ARRAY_MODES;
     130    } else {
     131        m_structure.clear();
     132        m_arrayModes = 0;
     133    }
     134    m_type = type;
     135    m_value = JSValue();
     136    checkConsistency();
     137}
     138
    121139void AbstractValue::fixTypeForRepresentation(NodeFlags representation)
    122140{
Note: See TracChangeset for help on using the changeset viewer.