Changeset 184340 in webkit


Ignore:
Timestamp:
May 14, 2015 10:36:12 AM (9 years ago)
Author:
Yusuke Suzuki
Message:

Introduce SymbolType into SpeculativeTypes
https://bugs.webkit.org/show_bug.cgi?id=142651

Reviewed by Filip Pizlo.

Introduce SpecSymbol type into speculative types.
Previously symbol type is categorized into SpecCellOther.
But SpecCellOther is not intended to be used for such cells.

This patch just introduces SpecSymbol.
It represents the type of target value is definitely the symbol type.
It is the part of SpecCell.

In this patch, we do not introduce SymbolUse tracking.
It will be added in the separate patch.

  • bytecode/SpeculatedType.cpp:

(JSC::dumpSpeculation):
(JSC::speculationFromStructure):

  • bytecode/SpeculatedType.h:

(JSC::isSymbolSpeculation):

  • dfg/DFGAbstractInterpreterInlines.h:

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

  • dfg/DFGAbstractValue.cpp:

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

  • dfg/DFGConstantFoldingPhase.cpp:

(JSC::DFG::ConstantFoldingPhase::foldConstants):

  • tests/stress/typeof-symbol.js: Added.
Location:
trunk/Source/JavaScriptCore
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r184337 r184340  
     12015-05-14  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        Introduce SymbolType into SpeculativeTypes
     4        https://bugs.webkit.org/show_bug.cgi?id=142651
     5
     6        Reviewed by Filip Pizlo.
     7
     8        Introduce SpecSymbol type into speculative types.
     9        Previously symbol type is categorized into SpecCellOther.
     10        But SpecCellOther is not intended to be used for such cells.
     11
     12        This patch just introduces SpecSymbol.
     13        It represents the type of target value is definitely the symbol type.
     14        It is the part of SpecCell.
     15
     16        In this patch, we do not introduce SymbolUse tracking.
     17        It will be added in the separate patch.
     18
     19        * bytecode/SpeculatedType.cpp:
     20        (JSC::dumpSpeculation):
     21        (JSC::speculationFromStructure):
     22        * bytecode/SpeculatedType.h:
     23        (JSC::isSymbolSpeculation):
     24        * dfg/DFGAbstractInterpreterInlines.h:
     25        (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
     26        * dfg/DFGAbstractValue.cpp:
     27        (JSC::DFG::AbstractValue::setType):
     28        * dfg/DFGConstantFoldingPhase.cpp:
     29        (JSC::DFG::ConstantFoldingPhase::foldConstants):
     30        * tests/stress/typeof-symbol.js: Added.
     31
    1322015-05-14  Yusuke Suzuki  <utatane.tea@gmail.com>
    233
  • trunk/Source/JavaScriptCore/bytecode/SpeculatedType.cpp

    r183963 r184340  
    157157                isTop = false;
    158158        }
     159
     160        if (value & SpecSymbol)
     161            myOut.print("Symbol");
     162        else
     163            isTop = false;
    159164    }
    160165   
     
    338343    if (structure->typeInfo().type() == StringType)
    339344        return SpecString;
     345    if (structure->typeInfo().type() == SymbolType)
     346        return SpecSymbol;
    340347    return speculationFromClassInfo(structure->classInfo());
    341348}
  • trunk/Source/JavaScriptCore/bytecode/SpeculatedType.h

    r183963 r184340  
    6161static const SpeculatedType SpecStringVar          = 0x00020000; // It's definitely a JSString, and it's not an identifier.
    6262static const SpeculatedType SpecString             = 0x00030000; // It's definitely a JSString.
    63 static const SpeculatedType SpecCellOther          = 0x00040000; // It's definitely a JSCell but not a subclass of JSObject and definitely not a JSString. FIXME: This shouldn't be part of heap-top or bytecode-top. https://bugs.webkit.org/show_bug.cgi?id=133078
    64 static const SpeculatedType SpecCell               = 0x0007ffff; // It's definitely a JSCell.
     63static const SpeculatedType SpecSymbol             = 0x00040000; // It's definitely a Symbol.
     64static const SpeculatedType SpecCellOther          = 0x00080000; // It's definitely a JSCell but not a subclass of JSObject and definitely not a JSString or a Symbol. FIXME: This shouldn't be part of heap-top or bytecode-top. https://bugs.webkit.org/show_bug.cgi?id=133078
     65static const SpeculatedType SpecCell               = 0x000fffff; // It's definitely a JSCell.
    6566static const SpeculatedType SpecInt32              = 0x00200000; // It's definitely an Int32.
    6667static const SpeculatedType SpecInt52              = 0x00400000; // It's definitely an Int52 and we intend it to unbox it.
     
    140141}
    141142
     143inline bool isSymbolSpeculation(SpeculatedType value)
     144{
     145    return value == SpecSymbol;
     146}
     147
    142148inline bool isArraySpeculation(SpeculatedType value)
    143149{
  • trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h

    r184318 r184340  
    10711071        }
    10721072
     1073        if (isSymbolSpeculation(abstractChild.m_type)) {
     1074            setConstant(node, *m_graph.freeze(vm->smallStrings.symbolString()));
     1075            break;
     1076        }
     1077
    10731078        forNode(node).setType(m_graph, SpecStringIdent);
    10741079        break;
     
    14211426        }
    14221427       
    1423         if (!(forNode(node->child1()).m_type & ~(SpecFullNumber | SpecBoolean | SpecString | SpecCellOther))) {
     1428        if (!(forNode(node->child1()).m_type & ~(SpecFullNumber | SpecBoolean | SpecString | SpecSymbol))) {
    14241429            m_state.setFoundConstants(true);
    14251430            forNode(node) = forNode(node->child1());
     
    14291434        clobberWorld(node->origin.semantic, clobberLimit);
    14301435       
    1431         forNode(node).setType(m_graph, (SpecHeapTop & ~SpecCell) | SpecString | SpecCellOther);
     1436        forNode(node).setType(m_graph, (SpecHeapTop & ~SpecCell) | SpecString | SpecSymbol);
    14321437        break;
    14331438    }
  • trunk/Source/JavaScriptCore/dfg/DFGAbstractValue.cpp

    r184318 r184340  
    125125        if (!(cellType & ~SpecString))
    126126            m_structure = graph.m_vm.stringStructure.get();
     127        else if (isSymbolSpeculation(cellType))
     128            m_structure = graph.m_vm.symbolStructure.get();
    127129        else
    128130            m_structure.makeTop();
  • trunk/Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp

    r183497 r184340  
    452452
    453453            case ToPrimitive: {
    454                 if (m_state.forNode(node->child1()).m_type & ~(SpecFullNumber | SpecBoolean | SpecString | SpecCellOther))
     454                if (m_state.forNode(node->child1()).m_type & ~(SpecFullNumber | SpecBoolean | SpecString | SpecSymbol))
    455455                    break;
    456456               
Note: See TracChangeset for help on using the changeset viewer.