Ignore:
Timestamp:
May 21, 2015, 7:39:25 PM (10 years ago)
Author:
[email protected]
Message:

Object allocation sinking phase should explicitly create bottom values for CreateActivation sink candidates and CreateActivation should have SymbolTable as a child node
https://bugs.webkit.org/show_bug.cgi?id=145192

Reviewed by Filip Pizlo.

When we sink CreateActivation and generate MaterializeCreateActivation
in the object allocation sinking phase, we now explictly add PutHints for
all variables on the activation setting those variables to their default value
(undefined for Function activations and soon to be JS Empty Value for block scope activations).
This allows us to remove code that fills FTL fast activation allocations with Undefined.

This patch also adds the constant SymbolTable as an OpInfo of CreateActivation and MaterializeCreateActivation
nodes. This is in preparation for ES6 block scoping which will introduce a new
op code that gets lowered to CreateActivation.

  • dfg/DFGByteCodeParser.cpp:

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

  • dfg/DFGClobberize.h:

(JSC::DFG::clobberize):

  • dfg/DFGNode.h:

(JSC::DFG::Node::hasCellOperand):
(JSC::DFG::Node::cellOperand):

  • dfg/DFGObjectAllocationSinkingPhase.cpp:

(JSC::DFG::ObjectAllocationSinkingPhase::lowerNonReadingOperationsOnPhantomAllocations):
(JSC::DFG::ObjectAllocationSinkingPhase::handleNode):
(JSC::DFG::ObjectAllocationSinkingPhase::createMaterialize):
(JSC::DFG::ObjectAllocationSinkingPhase::populateMaterialize):

  • dfg/DFGPromotedHeapLocation.cpp:

(WTF::printInternal):

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

(JSC::DFG::SpeculativeJIT::compileCreateActivation):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::LowerDFGToLLVM::compileCreateActivation):
(JSC::FTL::LowerDFGToLLVM::compileMaterializeCreateActivation):

  • ftl/FTLOperations.cpp:

(JSC::FTL::operationMaterializeObjectInOSR):

  • tests/stress/activation-sink-default-value.js: Added.

(bar):

  • tests/stress/activation-sink-osrexit-default-value.js: Added.

(foo.set result):

File:
1 edited

Legend:

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

    r184445 r184747  
    587587                            PromotedHeapLocation(ActivationScopePLoc, node).createHint(
    588588                                m_graph, node->origin, node->child1().node()));
     589                        Node* symbolTableNode = m_insertionSet.insertConstant(
     590                            nodeIndex + 1, node->origin, node->cellOperand());
     591                        m_insertionSet.insert(
     592                            nodeIndex + 1,
     593                            PromotedHeapLocation(ActivationSymbolTablePLoc, node).createHint(
     594                                m_graph, node->origin, symbolTableNode));
     595
     596                        {
     597                            SymbolTable* symbolTable = node->castOperand<SymbolTable*>();
     598                            Node* undefined = m_insertionSet.insertConstant(
     599                                nodeIndex + 1, node->origin, jsUndefined());
     600                            ConcurrentJITLocker locker(symbolTable->m_lock);
     601                            for (auto iter = symbolTable->begin(locker), end = symbolTable->end(locker); iter != end; ++iter) {
     602                                m_insertionSet.insert(
     603                                    nodeIndex + 1,
     604                                    PromotedHeapLocation(
     605                                        ClosureVarPLoc, node, iter->value.scopeOffset().offset()).createHint(
     606                                        m_graph, node->origin, undefined));
     607                            }
     608                        }
     609
    589610                        node->convertToPhantomCreateActivation();
    590611                    }
     
    598619                            PromotedHeapLocation(ActivationScopePLoc, node).createHint(
    599620                                m_graph, node->origin, m_graph.varArgChild(node, 0).node()));
     621                        Node* symbolTableNode = m_insertionSet.insertConstant(
     622                            nodeIndex + 1, node->origin, node->cellOperand());
     623                        m_insertionSet.insert(
     624                            nodeIndex + 1,
     625                            PromotedHeapLocation(ActivationSymbolTablePLoc, node).createHint(
     626                                m_graph, node->origin, symbolTableNode));
    600627                        ObjectMaterializationData& data = node->objectMaterializationData();
    601628                        for (unsigned i = 0; i < data.m_properties.size(); ++i) {
     
    830857
    831858        case CreateActivation:
    832             if (!m_graph.symbolTableFor(node->origin.semantic)->singletonScope()->isStillValid())
     859            if (!node->castOperand<SymbolTable*>()->singletonScope()->isStillValid())
    833860                sinkCandidate();
    834861            escape(node->child1().node());
     
    933960        case MaterializeCreateActivation: {
    934961            ObjectMaterializationData* data = m_graph.m_objectMaterializationData.add();
    935 
     962            FrozenValue* symbolTable = escapee->cellOperand();
    936963            result = m_graph.addNode(
    937964                escapee->prediction(), Node::VarArg, MaterializeCreateActivation,
     
    939966                    escapee->origin.semantic,
    940967                    where->origin.forExit),
    941                 OpInfo(data), OpInfo(), 0, 0);
     968                OpInfo(data), OpInfo(symbolTable), 0, 0);
    942969            break;
    943970        }
     
    10101037
    10111038            PromotedHeapLocation scope(ActivationScopePLoc, escapee);
     1039            PromotedHeapLocation symbolTable(ActivationSymbolTablePLoc, escapee);
    10121040            ASSERT(locations.contains(scope));
    10131041
     
    10181046                case ActivationScopePLoc: {
    10191047                    ASSERT(locations[i] == scope);
     1048                    break;
     1049                }
     1050
     1051                case ActivationSymbolTablePLoc: {
     1052                    ASSERT(locations[i] == symbolTable);
    10201053                    break;
    10211054                }
Note: See TracChangeset for help on using the changeset viewer.