Changeset 160821 in webkit


Ignore:
Timestamp:
Dec 18, 2013 7:48:08 PM (10 years ago)
Author:
mark.lam@apple.com
Message:

CStack: Fix baseline to DFG JIT OSR.
https://bugs.webkit.org/show_bug.cgi?id=125969.

Reviewed by Filip Pizlo.

  1. Change operationOptimize() to return a tuple of OSR target address and new topOfFrame value (as opposed to just the OSR target address).
  2. Change emitEnterOptimizationCheck() and emitSlow_op_loop_hint() to emit code to set the stackPointer with the returned topOfFrame value if we take the OSR path.
  • jit/JIT.cpp:

(JSC::JIT::emitEnterOptimizationCheck):

  • jit/JIT.h:
  • jit/JITInlines.h:

(JSC::JIT::callOperation):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emitSlow_op_loop_hint):

  • jit/JITOperations.cpp:
  • jit/JITOperations.h:
  • runtime/Options.h:
Location:
branches/jsCStack/Source/JavaScriptCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/jsCStack/Source/JavaScriptCore/ChangeLog

    r160815 r160821  
     12013-12-18  Mark Lam  <mark.lam@apple.com>
     2
     3        CStack: Fix baseline to DFG JIT OSR.
     4        https://bugs.webkit.org/show_bug.cgi?id=125969.
     5
     6        Reviewed by Filip Pizlo.
     7
     8        1. Change operationOptimize() to return a tuple of OSR target address
     9           and new topOfFrame value (as opposed to just the OSR target address).
     10        2. Change emitEnterOptimizationCheck() and emitSlow_op_loop_hint() to
     11           emit code to set the stackPointer with the returned topOfFrame value
     12           if we take the OSR path.
     13
     14        * jit/JIT.cpp:
     15        (JSC::JIT::emitEnterOptimizationCheck):
     16        * jit/JIT.h:
     17        * jit/JITInlines.h:
     18        (JSC::JIT::callOperation):
     19        * jit/JITOpcodes.cpp:
     20        (JSC::JIT::emitSlow_op_loop_hint):
     21        * jit/JITOperations.cpp:
     22        * jit/JITOperations.h:
     23        * runtime/Options.h:
     24
    1252013-12-18  Michael Saboff  <msaboff@apple.com>
    226
  • branches/jsCStack/Source/JavaScriptCore/jit/JIT.cpp

    r160746 r160821  
    103103    callOperation(operationOptimize, m_bytecodeOffset);
    104104    skipOptimize.append(branchTestPtr(Zero, returnValueGPR));
     105    move(returnValueGPR2, stackPointerRegister);
    105106    jump(returnValueGPR);
    106107    skipOptimize.link(this);
  • branches/jsCStack/Source/JavaScriptCore/jit/JIT.h

    r160745 r160821  
    691691        MacroAssembler::Call callOperation(J_JITOperation_EZ, int, int32_t);
    692692        MacroAssembler::Call callOperation(P_JITOperation_EJS, GPRReg, size_t);
    693         MacroAssembler::Call callOperation(P_JITOperation_EZ, int32_t);
    694693        MacroAssembler::Call callOperation(S_JITOperation_ECC, RegisterID, RegisterID);
    695694        MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID);
    696695        MacroAssembler::Call callOperation(S_JITOperation_EJJ, RegisterID, RegisterID);
    697696        MacroAssembler::Call callOperation(S_JITOperation_EOJss, RegisterID, RegisterID);
     697        MacroAssembler::Call callOperation(Sprt_JITOperation_EZ, int32_t);
    698698        MacroAssembler::Call callOperation(V_JITOperation_E);
    699699        MacroAssembler::Call callOperation(V_JITOperation_EC, RegisterID);
  • branches/jsCStack/Source/JavaScriptCore/jit/JITInlines.h

    r160253 r160821  
    218218}
    219219
    220 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(P_JITOperation_EZ operation, int32_t op)
     220ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(S_JITOperation_ECC operation, RegisterID regOp1, RegisterID regOp2)
     221{
     222    setupArgumentsWithExecState(regOp1, regOp2);
     223    return appendCallWithExceptionCheck(operation);
     224}
     225
     226ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(S_JITOperation_EOJss operation, RegisterID regOp1, RegisterID regOp2)
     227{
     228    setupArgumentsWithExecState(regOp1, regOp2);
     229    return appendCallWithExceptionCheck(operation);
     230}
     231
     232ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(Sprt_JITOperation_EZ operation, int32_t op)
    221233{
    222234    setupArgumentsWithExecState(TrustedImm32(op));
    223     return appendCallWithExceptionCheck(operation);
    224 }
    225 
    226 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(S_JITOperation_ECC operation, RegisterID regOp1, RegisterID regOp2)
    227 {
    228     setupArgumentsWithExecState(regOp1, regOp2);
    229     return appendCallWithExceptionCheck(operation);
    230 }
    231 
    232 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(S_JITOperation_EOJss operation, RegisterID regOp1, RegisterID regOp2)
    233 {
    234     setupArgumentsWithExecState(regOp1, regOp2);
    235235    return appendCallWithExceptionCheck(operation);
    236236}
  • branches/jsCStack/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r160745 r160821  
    11171117        callOperation(operationOptimize, m_bytecodeOffset);
    11181118        Jump noOptimizedEntry = branchTestPtr(Zero, returnValueGPR);
     1119        move(returnValueGPR2, stackPointerRegister);
    11191120        jump(returnValueGPR);
    11201121        noOptimizedEntry.link(this);
  • branches/jsCStack/Source/JavaScriptCore/jit/JITOperations.cpp

    r160784 r160821  
    3131#include "ArrayConstructor.h"
    3232#include "CallFrameInlines.h"
    33 #include "CommonSlowPaths.h"
    3433#include "DFGCompilationMode.h"
    3534#include "DFGDriver.h"
     
    975974
    976975#if ENABLE(DFG_JIT)
    977 char* JIT_OPERATION operationOptimize(ExecState* exec, int32_t bytecodeIndex)
     976SlowPathReturnType JIT_OPERATION operationOptimize(ExecState* exec, int32_t bytecodeIndex)
    978977{
    979978    VM& vm = exec->vm();
     
    10251024        if (Options::verboseOSR())
    10261025            dataLog("Choosing not to optimize ", *codeBlock, " yet, because the threshold hasn't been reached.\n");
    1027         return 0;
     1026        return encodeResult(0, 0);
    10281027    }
    10291028   
     
    10331032        if (Options::verboseOSR())
    10341033            dataLog("Choosing not to optimize ", *codeBlock, " yet, because m_shouldAlwaysBeInlined == true.\n");
    1035         return 0;
     1034        return encodeResult(0, 0);
    10361035    }
    10371036
     
    10731072        RELEASE_ASSERT(!codeBlock->hasOptimizedReplacement());
    10741073        codeBlock->setOptimizationThresholdBasedOnCompilationResult(CompilationDeferred);
    1075         return 0;
     1074        return encodeResult(0, 0);
    10761075    }
    10771076
     
    10861085            if (Options::verboseOSR())
    10871086                dataLog("Code block ", *codeBlock, " was compiled but it doesn't have an optimized replacement.\n");
    1088             return 0;
     1087            return encodeResult(0, 0);
    10891088        }
    10901089    } else if (codeBlock->hasOptimizedReplacement()) {
     
    11111110            }
    11121111            codeBlock->replacement()->jettison(CountReoptimization);
    1113             return 0;
     1112            return encodeResult(0, 0);
    11141113        }
    11151114    } else {
     
    11201119                    " because of insufficient profiling.\n");
    11211120            }
    1122             return 0;
     1121            return encodeResult(0, 0);
    11231122        }
    11241123
     
    11531152       
    11541153        if (result != CompilationSuccessful)
    1155             return 0;
     1154            return encodeResult(0, 0);
    11561155    }
    11571156   
     
    11671166
    11681167        codeBlock->optimizeSoon();
    1169         return static_cast<char*>(address);
     1168        ASSERT(exec->codeBlock() == optimizedCodeBlock);
     1169        return encodeResult(address, exec->topOfFrame());
    11701170    }
    11711171
     
    11961196        }
    11971197        optimizedCodeBlock->jettison(CountReoptimization);
    1198         return 0;
     1198        return encodeResult(0, 0);
    11991199    }
    12001200
     
    12031203    codeBlock->optimizeAfterWarmUp();
    12041204   
    1205     return 0;
     1205    return encodeResult(0, 0);
    12061206}
    12071207#endif
  • branches/jsCStack/Source/JavaScriptCore/jit/JITOperations.h

    r160253 r160821  
    3030
    3131#include "CallFrame.h"
     32#include "CommonSlowPaths.h"
    3233#include "JITExceptions.h"
    3334#include "JSArray.h"
     
    7374    R: Register
    7475    S: size_t
     76    Sprt: SlowPathReturnType
    7577    Ssi: StructureStubInfo*
    7678    St: Structure*
     
    134136typedef size_t JIT_OPERATION (*S_JITOperation_EOJss)(ExecState*, JSObject*, JSString*);
    135137typedef size_t JIT_OPERATION (*S_JITOperation_J)(EncodedJSValue);
     138typedef SlowPathReturnType JIT_OPERATION (*Sprt_JITOperation_EZ)(ExecState*, int32_t);
    136139typedef void JIT_OPERATION (*V_JITOperation_E)(ExecState*);
    137140typedef void JIT_OPERATION (*V_JITOperation_EC)(ExecState*, JSCell*);
     
    174177typedef char* JIT_OPERATION (*P_JITOperation_EStSS)(ExecState*, Structure*, size_t, size_t);
    175178typedef char* JIT_OPERATION (*P_JITOperation_EStZ)(ExecState*, Structure*, int32_t);
    176 typedef char* JIT_OPERATION (*P_JITOperation_EZ)(ExecState*, int32_t);
    177179typedef char* JIT_OPERATION (*P_JITOperation_EZZ)(ExecState*, int32_t, int32_t);
    178180typedef StringImpl* JIT_OPERATION (*I_JITOperation_EJss)(ExecState*, JSString*);
     
    242244void JIT_OPERATION operationDebug(ExecState*, int32_t) WTF_INTERNAL;
    243245#if ENABLE(DFG_JIT)
    244 char* JIT_OPERATION operationOptimize(ExecState*, int32_t) WTF_INTERNAL;
     246SlowPathReturnType JIT_OPERATION operationOptimize(ExecState*, int32_t) WTF_INTERNAL;
    245247#endif
    246248void JIT_OPERATION operationPutByIndex(ExecState*, EncodedJSValue, int32_t, EncodedJSValue);
  • branches/jsCStack/Source/JavaScriptCore/runtime/Options.h

    r160600 r160821  
    121121    v(bool, verboseCFA, false) \
    122122    \
    123     v(bool, enableOSREntryToDFG, false) \
     123    v(bool, enableOSREntryToDFG, true) \
    124124    \
    125125    v(bool, useExperimentalFTL, false) \
Note: See TracChangeset for help on using the changeset viewer.