Changeset 95887 in webkit


Ignore:
Timestamp:
Sep 23, 2011 4:28:07 PM (13 years ago)
Author:
fpizlo@apple.com
Message:

Resolve opcodes should have value profiling.
https://bugs.webkit.org/show_bug.cgi?id=68723

Reviewed by Oliver Hunt.

This adds value profiling to all forms of op_resolve in the
old JIT, and patches that information into the DFG along with
performing the appropriate type propagation.

  • dfg/DFGByteCodeParser.cpp:

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

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::predict):

  • dfg/DFGNode.h:

(JSC::DFG::Node::hasIdentifier):
(JSC::DFG::Node::resolveGlobalDataIndex):
(JSC::DFG::Node::hasPrediction):

  • dfg/DFGPropagator.cpp:

(JSC::DFG::Propagator::propagateNodePredictions):

  • dfg/DFGSpeculativeJIT.cpp:

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

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_resolve):
(JSC::JIT::emit_op_resolve_base):
(JSC::JIT::emit_op_resolve_skip):
(JSC::JIT::emit_op_resolve_global):
(JSC::JIT::emitSlow_op_resolve_global):
(JSC::JIT::emit_op_resolve_with_base):
(JSC::JIT::emit_op_resolve_with_this):
(JSC::JIT::emitSlow_op_resolve_global_dynamic):

  • jit/JITStubCall.h:

(JSC::JITStubCall::callWithValueProfiling):

Location:
trunk/Source/JavaScriptCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r95884 r95887  
     12011-09-23  Filip Pizlo  <fpizlo@apple.com>
     2
     3        Resolve opcodes should have value profiling.
     4        https://bugs.webkit.org/show_bug.cgi?id=68723
     5
     6        Reviewed by Oliver Hunt.
     7       
     8        This adds value profiling to all forms of op_resolve in the
     9        old JIT, and patches that information into the DFG along with
     10        performing the appropriate type propagation.
     11
     12        * dfg/DFGByteCodeParser.cpp:
     13        (JSC::DFG::ByteCodeParser::parseBlock):
     14        * dfg/DFGGraph.h:
     15        (JSC::DFG::Graph::predict):
     16        * dfg/DFGNode.h:
     17        (JSC::DFG::Node::hasIdentifier):
     18        (JSC::DFG::Node::resolveGlobalDataIndex):
     19        (JSC::DFG::Node::hasPrediction):
     20        * dfg/DFGPropagator.cpp:
     21        (JSC::DFG::Propagator::propagateNodePredictions):
     22        * dfg/DFGSpeculativeJIT.cpp:
     23        (JSC::DFG::SpeculativeJIT::compile):
     24        * jit/JITOpcodes.cpp:
     25        (JSC::JIT::emit_op_resolve):
     26        (JSC::JIT::emit_op_resolve_base):
     27        (JSC::JIT::emit_op_resolve_skip):
     28        (JSC::JIT::emit_op_resolve_global):
     29        (JSC::JIT::emitSlow_op_resolve_global):
     30        (JSC::JIT::emit_op_resolve_with_base):
     31        (JSC::JIT::emit_op_resolve_with_this):
     32        (JSC::JIT::emitSlow_op_resolve_global_dynamic):
     33        * jit/JITStubCall.h:
     34        (JSC::JITStubCall::callWithValueProfiling):
     35
    1362011-09-23  Oliver Hunt  <oliver@apple.com>
    237
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r95840 r95887  
    14161416            unsigned identifier = currentInstruction[2].u.operand;
    14171417
    1418             NodeIndex resolve = addToGraph(Resolve, OpInfo(identifier));
     1418            NodeIndex resolve = addToGraph(Resolve, OpInfo(identifier), OpInfo(PredictNone));
    14191419            set(currentInstruction[1].u.operand, resolve);
     1420            stronglyPredict(resolve);
    14201421
    14211422            NEXT_OPCODE(op_resolve);
     
    14251426            unsigned identifier = currentInstruction[2].u.operand;
    14261427
    1427             NodeIndex resolve = addToGraph(currentInstruction[3].u.operand ? ResolveBaseStrictPut : ResolveBase, OpInfo(identifier));
     1428            NodeIndex resolve = addToGraph(currentInstruction[3].u.operand ? ResolveBaseStrictPut : ResolveBase, OpInfo(identifier), OpInfo(PredictNone));
    14281429            set(currentInstruction[1].u.operand, resolve);
     1430            stronglyPredict(resolve);
    14291431
    14301432            NEXT_OPCODE(op_resolve_base);
     
    14321434           
    14331435        case op_resolve_global: {
    1434             unsigned identifier = currentInstruction[2].u.operand;
    1435 
    1436             NodeIndex resolve = addToGraph(ResolveGlobal, OpInfo(identifier), OpInfo(m_globalResolveNumber++));
     1436            NodeIndex resolve = addToGraph(ResolveGlobal, OpInfo(m_graph.m_resolveGlobalData.size()), OpInfo(PredictNone));
     1437            m_graph.m_resolveGlobalData.append(ResolveGlobalData());
     1438            ResolveGlobalData& data = m_graph.m_resolveGlobalData.last();
     1439            data.identifierNumber = currentInstruction[2].u.operand;
     1440            data.resolveInfoIndex = m_globalResolveNumber++;
    14371441            set(currentInstruction[1].u.operand, resolve);
     1442            stronglyPredict(resolve);
    14381443
    14391444            NEXT_OPCODE(op_resolve_global);
  • trunk/Source/JavaScriptCore/dfg/DFGGraph.h

    r95786 r95887  
    9898};
    9999
     100struct ResolveGlobalData {
     101    unsigned identifierNumber;
     102    unsigned resolveInfoIndex;
     103};
     104
    100105typedef Vector <BlockIndex, 2> PredecessorList;
    101106
     
    198203        case GetByOffset:
    199204        case GetScopedVar:
     205        case Resolve:
     206        case ResolveBase:
     207        case ResolveBaseStrictPut:
     208        case ResolveGlobal:
    200209            return node.predict(prediction, source);
    201210        default:
     
    317326    Vector<MethodCheckData> m_methodCheckData;
    318327    Vector<StorageAccessData> m_storageAccessData;
     328    Vector<ResolveGlobalData> m_resolveGlobalData;
    319329    unsigned m_preservedVars;
    320330    unsigned m_parameterSlots;
  • trunk/Source/JavaScriptCore/dfg/DFGNode.h

    r95854 r95887  
    468468        case ResolveBase:
    469469        case ResolveBaseStrictPut:
    470         case ResolveGlobal:
    471470            return true;
    472471        default:
     
    482481    }
    483482   
    484     unsigned resolveInfoIndex()
     483    unsigned resolveGlobalDataIndex()
    485484    {
    486485        ASSERT(op == ResolveGlobal);
    487         return m_opInfo2;
     486        return m_opInfo;
    488487    }
    489488
     
    634633        case GetByOffset:
    635634        case GetScopedVar:
     635        case Resolve:
     636        case ResolveBase:
     637        case ResolveBaseStrictPut:
     638        case ResolveGlobal:
    636639            return true;
    637640        default:
  • trunk/Source/JavaScriptCore/dfg/DFGPropagator.cpp

    r95876 r95887  
    535535        }
    536536           
    537         case GetScopedVar: {
     537        case GetScopedVar:
     538        case Resolve:
     539        case ResolveBase:
     540        case ResolveBaseStrictPut:
     541        case ResolveGlobal: {
    538542            changed |= node.predict(m_uses[m_compileIndex] & ~PredictionTagMask, StrongPrediction);
    539543            PredictedType prediction = node.getPrediction();
     
    594598#ifndef NDEBUG
    595599        // These get ignored because they don't return anything.
     600        case PutScopedVar:
    596601        case DFG::Jump:
    597602        case Branch:
     
    604609            break;
    605610           
    606         // These get ignored because we don't have profiling for them, yet.
    607         case Resolve:
    608         case ResolveBase:
    609         case ResolveBaseStrictPut:
    610         case ResolveGlobal:
    611         case PutScopedVar:
    612             break;
    613            
    614611        // This gets ignored because it doesn't do anything.
    615612        case Phantom:
    616613            break;
    617 
    618 
    619614#else
    620615        default:
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r95868 r95887  
    20562056        GPRReg resultGPR = result.gpr();
    20572057
    2058         GlobalResolveInfo* resolveInfoAddress = &(m_jit.codeBlock()->globalResolveInfo(node.resolveInfoIndex()));
     2058        ResolveGlobalData& data = m_jit.graph().m_resolveGlobalData[node.resolveGlobalDataIndex()];
     2059        GlobalResolveInfo* resolveInfoAddress = &(m_jit.codeBlock()->globalResolveInfo(data.resolveInfoIndex));
    20592060
    20602061        // Check Structure of global object
     
    20662067        silentSpillAllRegisters(resultGPR);
    20672068        m_jit.move(resolveInfoGPR, GPRInfo::argumentGPR1);
    2068         m_jit.move(JITCompiler::TrustedImmPtr(&m_jit.codeBlock()->identifier(node.identifierNumber())), GPRInfo::argumentGPR2);
     2069        m_jit.move(JITCompiler::TrustedImmPtr(&m_jit.codeBlock()->identifier(data.identifierNumber)), GPRInfo::argumentGPR2);
    20692070        m_jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
    20702071        JITCompiler::Call functionCall = appendCallWithExceptionCheck(operationResolveGlobal);
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r94920 r95887  
    519519    JITStubCall stubCall(this, cti_op_resolve);
    520520    stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
    521     stubCall.call(currentInstruction[1].u.operand);
     521    stubCall.callWithValueProfiling(currentInstruction[1].u.operand, FirstProfilingSite);
    522522}
    523523
     
    550550    JITStubCall stubCall(this, currentInstruction[3].u.operand ? cti_op_resolve_base_strict_put : cti_op_resolve_base);
    551551    stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
    552     stubCall.call(currentInstruction[1].u.operand);
     552    stubCall.callWithValueProfiling(currentInstruction[1].u.operand, FirstProfilingSite);
    553553}
    554554
     
    566566    stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
    567567    stubCall.addArgument(Imm32(currentInstruction[3].u.operand));
    568     stubCall.call(currentInstruction[1].u.operand);
     568    stubCall.callWithValueProfiling(currentInstruction[1].u.operand, FirstProfilingSite);
    569569}
    570570
     
    587587    load32(Address(regT2, OBJECT_OFFSETOF(GlobalResolveInfo, offset)), regT1);
    588588    loadPtr(BaseIndex(regT0, regT1, ScalePtr), regT0);
     589    emitValueProfilingSite(FirstProfilingSite);
    589590    emitPutVirtualRegister(currentInstruction[1].u.operand);
    590591}
     
    602603    stubCall.addArgument(Imm32(currentIndex));
    603604    stubCall.addArgument(regT0);
    604     stubCall.call(dst);
     605    stubCall.callWithValueProfiling(dst, SubsequentProfilingSite);
    605606}
    606607
     
    723724    stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[3].u.operand)));
    724725    stubCall.addArgument(Imm32(currentInstruction[1].u.operand));
    725     stubCall.call(currentInstruction[2].u.operand);
     726    stubCall.callWithValueProfiling(currentInstruction[2].u.operand, FirstProfilingSite);
    726727}
    727728
     
    731732    stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[3].u.operand)));
    732733    stubCall.addArgument(Imm32(currentInstruction[1].u.operand));
    733     stubCall.call(currentInstruction[2].u.operand);
     734    stubCall.callWithValueProfiling(currentInstruction[2].u.operand, FirstProfilingSite);
    734735}
    735736
     
    15321533    stubCall.addArgument(Imm32(currentIndex));
    15331534    stubCall.addArgument(regT0);
    1534     stubCall.call(dst);
     1535    stubCall.callWithValueProfiling(dst, SubsequentProfilingSite); // The first profiling site is in emit_op_resolve_global
    15351536}
    15361537
  • trunk/Source/JavaScriptCore/jit/JITStubCall.h

    r93755 r95887  
    201201            return call;
    202202        }
     203       
     204        JIT::Call callWithValueProfiling(unsigned dst, JIT::ValueProfilingSiteKind)
     205        {
     206            return call(dst);
     207        }
    203208#else
    204209        JIT::Call call(unsigned dst) // dst is a virtual register.
     
    206211            ASSERT(m_returnType == VoidPtr || m_returnType == Cell);
    207212            JIT::Call call = this->call();
     213            m_jit->emitPutVirtualRegister(dst);
     214            return call;
     215        }
     216       
     217        JIT::Call callWithValueProfiling(unsigned dst, JIT::ValueProfilingSiteKind kind)
     218        {
     219            ASSERT(m_returnType == VoidPtr || m_returnType == Cell);
     220            JIT::Call call = this->call();
     221            ASSERT(JIT::returnValueRegister == JIT::regT0);
     222            m_jit->emitValueProfilingSite(kind);
    208223            m_jit->emitPutVirtualRegister(dst);
    209224            return call;
Note: See TracChangeset for help on using the changeset viewer.