Changeset 62612 in webkit


Ignore:
Timestamp:
Jul 6, 2010 6:35:56 PM (14 years ago)
Author:
oliver@apple.com
Message:

2010-07-06 Oliver Hunt <oliver@apple.com>

Reviewed by Maciej Stachowiak.

Make it possible to have both the JIT and Interpreter available in a single build
https://bugs.webkit.org/show_bug.cgi?id=41722

Separate the concept of !ENABLE(JIT) and ENABLE(INTERPRETER) and make it possible
to have both JIT and INTERPRETER enabled at the same time. This doesn't add
support for mix mode execution, but it does allow a single build to contain all
the code needed to use either the interpreter or the jit.

If both ENABLE(INTERPRETER) and ENABLE(JIT) are true then setting the environment
variable JSC_FORCE_INTERPRETER will force JSC to use the interpreter.

This patch basically consists of replacing !ENABLE(JIT) with ENABLE(INTERPRETER),
or converting #if ENABLE(JIT) ... #else ... into #if ENABLE(JIT) ... #endif
#if ENABLE(INTERPRETER), etc. There are also a few functions that need to be
renamed to resolve return type ambiguity.

  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::~CodeBlock): (JSC::CodeBlock::shrinkToFit):
  • bytecode/CodeBlock.h:
  • interpreter/CallFrame.h: (JSC::ExecState::returnVPC):
  • interpreter/Interpreter.cpp: (JSC::Interpreter::unwindCallFrame): (JSC::Interpreter::throwException): (JSC::Interpreter::execute): (JSC::Interpreter::executeCall): (JSC::Interpreter::executeConstruct): (JSC::Interpreter::prepareForRepeatCall): (JSC::Interpreter::privateExecute): (JSC::Interpreter::retrieveLastCaller):
  • interpreter/Interpreter.h:
  • runtime/ArrayPrototype.cpp: (JSC::isNumericCompareFunction):
  • runtime/Executable.cpp: (JSC::EvalExecutable::generateJITCode): (JSC::ProgramExecutable::generateJITCode): (JSC::FunctionExecutable::generateJITCodeForCall): (JSC::FunctionExecutable::generateJITCodeForConstruct): (JSC::FunctionExecutable::reparseExceptionInfo): (JSC::EvalExecutable::reparseExceptionInfo):
  • runtime/JSFunction.cpp:
  • runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData):
  • runtime/JSGlobalData.h: (JSC::JSGlobalData::canUseJIT):
  • wtf/Platform.h:
Location:
trunk/JavaScriptCore
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r62551 r62612  
     12010-07-06  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        Make it possible to have both the JIT and Interpreter available in a single build
     6        https://bugs.webkit.org/show_bug.cgi?id=41722
     7
     8        Separate the concept of !ENABLE(JIT) and ENABLE(INTERPRETER) and make it possible
     9        to have both JIT and INTERPRETER enabled at the same time.  This doesn't add
     10        support for mix mode execution, but it does allow a single build to contain all
     11        the code needed to use either the interpreter or the jit.
     12
     13        If both ENABLE(INTERPRETER) and ENABLE(JIT) are true then setting the environment
     14        variable JSC_FORCE_INTERPRETER will force JSC to use the interpreter.
     15
     16        This patch basically consists of replacing !ENABLE(JIT) with ENABLE(INTERPRETER),
     17        or converting #if ENABLE(JIT) ... #else ... into #if ENABLE(JIT) ... #endif
     18        #if ENABLE(INTERPRETER), etc.  There are also a few functions that need to be
     19        renamed to resolve return type ambiguity.
     20
     21        * bytecode/CodeBlock.cpp:
     22        (JSC::CodeBlock::~CodeBlock):
     23        (JSC::CodeBlock::shrinkToFit):
     24        * bytecode/CodeBlock.h:
     25        * interpreter/CallFrame.h:
     26        (JSC::ExecState::returnVPC):
     27        * interpreter/Interpreter.cpp:
     28        (JSC::Interpreter::unwindCallFrame):
     29        (JSC::Interpreter::throwException):
     30        (JSC::Interpreter::execute):
     31        (JSC::Interpreter::executeCall):
     32        (JSC::Interpreter::executeConstruct):
     33        (JSC::Interpreter::prepareForRepeatCall):
     34        (JSC::Interpreter::privateExecute):
     35        (JSC::Interpreter::retrieveLastCaller):
     36        * interpreter/Interpreter.h:
     37        * runtime/ArrayPrototype.cpp:
     38        (JSC::isNumericCompareFunction):
     39        * runtime/Executable.cpp:
     40        (JSC::EvalExecutable::generateJITCode):
     41        (JSC::ProgramExecutable::generateJITCode):
     42        (JSC::FunctionExecutable::generateJITCodeForCall):
     43        (JSC::FunctionExecutable::generateJITCodeForConstruct):
     44        (JSC::FunctionExecutable::reparseExceptionInfo):
     45        (JSC::EvalExecutable::reparseExceptionInfo):
     46        * runtime/JSFunction.cpp:
     47        * runtime/JSGlobalData.cpp:
     48        (JSC::JSGlobalData::JSGlobalData):
     49        * runtime/JSGlobalData.h:
     50        (JSC::JSGlobalData::canUseJIT):
     51        * wtf/Platform.h:
     52
    1532010-07-06  Darin Adler  <darin@apple.com>
    254
  • trunk/JavaScriptCore/bytecode/CodeBlock.cpp

    r62551 r62612  
    13741374CodeBlock::~CodeBlock()
    13751375{
    1376 #if !ENABLE(JIT)
     1376#if ENABLE(INTERPRETER)
    13771377    for (size_t size = m_globalResolveInstructions.size(), i = 0; i < size; ++i)
    13781378        derefStructures(&m_instructions[m_globalResolveInstructions[i]]);
     
    13801380    for (size_t size = m_propertyAccessInstructions.size(), i = 0; i < size; ++i)
    13811381        derefStructures(&m_instructions[m_propertyAccessInstructions[i]]);
    1382 #else
     1382#endif
     1383#if ENABLE(JIT)
    13831384    for (size_t size = m_globalResolveInfos.size(), i = 0; i < size; ++i) {
    13841385        if (m_globalResolveInfos[i].structure)
     
    14081409#endif
    14091410
    1410 #endif // !ENABLE(JIT)
     1411#endif // ENABLE(JIT)
    14111412
    14121413#if DUMP_CODE_BLOCK_STATISTICS
     
    16701671#endif
    16711672
    1672 #if !ENABLE(JIT)
     1673#if ENABLE(INTERPRETER)
    16731674bool CodeBlock::hasGlobalResolveInstructionAtBytecodeOffset(unsigned bytecodeOffset)
    16741675{
     
    16901691    return true;
    16911692}
    1692 #else
     1693#endif
     1694#if ENABLE(JIT)
    16931695bool CodeBlock::hasGlobalResolveInfoAtBytecodeOffset(unsigned bytecodeOffset)
    16941696{
     
    17161718    m_instructions.shrinkToFit();
    17171719
    1718 #if !ENABLE(JIT)
     1720#if ENABLE(INTERPRETER)
    17191721    m_propertyAccessInstructions.shrinkToFit();
    17201722    m_globalResolveInstructions.shrinkToFit();
    1721 #else
     1723#endif
     1724#if ENABLE(JIT)
    17221725    m_structureStubInfos.shrinkToFit();
    17231726    m_globalResolveInfos.shrinkToFit();
  • trunk/JavaScriptCore/bytecode/CodeBlock.h

    r62551 r62612  
    359359       
    360360        bool functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int& functionRegisterIndex);
    361 #else
     361#endif
     362#if ENABLE(INTERPRETER)
    362363        unsigned bytecodeOffset(CallFrame*, Instruction* returnAddress)
    363364        {
     
    417418        unsigned lastJumpTarget() const { return m_jumpTargets.last(); }
    418419
    419 #if !ENABLE(JIT)
     420#if ENABLE(INTERPRETER)
    420421        void addPropertyAccessInstruction(unsigned propertyAccessInstruction) { m_propertyAccessInstructions.append(propertyAccessInstruction); }
    421422        void addGlobalResolveInstruction(unsigned globalResolveInstruction) { m_globalResolveInstructions.append(globalResolveInstruction); }
    422423        bool hasGlobalResolveInstructionAtBytecodeOffset(unsigned bytecodeOffset);
    423 #else
     424#endif
     425#if ENABLE(JIT)
    424426        size_t numberOfStructureStubInfos() const { return m_structureStubInfos.size(); }
    425427        void addStructureStubInfo(const StructureStubInfo& stubInfo) { m_structureStubInfos.append(stubInfo); }
     
    552554        unsigned m_sourceOffset;
    553555
    554 #if !ENABLE(JIT)
     556#if ENABLE(INTERPRETER)
    555557        Vector<unsigned> m_propertyAccessInstructions;
    556558        Vector<unsigned> m_globalResolveInstructions;
    557 #else
     559#endif
     560#if ENABLE(JIT)
    558561        Vector<StructureStubInfo> m_structureStubInfos;
    559562        Vector<GlobalResolveInfo> m_globalResolveInfos;
  • trunk/JavaScriptCore/interpreter/CallFrame.h

    r61553 r62612  
    107107#if ENABLE(JIT)
    108108        ReturnAddressPtr returnPC() const { return ReturnAddressPtr(this[RegisterFile::ReturnPC].vPC()); }
    109 #else
    110         Instruction* returnPC() const { return this[RegisterFile::ReturnPC].vPC(); }
     109#endif
     110#if ENABLE(INTERPRETER)
     111        Instruction* returnVPC() const { return this[RegisterFile::ReturnPC].vPC(); }
    111112#endif
    112113
  • trunk/JavaScriptCore/interpreter/Interpreter.cpp

    r62464 r62612  
    8080}
    8181
    82 #if !ENABLE(JIT)
     82#if ENABLE(INTERPRETER)
    8383NEVER_INLINE bool Interpreter::resolve(CallFrame* callFrame, Instruction* vPC, JSValue& exceptionValue)
    8484{
     
    295295}
    296296
    297 #endif // !ENABLE(JIT)
     297#endif // ENABLE(INTERPRETER)
    298298
    299299ALWAYS_INLINE CallFrame* Interpreter::slideRegisterWindowForCall(CodeBlock* newCodeBlock, RegisterFile* registerFile, CallFrame* callFrame, size_t registerOffset, int argc)
     
    334334}
    335335
    336 #if !ENABLE(JIT)
     336#if ENABLE(INTERPRETER)
    337337static NEVER_INLINE bool isInvalidParamForIn(CallFrame* callFrame, CodeBlock* codeBlock, const Instruction* vPC, JSValue value, JSValue& exceptionData)
    338338{
     
    548548
    549549    codeBlock = callerFrame->codeBlock();
    550     bytecodeOffset = codeBlock->bytecodeOffset(callerFrame, callFrame->returnPC());
     550#if ENABLE(JIT)
     551#if ENABLE(INTERPRETER)
     552    if (callerFrame->globalData().canUseJIT())
     553#endif
     554        bytecodeOffset = codeBlock->bytecodeOffset(callerFrame, callFrame->returnPC());
     555#if ENABLE(INTERPRETER)
     556    else
     557        bytecodeOffset = codeBlock->bytecodeOffset(callerFrame, callFrame->returnVPC());
     558#endif
     559#else
     560    bytecodeOffset = codeBlock->bytecodeOffset(callerFrame, callFrame->returnVPC());
     561#endif
    551562    callFrame = callerFrame;
    552563    return true;
     
    595606    // we'll never reach the relevant op_profile_did_call.
    596607    if (Profiler* profiler = *Profiler::enabledProfilerReference()) {
    597 #if !ENABLE(JIT)
    598         // FIXME: Why 8? - work out what this magic value is, replace the constant with something more helpful.
    599         if (isCallBytecode(codeBlock->instructions()[bytecodeOffset].u.opcode))
    600             profiler->didExecute(callFrame, callFrame->r(codeBlock->instructions()[bytecodeOffset + 1].u.operand).jsValue());
    601         else if (codeBlock->instructions().size() > (bytecodeOffset + 8) && codeBlock->instructions()[bytecodeOffset + 8].u.opcode == getOpcode(op_construct))
    602             profiler->didExecute(callFrame, callFrame->r(codeBlock->instructions()[bytecodeOffset + 9].u.operand).jsValue());
    603 #else
    604         int functionRegisterIndex;
    605         if (codeBlock->functionRegisterForBytecodeOffset(bytecodeOffset, functionRegisterIndex))
    606             profiler->didExecute(callFrame, callFrame->r(functionRegisterIndex).jsValue());
     608#if ENABLE(INTERPRETER)
     609        if (!callFrame->globalData().canUseJIT()) {
     610            // FIXME: Why 8? - work out what this magic value is, replace the constant with something more helpful.
     611            if (isCallBytecode(codeBlock->instructions()[bytecodeOffset].u.opcode))
     612                profiler->didExecute(callFrame, callFrame->r(codeBlock->instructions()[bytecodeOffset + 1].u.operand).jsValue());
     613            else if (codeBlock->instructions().size() > (bytecodeOffset + 8) && codeBlock->instructions()[bytecodeOffset + 8].u.opcode == getOpcode(op_construct))
     614                profiler->didExecute(callFrame, callFrame->r(codeBlock->instructions()[bytecodeOffset + 9].u.operand).jsValue());
     615        }
     616#if ENABLE(JIT)
     617        else
     618#endif
     619#endif
     620#if ENABLE(JIT)
     621        {
     622            int functionRegisterIndex;
     623            if (codeBlock->functionRegisterForBytecodeOffset(bytecodeOffset, functionRegisterIndex))
     624                profiler->didExecute(callFrame, callFrame->r(functionRegisterIndex).jsValue());
     625        }
    607626#endif
    608627    }
     
    677696        SamplingTool::CallRecord callRecord(m_sampler.get());
    678697
    679         m_reentryDepth++;
     698        m_reentryDepth++; 
    680699#if ENABLE(JIT)
    681         result = program->jitCode(newCallFrame, scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
    682 #else
    683         result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
    684 #endif
     700#if ENABLE(INTERPRETER)
     701        if (callFrame->globalData().canUseJIT())
     702#endif
     703            result = program->jitCode(newCallFrame, scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
     704#if ENABLE(INTERPRETER)
     705        else
     706#endif
     707#endif
     708#if ENABLE(INTERPRETER)
     709            result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
     710#endif
     711
    685712        m_reentryDepth--;
    686713    }
     
    750777            SamplingTool::CallRecord callRecord(m_sampler.get());
    751778
    752             m_reentryDepth++;
    753     #if ENABLE(JIT)
    754             result = callData.js.functionExecutable->jitCodeForCall(newCallFrame, callDataScopeChain).execute(&m_registerFile, newCallFrame, callDataScopeChain->globalData, exception);
    755     #else
    756             result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
    757     #endif
     779            m_reentryDepth++; 
     780#if ENABLE(JIT)
     781#if ENABLE(INTERPRETER)
     782            if (callFrame->globalData().canUseJIT())
     783#endif
     784                result = callData.js.functionExecutable->jitCodeForCall(newCallFrame, callDataScopeChain).execute(&m_registerFile, newCallFrame, callDataScopeChain->globalData, exception);
     785#if ENABLE(INTERPRETER)
     786            else
     787#endif
     788#endif
     789#if ENABLE(INTERPRETER)
     790                result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
     791#endif
    758792            m_reentryDepth--;
    759793        }
     
    842876            SamplingTool::CallRecord callRecord(m_sampler.get());
    843877
    844             m_reentryDepth++;
    845     #if ENABLE(JIT)
    846             result = constructData.js.functionExecutable->jitCodeForConstruct(newCallFrame, constructDataScopeChain).execute(&m_registerFile, newCallFrame, constructDataScopeChain->globalData, exception);
    847     #else
    848             result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
    849     #endif
     878            m_reentryDepth++; 
     879#if ENABLE(JIT)
     880#if ENABLE(INTERPRETER)
     881            if (callFrame->globalData().canUseJIT())
     882#endif
     883                result = constructData.js.functionExecutable->jitCodeForConstruct(newCallFrame, constructDataScopeChain).execute(&m_registerFile, newCallFrame, constructDataScopeChain->globalData, exception);
     884#if ENABLE(INTERPRETER)
     885            else
     886#endif
     887#endif
     888#if ENABLE(INTERPRETER)
     889                result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
     890#endif
    850891            m_reentryDepth--;
    851892        }
     
    923964    }
    924965    // a 0 codeBlock indicates a built-in caller
    925     newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), argc, function);
     966    newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), argc, function); 
    926967#if ENABLE(JIT)
    927     FunctionExecutable->jitCodeForCall(newCallFrame, scopeChain);
    928 #endif
    929 
     968#if ENABLE(INTERPRETER)
     969    if (callFrame->globalData().canUseJIT())
     970#endif
     971        FunctionExecutable->jitCodeForCall(newCallFrame, scopeChain);
     972#endif
    930973    CallFrameClosure result = { callFrame, newCallFrame, function, FunctionExecutable, scopeChain->globalData, oldEnd, scopeChain, codeBlock->m_numParameters, argc };
    931974    return result;
     
    943986        SamplingTool::CallRecord callRecord(m_sampler.get());
    944987       
    945         m_reentryDepth++;
     988        m_reentryDepth++; 
    946989#if ENABLE(JIT)
    947         result = closure.functionExecutable->generatedJITCodeForCall().execute(&m_registerFile, closure.newCallFrame, closure.globalData, exception);
    948 #else
    949         result = privateExecute(Normal, &m_registerFile, closure.newCallFrame, exception);
     990#if ENABLE(INTERPRETER)
     991        if (closure.newCallFrame->globalData().canUseJIT())
     992#endif
     993            result = closure.functionExecutable->generatedJITCodeForCall().execute(&m_registerFile, closure.newCallFrame, closure.globalData, exception);
     994#if ENABLE(INTERPRETER)
     995        else
     996#endif
     997#endif
     998#if ENABLE(INTERPRETER)
     999            result = privateExecute(Normal, &m_registerFile, closure.newCallFrame, exception);
    9501000#endif
    9511001        m_reentryDepth--;
     
    10421092
    10431093        m_reentryDepth++;
     1094       
    10441095#if ENABLE(JIT)
    1045         result = eval->jitCode(newCallFrame, scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
    1046 #else
    1047         result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
     1096#if ENABLE(INTERPRETER)
     1097        if (callFrame->globalData().canUseJIT())
     1098#endif
     1099            result = eval->jitCode(newCallFrame, scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception);
     1100#if ENABLE(INTERPRETER)
     1101        else
     1102#endif
     1103#endif
     1104#if ENABLE(INTERPRETER)
     1105            result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
    10481106#endif
    10491107        m_reentryDepth--;
     
    10851143}
    10861144   
    1087 #if !ENABLE(JIT)
     1145#if ENABLE(INTERPRETER)
    10881146NEVER_INLINE ScopeChainNode* Interpreter::createExceptionScope(CallFrame* callFrame, const Instruction* vPC)
    10891147{
     
    13211379}
    13221380
    1323 #endif // !ENABLE(JIT)
     1381#endif // ENABLE(INTERPRETER)
    13241382
    13251383JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFile, CallFrame* callFrame, JSValue* exception)
     
    13371395        return JSValue();
    13381396    }
    1339 
     1397   
    13401398#if ENABLE(JIT)
     1399#if ENABLE(INTERPRETER)
    13411400    // Mixing Interpreter + JIT is not supported.
    1342     ASSERT_NOT_REACHED();
    1343 #endif
    1344 #if !!ENABLE(JIT)
     1401    if (callFrame->globalData().canUseJIT())
     1402#endif
     1403        ASSERT_NOT_REACHED();
     1404#endif
     1405
     1406#if !ENABLE(INTERPRETER)
    13451407    UNUSED_PARAM(registerFile);
    13461408    UNUSED_PARAM(callFrame);
     
    37053767            }
    37063768            ASSERT(!asFunction(callFrame->callee())->isHostFunction());
    3707             uint32_t expectedParams = asFunction(callFrame->callee())->jsExecutable()->parameterCount();
    3708             uint32_t inplaceArgs = min(argCount, expectedParams);
    3709             uint32_t i = 0;
     3769            int32_t expectedParams = asFunction(callFrame->callee())->jsExecutable()->parameterCount();
     3770            int32_t inplaceArgs = min(static_cast<int32_t>(argCount), expectedParams);
     3771            int32_t i = 0;
    37103772            Register* argStore = callFrame->registers() + argsOffset;
    37113773
     
    37143776                argStore[i] = callFrame->registers()[i - RegisterFile::CallFrameHeaderSize - expectedParams];
    37153777            // Then we copy any additional arguments that may be further up the stack ('-1' to account for 'this')
    3716             for (; i < argCount; i++)
     3778            for (; i < static_cast<int32_t>(argCount); i++)
    37173779                argStore[i] = callFrame->registers()[i - RegisterFile::CallFrameHeaderSize - expectedParams - argCount - 1];
    37183780        } else if (!arguments.isUndefinedOrNull()) {
     
    39083970        JSValue returnValue = callFrame->r(result).jsValue();
    39093971
    3910         vPC = callFrame->returnPC();
     3972        vPC = callFrame->returnVPC();
    39113973        callFrame = callFrame->callerFrame();
    39123974       
     
    39524014            returnValue = callFrame->r(vPC[2].u.operand).jsValue();
    39534015
    3954         vPC = callFrame->returnPC();
     4016        vPC = callFrame->returnVPC();
    39554017        callFrame = callFrame->callerFrame();
    39564018
     
    41374199            codeBlock = newCodeBlock;
    41384200            vPC = newCodeBlock->instructions().begin();
    4139 
    41404201#if ENABLE(OPCODE_STATS)
    41414202            OpcodeStats::resetLastInstruction();
     
    45374598    #undef CHECK_FOR_EXCEPTION
    45384599    #undef CHECK_FOR_TIMEOUT
    4539 #endif // !ENABLE(JIT)
     4600#endif // ENABLE(INTERPRETER)
    45404601}
    45414602
     
    45934654    if (!callerCodeBlock)
    45944655        return;
    4595 
    4596     unsigned bytecodeOffset = callerCodeBlock->bytecodeOffset(callerFrame, callFrame->returnPC());
     4656    unsigned bytecodeOffset = 0;
     4657#if ENABLE(INTERPRETER)
     4658    if (!callerFrame->globalData().canUseJIT())
     4659        bytecodeOffset = callerCodeBlock->bytecodeOffset(callerFrame, callFrame->returnVPC());
     4660#if ENABLE(JIT)
     4661    else
     4662        bytecodeOffset = callerCodeBlock->bytecodeOffset(callerFrame, callFrame->returnPC());
     4663#endif
     4664#else
     4665    bytecodeOffset = callerCodeBlock->bytecodeOffset(callerFrame, callFrame->returnPC());
     4666#endif
    45974667    lineNumber = callerCodeBlock->lineNumberForBytecodeOffset(callerFrame, bytecodeOffset - 1);
    45984668    sourceID = callerCodeBlock->ownerExecutable()->sourceID();
  • trunk/JavaScriptCore/interpreter/Interpreter.h

    r60708 r62612  
    124124        JSValue execute(EvalExecutable*, CallFrame*, JSObject* thisObject, int globalRegisterOffset, ScopeChainNode*, JSValue* exception);
    125125
    126 #if !ENABLE(JIT)
     126#if ENABLE(INTERPRETER)
    127127        NEVER_INLINE bool resolve(CallFrame*, Instruction*, JSValue& exceptionValue);
    128128        NEVER_INLINE bool resolveSkip(CallFrame*, Instruction*, JSValue& exceptionValue);
     
    137137        void tryCachePutByID(CallFrame*, CodeBlock*, Instruction*, JSValue baseValue, const PutPropertySlot&);
    138138        void uncachePutByID(CodeBlock*, Instruction* vPC);       
    139 #endif // !ENABLE(JIT)
     139#endif // ENABLE(INTERPRETER)
    140140
    141141        NEVER_INLINE bool unwindCallFrame(CallFrame*&, JSValue, unsigned& bytecodeOffset, CodeBlock*&);
  • trunk/JavaScriptCore/runtime/ArrayPrototype.cpp

    r61588 r62612  
    7777    // If the JIT is enabled then we need to preserve the invariant that every
    7878    // function with a CodeBlock also has JIT code.
    79     callData.js.functionExecutable->jitCodeForCall(exec, callData.js.scopeChain);
    80     CodeBlock* codeBlock = &callData.js.functionExecutable->generatedBytecodeForCall();
     79    CodeBlock* codeBlock = 0;
     80#if ENABLE(INTERPRETER)
     81    if (!exec->globalData().canUseJIT())
     82        codeBlock = callData.js.functionExecutable->bytecodeForCall(exec, callData.js.scopeChain);
     83    else
     84#endif
     85    {
     86        callData.js.functionExecutable->jitCodeForCall(exec, callData.js.scopeChain);
     87        codeBlock = &callData.js.functionExecutable->generatedBytecodeForCall();
     88    }
    8189#else
    8290    CodeBlock* codeBlock = callData.js.functionExecutable->bytecodeForCall(exec, callData.js.scopeChain);
  • trunk/JavaScriptCore/runtime/Executable.cpp

    r62551 r62612  
    178178void EvalExecutable::generateJITCode(ExecState* exec, ScopeChainNode* scopeChainNode)
    179179{
     180#if ENABLE(INTERPRETER)
     181    ASSERT(exec->globalData().canUseJIT());
     182#endif
    180183    CodeBlock* codeBlock = &bytecode(exec, scopeChainNode);
    181184    m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, codeBlock);
     
    189192void ProgramExecutable::generateJITCode(ExecState* exec, ScopeChainNode* scopeChainNode)
    190193{
     194#if ENABLE(INTERPRETER)
     195    ASSERT(exec->globalData().canUseJIT());
     196#endif
    191197    CodeBlock* codeBlock = &bytecode(exec, scopeChainNode);
    192198    m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, codeBlock);
     
    200206void FunctionExecutable::generateJITCodeForCall(ExecState* exec, ScopeChainNode* scopeChainNode)
    201207{
     208#if ENABLE(INTERPRETER)
     209    ASSERT(exec->globalData().canUseJIT());
     210#endif
    202211    CodeBlock* codeBlock = bytecodeForCall(exec, scopeChainNode);
    203212    m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, codeBlock, &m_jitCodeForCallWithArityCheck);
     
    211220void FunctionExecutable::generateJITCodeForConstruct(ExecState* exec, ScopeChainNode* scopeChainNode)
    212221{
     222#if ENABLE(INTERPRETER)
     223    ASSERT(exec->globalData().canUseJIT());
     224#endif
    213225    CodeBlock* codeBlock = bytecodeForConstruct(exec, scopeChainNode);
    214226    m_jitCodeForConstruct = JIT::compile(scopeChainNode->globalData, codeBlock, &m_jitCodeForConstructWithArityCheck);
     
    252264
    253265#if ENABLE(JIT)
    254     JITCode newJITCode = JIT::compile(globalData, newCodeBlock.get());
    255     ASSERT(codeBlock->m_isConstructor ? newJITCode.size() == generatedJITCodeForConstruct().size() : newJITCode.size() == generatedJITCodeForCall().size());
     266#if ENABLE(INTERPRETER)
     267    if (globalData->canUseJIT())
     268#endif
     269    {
     270        JITCode newJITCode = JIT::compile(globalData, newCodeBlock.get());
     271        ASSERT(codeBlock->m_isConstructor ? newJITCode.size() == generatedJITCodeForConstruct().size() : newJITCode.size() == generatedJITCodeForCall().size());
     272    }
    256273#endif
    257274
     
    279296
    280297#if ENABLE(JIT)
    281     JITCode newJITCode = JIT::compile(globalData, newCodeBlock.get());
    282     ASSERT(newJITCode.size() == generatedJITCodeForCall().size());
     298#if ENABLE(INTERPRETER)
     299    if (globalData->canUseJIT())
     300#endif
     301    {
     302        JITCode newJITCode = JIT::compile(globalData, newCodeBlock.get());
     303        ASSERT(newJITCode.size() == generatedJITCodeForCall().size());
     304    }
    283305#endif
    284306
  • trunk/JavaScriptCore/runtime/JSFunction.cpp

    r60762 r62612  
    4343
    4444namespace JSC {
    45 
     45#if ENABLE(JIT)
    4646EncodedJSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState* exec)
    4747{
     
    5050    return throwVMError(exec, createNotAConstructorError(exec, exec->callee(), vPCIndex, codeBlock));
    5151}
     52#endif
    5253
    5354ASSERT_CLASS_FITS_IN_CELL(JSFunction);
  • trunk/JavaScriptCore/runtime/JSGlobalData.cpp

    r61623 r62612  
    5959#if PLATFORM(MAC)
    6060#include "ProfilerServer.h"
     61#include <CoreFoundation/CoreFoundation.h>
    6162#endif
    6263
     
    157158    startProfilerServerIfNeeded();
    158159#endif
     160#if ENABLE(JIT) && ENABLE(INTERPRETER)
     161#if PLATFORM(MAC)
     162    CFStringRef canUseJITKey = CFStringCreateWithCString(0 , "JavaScriptCoreUseJIT", kCFStringEncodingMacRoman);
     163    CFBooleanRef canUseJIT = (CFBooleanRef)CFPreferencesCopyAppValue(canUseJITKey, kCFPreferencesCurrentApplication);
     164    m_canUseJIT = kCFBooleanTrue == canUseJIT;
     165    CFRelease(canUseJIT);
     166    CFRelease(canUseJITKey);
     167#elif OS(UNIX)
     168    m_canUseJIT = !getenv("JSC_FORCE_INTERPRETER");
     169#else
     170    m_canUseJIT = true;
     171#endif
     172#endif
    159173}
    160174
  • trunk/JavaScriptCore/runtime/JSGlobalData.h

    r61732 r62612  
    168168#endif
    169169
     170#if ENABLE(JIT)
     171#if ENABLE(INTERPRETER)
     172        bool canUseJIT() { return m_canUseJIT; }
     173#endif
     174#else
     175        bool canUseJIT() { return false; }
     176#endif
    170177        Lexer* lexer;
    171178        Parser* parser;
     
    234241        static JSGlobalData*& sharedInstanceInternal();
    235242        void createNativeThunk();
     243#if ENABLE(JIT) && ENABLE(INTERPRETER)
     244        bool m_canUseJIT;
     245#endif
    236246    };
    237247
  • trunk/JavaScriptCore/wtf/Platform.h

    r62544 r62612  
    973973#endif /* !defined(ENABLE_JIT) */
    974974
     975#if !ENABLE(JIT)
     976#define ENABLE_INTERPRETER 1
     977#endif
     978
     979#if !(ENABLE(JIT) || ENABLE(INTERPRETER))
     980#error You have to have at least one execution model enabled to build JSC
     981#endif
     982
    975983/* CPU architecture specific optimizations */
    976984#if CPU(ARM_TRADITIONAL)
     
    10131021#endif
    10141022
    1015 #if COMPILER(GCC) && !ENABLE(JIT)
     1023#if COMPILER(GCC) && ENABLE(INTERPRETER)
    10161024#define HAVE_COMPUTED_GOTO 1
    10171025#endif
Note: See TracChangeset for help on using the changeset viewer.