Changeset 96458 in webkit


Ignore:
Timestamp:
Oct 1, 2011 12:21:44 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

JSVALUE32_64 DFG JIT - unboxed integers and cells in register file must be reboxed before exiting from DFG JIT
https://bugs.webkit.org/show_bug.cgi?id=69205

Patch by Yuqiang Xian <yuqiang.xian@intel.com> on 2011-10-01
Reviewed by Gavin Barraclough.

If there are unboxed integers and cells in register file (e.g. by SetLocal),
they must be reboxed before exiting from the speculative DFG JIT execution.
This patch also adds a new ValueSourceKind (CellInRegisterFile) and a new
ValueRecoveryTechnique (AlreadyInRegisterFileAsCell).

  • dfg/DFGJITCompiler32_64.cpp:

(JSC::DFG::JITCompiler::exitSpeculativeWithOSR):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::ValueSource::dump):
(JSC::DFG::ValueRecovery::dump):
(JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::ValueSource::forPrediction):
(JSC::DFG::ValueRecovery::alreadyInRegisterFileAsUnboxedCell):

Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r96455 r96458  
     12011-10-01  Yuqiang Xian  <yuqiang.xian@intel.com>
     2
     3        JSVALUE32_64 DFG JIT - unboxed integers and cells in register file must be reboxed before exiting from DFG JIT
     4        https://bugs.webkit.org/show_bug.cgi?id=69205
     5
     6        Reviewed by Gavin Barraclough.
     7
     8        If there are unboxed integers and cells in register file (e.g. by SetLocal),
     9        they must be reboxed before exiting from the speculative DFG JIT execution.
     10        This patch also adds a new ValueSourceKind (CellInRegisterFile) and a new
     11        ValueRecoveryTechnique (AlreadyInRegisterFileAsCell).
     12
     13        * dfg/DFGJITCompiler32_64.cpp:
     14        (JSC::DFG::JITCompiler::exitSpeculativeWithOSR):
     15        * dfg/DFGSpeculativeJIT.cpp:
     16        (JSC::DFG::ValueSource::dump):
     17        (JSC::DFG::ValueRecovery::dump):
     18        (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
     19        * dfg/DFGSpeculativeJIT.h:
     20        (JSC::DFG::ValueSource::forPrediction):
     21        (JSC::DFG::ValueRecovery::alreadyInRegisterFileAsUnboxedCell):
     22
    1232011-10-01  Sheriff Bot  <webkit.review.bot@gmail.com>
    224
  • trunk/Source/JavaScriptCore/dfg/DFGJITCompiler32_64.cpp

    r96178 r96458  
    147147    // expect most of them to be jsUndefined(); if that's true then we handle that
    148148    // specially to minimize code size and execution time.
    149     bool haveUnboxedInt32s = false;
     149    bool haveUnboxedInt32InRegisterFile = false;
     150    bool haveUnboxedCellInRegisterFile = false;
    150151    bool haveFPRs = false;
    151152    bool haveConstants = false;
     
    183184            break;
    184185           
    185         case UnboxedInt32InGPR:
    186             haveUnboxedInt32s = true;
     186        case AlreadyInRegisterFileAsUnboxedInt32:
     187            haveUnboxedInt32InRegisterFile = true;
     188            break;
     189           
     190        case AlreadyInRegisterFileAsUnboxedCell:
     191            haveUnboxedCellInRegisterFile = true;
    187192            break;
    188193           
     
    207212    // between when something is computed and when it is stored.
    208213   
    209     // 4) Perform all reboxing of integers.
    210     //    Currently we don't rebox for JSValue32_64.
    211    
     214    // 4) Perform all reboxing of integers and cells, except for those in registers.
     215
     216    if (haveUnboxedInt32InRegisterFile || haveUnboxedCellInRegisterFile) {
     217        for (int index = 0; index < exit.numberOfRecoveries(); ++index) {
     218            const ValueRecovery& recovery = exit.valueRecovery(index);
     219            switch (recovery.technique()) {
     220            case AlreadyInRegisterFileAsUnboxedInt32:
     221                store32(TrustedImm32(JSValue::Int32Tag), tagFor(static_cast<VirtualRegister>(exit.operandForIndex(index))));
     222                break;
     223
     224            case AlreadyInRegisterFileAsUnboxedCell:
     225                store32(TrustedImm32(JSValue::CellTag), tagFor(static_cast<VirtualRegister>(exit.operandForIndex(index))));
     226                break;
     227
     228            default:
     229                break;
     230            }
     231        }
     232    }
     233
    212234    // 5) Dump all non-poisoned GPRs. For poisoned GPRs, save them into the scratch storage.
    213235    //    Note that GPRs do not have a fast change (like haveFPRs) because we expect that
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r96415 r96458  
    4545        fprintf(out, "Int32");
    4646        break;
     47    case CellInRegisterFile:
     48        fprintf(out, "Cell");
     49        break;
    4750    case HaveNode:
    4851        fprintf(out, "Node(%d)", m_nodeIndex);
     
    5962    case AlreadyInRegisterFileAsUnboxedInt32:
    6063        fprintf(out, "(int32)");
     64        break;
     65    case AlreadyInRegisterFileAsUnboxedCell:
     66        fprintf(out, "(cell)");
    6167        break;
    6268    case InGPR:
     
    399405    case Int32InRegisterFile:
    400406        return ValueRecovery::alreadyInRegisterFileAsUnboxedInt32();
     407
     408    case CellInRegisterFile:
     409        return ValueRecovery::alreadyInRegisterFileAsUnboxedCell();
    401410
    402411    case HaveNode: {
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h

    r96415 r96458  
    7171    ValueInRegisterFile,
    7272    Int32InRegisterFile,
     73    CellInRegisterFile,
    7374    HaveNode
    7475};
     
    9899        if (isInt32Prediction(prediction))
    99100            return ValueSource(Int32InRegisterFile);
     101        if (isCellPrediction(prediction))
     102            return ValueSource(CellInRegisterFile);
    100103        return ValueSource(ValueInRegisterFile);
    101104    }
     
    146149    // It's already in the register file but unboxed.
    147150    AlreadyInRegisterFileAsUnboxedInt32,
     151    AlreadyInRegisterFileAsUnboxedCell,
    148152    // It's in a register.
    149153    InGPR,
     
    179183        ValueRecovery result;
    180184        result.m_technique = AlreadyInRegisterFileAsUnboxedInt32;
     185        return result;
     186    }
     187   
     188    static ValueRecovery alreadyInRegisterFileAsUnboxedCell()
     189    {
     190        ValueRecovery result;
     191        result.m_technique = AlreadyInRegisterFileAsUnboxedCell;
    181192        return result;
    182193    }
Note: See TracChangeset for help on using the changeset viewer.