Changeset 160186 in webkit


Ignore:
Timestamp:
Dec 5, 2013 12:33:35 PM (10 years ago)
Author:
mark.lam@apple.com
Message:

Make the C Loop LLINT work with callToJavaScript.
https://bugs.webkit.org/show_bug.cgi?id=125294.

Reviewed by Michael Saboff.

  1. Changed the C Loop LLINT to dispatch to an Executable via its JITCode instance which is consistent with how the ASM LLINT works.
  2. Changed CLoop::execute() to take an Opcode instead of an OpcodeID. This makes it play nice with the use of JITCode for dispatching.
  3. Introduce a callToJavaScript and callToNativeFunction for the C Loop LLINT. These will call JSStack::pushFrame() and popFrame() to setup and teardown the CallFrame.
  4. Also introduced a C Loop returnFromJavaScript which is just a replacement for ctiOpThrowNotCaught which had the same function.
  5. Remove a lot of #if ENABLE(LLINT_C_LOOP) code now that the dispatch mechanism is consistent.

This patch has been tested with both configurations of COMPUTED_GOTOs
on and off.

  • interpreter/CachedCall.h:

(JSC::CachedCall::CachedCall):
(JSC::CachedCall::call):
(JSC::CachedCall::setArgument):

  • interpreter/CallFrameClosure.h:

(JSC::CallFrameClosure::setThis):
(JSC::CallFrameClosure::setArgument):
(JSC::CallFrameClosure::resetCallFrame):

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::execute):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::prepareForRepeatCall):

  • interpreter/Interpreter.h:
  • interpreter/JSStack.h:
  • interpreter/JSStackInlines.h:

(JSC::JSStack::pushFrame):

  • interpreter/ProtoCallFrame.h:

(JSC::ProtoCallFrame::scope):
(JSC::ProtoCallFrame::callee):
(JSC::ProtoCallFrame::thisValue):
(JSC::ProtoCallFrame::argument):
(JSC::ProtoCallFrame::setArgument):

  • jit/JITCode.cpp:

(JSC::JITCode::execute):

  • jit/JITCode.h:
  • jit/JITExceptions.cpp:

(JSC::genericUnwind):

  • llint/LLIntCLoop.cpp:

(JSC::LLInt::CLoop::initialize):

  • llint/LLIntCLoop.h:
  • llint/LLIntEntrypoint.cpp:

(JSC::LLInt::setFunctionEntrypoint):
(JSC::LLInt::setEvalEntrypoint):
(JSC::LLInt::setProgramEntrypoint):

  • Inverted the check for vm.canUseJIT(). This allows the JIT case to be #if'd out nicely when building the C Loop LLINT.
  • llint/LLIntOpcode.h:
  • llint/LLIntThunks.cpp:

(JSC::doCallToJavaScript):
(JSC::executeJS):
(JSC::callToJavaScript):
(JSC::executeNative):
(JSC::callToNativeFunction):

  • llint/LLIntThunks.h:
  • llint/LowLevelInterpreter.cpp:

(JSC::CLoop::execute):

  • runtime/Executable.h:

(JSC::ExecutableBase::offsetOfNumParametersFor):
(JSC::ExecutableBase::hostCodeEntryFor):
(JSC::ExecutableBase::jsCodeEntryFor):
(JSC::ExecutableBase::jsCodeWithArityCheckEntryFor):
(JSC::NativeExecutable::create):
(JSC::NativeExecutable::finishCreation):
(JSC::ProgramExecutable::generatedJITCode):

  • runtime/JSArray.cpp:

(JSC::AVLTreeAbstractorForArrayCompare::compare_key_key):

  • runtime/StringPrototype.cpp:

(JSC::replaceUsingRegExpSearch):

  • runtime/VM.cpp:

(JSC::VM::getHostFunction):

Location:
trunk/Source/JavaScriptCore
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r160175 r160186  
     12013-12-05  Mark Lam  <mark.lam@apple.com>
     2
     3        Make the C Loop LLINT work with callToJavaScript.
     4        https://bugs.webkit.org/show_bug.cgi?id=125294.
     5
     6        Reviewed by Michael Saboff.
     7
     8        1. Changed the C Loop LLINT to dispatch to an Executable via its JITCode
     9           instance which is consistent with how the ASM LLINT works.
     10        2. Changed CLoop::execute() to take an Opcode instead of an OpcodeID.
     11           This makes it play nice with the use of JITCode for dispatching.
     12        3. Introduce a callToJavaScript and callToNativeFunction for the C Loop
     13           LLINT. These will call JSStack::pushFrame() and popFrame() to setup
     14           and teardown the CallFrame.
     15        4. Also introduced a C Loop returnFromJavaScript which is just a
     16           replacement for ctiOpThrowNotCaught which had the same function.
     17        5. Remove a lot of #if ENABLE(LLINT_C_LOOP) code now that the dispatch
     18           mechanism is consistent.
     19
     20        This patch has been tested with both configurations of COMPUTED_GOTOs
     21        on and off.
     22
     23        * interpreter/CachedCall.h:
     24        (JSC::CachedCall::CachedCall):
     25        (JSC::CachedCall::call):
     26        (JSC::CachedCall::setArgument):
     27        * interpreter/CallFrameClosure.h:
     28        (JSC::CallFrameClosure::setThis):
     29        (JSC::CallFrameClosure::setArgument):
     30        (JSC::CallFrameClosure::resetCallFrame):
     31        * interpreter/Interpreter.cpp:
     32        (JSC::Interpreter::execute):
     33        (JSC::Interpreter::executeCall):
     34        (JSC::Interpreter::executeConstruct):
     35        (JSC::Interpreter::prepareForRepeatCall):
     36        * interpreter/Interpreter.h:
     37        * interpreter/JSStack.h:
     38        * interpreter/JSStackInlines.h:
     39        (JSC::JSStack::pushFrame):
     40        * interpreter/ProtoCallFrame.h:
     41        (JSC::ProtoCallFrame::scope):
     42        (JSC::ProtoCallFrame::callee):
     43        (JSC::ProtoCallFrame::thisValue):
     44        (JSC::ProtoCallFrame::argument):
     45        (JSC::ProtoCallFrame::setArgument):
     46        * jit/JITCode.cpp:
     47        (JSC::JITCode::execute):
     48        * jit/JITCode.h:
     49        * jit/JITExceptions.cpp:
     50        (JSC::genericUnwind):
     51        * llint/LLIntCLoop.cpp:
     52        (JSC::LLInt::CLoop::initialize):
     53        * llint/LLIntCLoop.h:
     54        * llint/LLIntEntrypoint.cpp:
     55        (JSC::LLInt::setFunctionEntrypoint):
     56        (JSC::LLInt::setEvalEntrypoint):
     57        (JSC::LLInt::setProgramEntrypoint):
     58        - Inverted the check for vm.canUseJIT(). This allows the JIT case to be
     59          #if'd out nicely when building the C Loop LLINT.
     60        * llint/LLIntOpcode.h:
     61        * llint/LLIntThunks.cpp:
     62        (JSC::doCallToJavaScript):
     63        (JSC::executeJS):
     64        (JSC::callToJavaScript):
     65        (JSC::executeNative):
     66        (JSC::callToNativeFunction):
     67        * llint/LLIntThunks.h:
     68        * llint/LowLevelInterpreter.cpp:
     69        (JSC::CLoop::execute):
     70        * runtime/Executable.h:
     71        (JSC::ExecutableBase::offsetOfNumParametersFor):
     72        (JSC::ExecutableBase::hostCodeEntryFor):
     73        (JSC::ExecutableBase::jsCodeEntryFor):
     74        (JSC::ExecutableBase::jsCodeWithArityCheckEntryFor):
     75        (JSC::NativeExecutable::create):
     76        (JSC::NativeExecutable::finishCreation):
     77        (JSC::ProgramExecutable::generatedJITCode):
     78        * runtime/JSArray.cpp:
     79        (JSC::AVLTreeAbstractorForArrayCompare::compare_key_key):
     80        * runtime/StringPrototype.cpp:
     81        (JSC::replaceUsingRegExpSearch):
     82        * runtime/VM.cpp:
     83        (JSC::VM::getHostFunction):
     84
    1852013-12-05  Laszlo Vidacs  <lac@inf.u-szeged.hu>
    286
  • trunk/Source/JavaScriptCore/interpreter/CachedCall.h

    r160094 r160186  
    11/*
    2  * Copyright (C) 2009 Apple Inc. All rights reserved.
     2 * Copyright (C) 2009, 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4646            ASSERT(!function->isHostFunction());
    4747            if (callFrame->vm().isSafeToRecurse()) {
    48 #if !ENABLE(LLINT_C_LOOP)
    4948                m_arguments.resize(argumentCount);
    5049                m_closure = m_interpreter->prepareForRepeatCall(function->jsExecutable(), callFrame, &m_protoCallFrame, function, argumentCount + 1, function->scope(), m_arguments.data());
    51 #else
    52                 m_closure = m_interpreter->prepareForRepeatCall(function->jsExecutable(), callFrame, function, argumentCount + 1, function->scope());
    53 #endif
    5450            } else
    5551                throwStackOverflowError(callFrame);
     
    6258            return m_interpreter->execute(m_closure);
    6359        }
    64 #if !ENABLE(LLINT_C_LOOP)
    6560        void setThis(JSValue v) { m_protoCallFrame.setThisValue(v); }
    6661        void setArgument(int n, JSValue v) { m_protoCallFrame.setArgument(n, v); }
    67 #else
    68         void setThis(JSValue v) { m_closure.setThis(v); }
    69         void setArgument(int n, JSValue v) { m_closure.setArgument(n, v); }
    70 
    71         CallFrame* newCallFrame(ExecState* exec)
    72         {
    73             CallFrame* callFrame = m_closure.newCallFrame;
    74             callFrame->setScope(exec->scope());
    75             return callFrame;
    76         }
    77 
    78         ~CachedCall()
    79         {
    80             if (m_valid)
    81                 m_interpreter->endRepeatCall(m_closure);
    82         }
    83 #endif
    8462
    8563    private:
     
    8765        Interpreter* m_interpreter;
    8866        VMEntryScope m_entryScope;
    89 #if !ENABLE(LLINT_C_LOOP)
    9067        ProtoCallFrame m_protoCallFrame;
    9168        Vector<JSValue> m_arguments;
    92 #endif
    9369        CallFrameClosure m_closure;
    9470    };
  • trunk/Source/JavaScriptCore/interpreter/CallFrameClosure.h

    r160094 r160186  
    11/*
    2  * Copyright (C) 2009 Apple Inc. All rights reserved.
     2 * Copyright (C) 2009, 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3333struct CallFrameClosure {
    3434    CallFrame* oldCallFrame;
    35 #if ENABLE(LLINT_C_LOOP)
    36     CallFrame* newCallFrame;
    37 #else
    38     ProtoCallFrame* newCallFrame;
    39 #endif
     35    ProtoCallFrame* protoCallFrame;
    4036    JSFunction* function;
    4137    FunctionExecutable* functionExecutable;
     
    4743    void setThis(JSValue value)
    4844    {
    49         newCallFrame->setThisValue(value);
     45        protoCallFrame->setThisValue(value);
    5046    }
    5147
    5248    void setArgument(int argument, JSValue value)
    5349    {
    54         newCallFrame->setArgument(argument, value);
     50        protoCallFrame->setArgument(argument, value);
    5551    }
    5652
    5753    void resetCallFrame()
    5854    {
    59         newCallFrame->setScope(scope);
    60 #if ENABLE(LLINT_C_LOOP)
    61         // setArgument() takes an arg index that starts from 0 for the first
    62         // argument after the 'this' value. Since both argumentCountIncludingThis
    63         // and parameterCountIncludingThis includes the 'this' value, we need to
    64         // subtract 1 from them to make it a valid argument index for setArgument().
    65         for (int i = argumentCountIncludingThis-1; i < parameterCountIncludingThis-1; ++i)
    66             newCallFrame->setArgument(i, jsUndefined());
    67 #endif
     55        protoCallFrame->setScope(scope);
    6856    }
    6957};
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r160094 r160186  
    861861        return throwTerminatedExecutionException(callFrame);
    862862
    863     // Push the call frame for this invocation:
    864863    ASSERT(codeBlock->numParameters() == 1); // 1 parameter for 'this'.
    865 #if ENABLE(LLINT_C_LOOP)
    866     CallFrame* newCallFrame = m_stack.pushFrame(callFrame, codeBlock, scope, 1, 0);
    867     if (UNLIKELY(!newCallFrame))
    868         return checkedReturn(throwStackOverflowError(callFrame));
    869 
    870     // Set the arguments for the callee:
    871     newCallFrame->setThisValue(thisObj);
    872 #else
     864
    873865    if (UNLIKELY(!m_stack.entryCheck(codeBlock, 1)))
    874866        return checkedReturn(throwStackOverflowError(callFrame));
     
    876868    ProtoCallFrame protoCallFrame;
    877869    protoCallFrame.init(codeBlock, scope, 0, thisObj, 1);
    878 #endif
    879870
    880871    if (LegacyProfiler* profiler = vm.enabledProfiler())
     
    887878        Watchdog::Scope watchdogScope(vm.watchdog);
    888879
    889 #if ENABLE(LLINT_C_LOOP)
    890         result = LLInt::CLoop::execute(newCallFrame, llint_program_prologue);
    891 #elif ENABLE(JIT)
    892880        result = program->generatedJITCode()->execute(&vm, &protoCallFrame, m_stack.getTopOfStack());
    893 #endif // ENABLE(JIT)
    894881    }
    895882
    896883    if (LegacyProfiler* profiler = vm.enabledProfiler())
    897884        profiler->didExecute(callFrame, program->sourceURL(), program->lineNo());
    898 
    899 #if ENABLE(LLINT_C_LOOP)
    900     m_stack.popFrame(newCallFrame);
    901 #endif
    902885
    903886    return checkedReturn(result);
     
    943926        return throwTerminatedExecutionException(callFrame);
    944927
    945 #if ENABLE(LLINT_C_LOOP)
    946     CallFrame* newCallFrame = m_stack.pushFrame(callFrame, newCodeBlock, scope, argsCount, function);
    947     if (UNLIKELY(!newCallFrame))
    948         return checkedReturn(throwStackOverflowError(callFrame));
    949 
    950     // Set the arguments for the callee:
    951     newCallFrame->setThisValue(thisValue);
    952     for (size_t i = 0; i < args.size(); ++i)
    953         newCallFrame->setArgument(i, args.at(i));
    954 #else
    955928    if (UNLIKELY(!m_stack.entryCheck(newCodeBlock, argsCount)))
    956929        return checkedReturn(throwStackOverflowError(callFrame));
     
    958931    ProtoCallFrame protoCallFrame;
    959932    protoCallFrame.init(newCodeBlock, scope, function, thisValue, argsCount, args.data());
    960 #endif
    961933
    962934    if (LegacyProfiler* profiler = vm.enabledProfiler())
     
    969941
    970942        // Execute the code:
    971         if (isJSCall) {
    972 #if ENABLE(LLINT_C_LOOP)
    973             result = LLInt::CLoop::execute(newCallFrame, llint_function_for_call_prologue);
    974 #elif ENABLE(JIT)
     943        if (isJSCall)
    975944            result = callData.js.functionExecutable->generatedJITCodeForCall()->execute(&vm, &protoCallFrame, m_stack.getTopOfStack());
    976 #endif // ENABLE(JIT)
    977         } else {
    978 #if ENABLE(LLINT_C_LOOP)
    979             result = JSValue::decode(callData.native.function(newCallFrame));
    980 #else
     945        else
    981946            result = JSValue::decode(callToNativeFunction(reinterpret_cast<void*>(callData.native.function), &vm.topCallFrame, &protoCallFrame, m_stack.getTopOfStack()));
    982 #endif
    983         }
    984947    }
    985948
     
    987950        profiler->didExecute(callFrame, function);
    988951
    989 #if ENABLE(LLINT_C_LOOP)
    990     m_stack.popFrame(newCallFrame);
    991 #endif
    992952    return checkedReturn(result);
    993953}
     
    1033993    if (UNLIKELY(vm.watchdog.didFire(callFrame)))
    1034994        return throwTerminatedExecutionException(callFrame);
    1035 #if ENABLE(LLINT_C_LOOP)
    1036     CallFrame* newCallFrame = m_stack.pushFrame(callFrame, newCodeBlock, scope, argsCount, constructor);
    1037     if (UNLIKELY(!newCallFrame))
    1038         return checkedReturn(throwStackOverflowError(callFrame));
    1039 
    1040     // Set the arguments for the callee:
    1041     newCallFrame->setThisValue(jsUndefined());
    1042     for (size_t i = 0; i < args.size(); ++i)
    1043         newCallFrame->setArgument(i, args.at(i));
    1044 #else
     995
    1045996    if (UNLIKELY(!m_stack.entryCheck(newCodeBlock, argsCount)))
    1046997        return checkedReturn(throwStackOverflowError(callFrame));
     
    1048999    ProtoCallFrame protoCallFrame;
    10491000    protoCallFrame.init(newCodeBlock, scope, constructor, jsUndefined(), argsCount, args.data());
    1050 #endif
    10511001
    10521002    if (LegacyProfiler* profiler = vm.enabledProfiler())
     
    10591009
    10601010        // Execute the code.
    1061         if (isJSConstruct) {
    1062 #if ENABLE(LLINT_C_LOOP)
    1063             result = LLInt::CLoop::execute(newCallFrame, llint_function_for_construct_prologue);
    1064 #elif ENABLE(JIT)
     1011        if (isJSConstruct)
    10651012            result = constructData.js.functionExecutable->generatedJITCodeForConstruct()->execute(&vm, &protoCallFrame, m_stack.getTopOfStack());
    1066 #endif // ENABLE(JIT)
    1067         } else {
    1068 #if ENABLE(LLINT_C_LOOP)
    1069             result = JSValue::decode(constructData.native.function(newCallFrame));
    1070 #else
     1013        else {
    10711014            result = JSValue::decode(callToNativeFunction(reinterpret_cast<void*>(constructData.native.function), &vm.topCallFrame, &protoCallFrame, m_stack.getTopOfStack()));
    1072 #endif
     1015
    10731016            if (!callFrame->hadException())
    10741017                RELEASE_ASSERT(result.isObject());
     
    10781021    if (LegacyProfiler* profiler = vm.enabledProfiler())
    10791022        profiler->didExecute(callFrame, constructor);
    1080 
    1081 #if ENABLE(LLINT_C_LOOP)
    1082     m_stack.popFrame(newCallFrame);
    1083 #endif
    10841023
    10851024    if (callFrame->hadException())
     
    10891028}
    10901029
    1091 #if ENABLE(LLINT_C_LOOP)
    1092 CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* functionExecutable, CallFrame* callFrame, JSFunction* function, int argumentCountIncludingThis, JSScope* scope)
    1093 #else
    10941030CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* functionExecutable, CallFrame* callFrame, ProtoCallFrame* protoCallFrame, JSFunction* function, int argumentCountIncludingThis, JSScope* scope, JSValue* args)
    1095 #endif
    10961031{
    10971032    VM& vm = *scope->vm();
     
    11121047    size_t argsCount = argumentCountIncludingThis;
    11131048
    1114 #if ENABLE(LLINT_C_LOOP)
    1115     CallFrame* newCallFrame = m_stack.pushFrame(callFrame, newCodeBlock, scope, argsCount, function);
    1116 
    1117     if (UNLIKELY(!newCallFrame)) {
    1118         throwStackOverflowError(callFrame);
    1119         return CallFrameClosure();
    1120     }
    1121 
    1122     // Return the successful closure:
    1123     CallFrameClosure result = { callFrame, newCallFrame, function, functionExecutable, &vm, scope, newCodeBlock->numParameters(), argumentCountIncludingThis };
    1124 #else
    11251049    if (UNLIKELY(!m_stack.entryCheck(newCodeBlock, argsCount))) {
    11261050        throwStackOverflowError(callFrame);
     
    11311055    // Return the successful closure:
    11321056    CallFrameClosure result = { callFrame, protoCallFrame, function, functionExecutable, &vm, scope, newCodeBlock->numParameters(), argumentCountIncludingThis };
    1133 #endif
    11341057    return result;
    11351058}
     
    11451068
    11461069    StackStats::CheckPoint stackCheckPoint;
    1147 #if ENABLE(LLINT_C_LOOP)
    1148     m_stack.validateFence(closure.newCallFrame, "BEFORE");
    1149 #endif
    11501070    closure.resetCallFrame();
    1151 #if ENABLE(LLINT_C_LOOP)
    1152     m_stack.validateFence(closure.newCallFrame, "STEP 1");
    1153 #endif
    11541071
    11551072    if (LegacyProfiler* profiler = vm.enabledProfiler())
     
    11591076        return throwTerminatedExecutionException(closure.oldCallFrame);
    11601077
    1161     // The code execution below may push more frames and point the topCallFrame
    1162     // to those newer frames, or it may pop to the top frame to the caller of
    1163     // the current repeat frame, or it may leave the top frame pointing to the
    1164     // current repeat frame.
    1165     //
    1166     // Hence, we need to preserve the topCallFrame here ourselves before
    1167     // repeating this call on a second callback function.
    1168 
    1169 #if ENABLE(LLINT_C_LOOP)
    1170     TopCallFrameSetter topCallFrame(vm, closure.newCallFrame);
    1171 #endif
    1172 
    11731078    // Execute the code:
    11741079    JSValue result;
     
    11771082        Watchdog::Scope watchdogScope(vm.watchdog);
    11781083
    1179 #if ENABLE(LLINT_C_LOOP)
    1180         result = LLInt::CLoop::execute(closure.newCallFrame, llint_function_for_call_prologue);
    1181 #elif ENABLE(JIT)
    1182         result = closure.functionExecutable->generatedJITCodeForCall()->execute(&vm, closure.newCallFrame, m_stack.getTopOfStack());
    1183 #endif // ENABLE(JIT)
     1084        result = closure.functionExecutable->generatedJITCodeForCall()->execute(&vm, closure.protoCallFrame, m_stack.getTopOfStack());
    11841085    }
    11851086
     
    11871088        profiler->didExecute(closure.oldCallFrame, closure.function);
    11881089
    1189 #if ENABLE(LLINT_C_LOOP)
    1190     m_stack.validateFence(closure.newCallFrame, "AFTER");
    1191 #endif
    11921090    return checkedReturn(result);
    11931091}
    1194 
    1195 #if ENABLE(LLINT_C_LOOP)
    1196 void Interpreter::endRepeatCall(CallFrameClosure& closure)
    1197 {
    1198     m_stack.popFrame(closure.newCallFrame);
    1199 }
    1200 #endif
    12011092
    12021093JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSValue thisValue, JSScope* scope)
     
    12601151        return throwTerminatedExecutionException(callFrame);
    12611152
    1262     // Push the frame:
    12631153    ASSERT(codeBlock->numParameters() == 1); // 1 parameter for 'this'.
    1264 #if ENABLE(LLINT_C_LOOP)
    1265     CallFrame* newCallFrame = m_stack.pushFrame(callFrame, codeBlock, scope, 1, 0);
    1266     if (UNLIKELY(!newCallFrame))
    1267         return checkedReturn(throwStackOverflowError(callFrame));
    1268 
    1269     // Set the arguments for the callee:
    1270     newCallFrame->setThisValue(thisValue);
    1271 #else
     1154
    12721155    if (UNLIKELY(!m_stack.entryCheck(codeBlock, 1)))
    12731156        return checkedReturn(throwStackOverflowError(callFrame));
     
    12751158    ProtoCallFrame protoCallFrame;
    12761159    protoCallFrame.init(codeBlock, scope, 0, thisValue, 1);
    1277 #endif
    12781160
    12791161    if (LegacyProfiler* profiler = vm.enabledProfiler())
     
    12861168        Watchdog::Scope watchdogScope(vm.watchdog);
    12871169
    1288 #if ENABLE(LLINT_C_LOOP)
    1289         result = LLInt::CLoop::execute(newCallFrame, llint_eval_prologue);
    1290 #elif ENABLE(JIT)
    12911170        result = eval->generatedJITCode()->execute(&vm, &protoCallFrame, m_stack.getTopOfStack());
    1292 #endif // ENABLE(JIT)
    12931171    }
    12941172
     
    12961174        profiler->didExecute(callFrame, eval->sourceURL(), eval->lineNo());
    12971175
    1298 #if ENABLE(LLINT_C_LOOP)
    1299     m_stack.popFrame(newCallFrame);
    1300 #endif
    13011176    return checkedReturn(result);
    13021177}
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.h

    r160094 r160186  
    258258        enum ExecutionFlag { Normal, InitializeAndReturn };
    259259
    260 #if !ENABLE(LLINT_C_LOOP)
    261260        CallFrameClosure prepareForRepeatCall(FunctionExecutable*, CallFrame*, ProtoCallFrame*, JSFunction*, int argumentCountIncludingThis, JSScope*, JSValue*);
    262 #else
    263         CallFrameClosure prepareForRepeatCall(FunctionExecutable*, CallFrame*, JSFunction*, int argumentCountIncludingThis, JSScope*);
    264         void endRepeatCall(CallFrameClosure&);
    265 #endif
     261
    266262        JSValue execute(CallFrameClosure&);
    267263
  • trunk/Source/JavaScriptCore/interpreter/JSStack.h

    r160094 r160186  
    103103        bool entryCheck(class CodeBlock*, int);
    104104
    105         CallFrame* pushFrame(CallFrame* callerFrame, class CodeBlock*,
    106             JSScope*, int argsCount, JSObject* callee);
     105        CallFrame* pushFrame(class CodeBlock*, JSScope*, int argsCount, JSObject* callee);
    107106
    108107        void popFrame(CallFrame*);
  • trunk/Source/JavaScriptCore/interpreter/JSStackInlines.h

    r160094 r160186  
    8181}
    8282
    83 inline CallFrame* JSStack::pushFrame(CallFrame* callerFrame,
    84     class CodeBlock* codeBlock, JSScope* scope, int argsCount, JSObject* callee)
     83inline CallFrame* JSStack::pushFrame(class CodeBlock* codeBlock, JSScope* scope, int argsCount, JSObject* callee)
    8584{
    8685    ASSERT(!!scope);
     
    120119    // and not a potential GlobalExec that was passed in. Point callerFrame to
    121120    // the top frame on the stack.
    122     callerFrame = m_topCallFrame;
     121    CallFrame* callerFrame = m_topCallFrame;
    123122
    124123    // Initialize the VM sentinel frame header:
  • trunk/Source/JavaScriptCore/interpreter/ProtoCallFrame.h

    r160094 r160186  
    4141
    4242    void init(CodeBlock*, JSScope*, JSObject*, JSValue, int, JSValue* otherArgs = 0);
     43
    4344    CodeBlock* codeBlock() const { return codeBlockValue.Register::codeBlock(); }
    4445    void setCodeBlock(CodeBlock* codeBlock) { codeBlockValue = codeBlock; }
     46
     47    JSScope* scope() const { return scopeChainValue.Register::scope(); }
    4548    void setScope(JSScope* scope) { scopeChainValue = scope; }
     49
     50    JSObject* callee() const { return calleeValue.Register::function(); }
    4651    void setCallee(JSObject* callee) { calleeValue = Register::withCallee(callee); }
     52
    4753    int argumentCountIncludingThis() const { return argCountAndCodeOriginValue.payload(); }
    4854    int argumentCount() const { return argumentCountIncludingThis() - 1; }
     
    5157
    5258    void clearCurrentVPC() { argCountAndCodeOriginValue.tag() = 0; }
     59   
     60    JSValue thisValue() const { return thisArg.Register::jsValue(); }
    5361    void setThisValue(JSValue value) { thisArg = value; }
    54     void setArgument(size_t argument, JSValue value)
     62
     63    JSValue argument(size_t argumentIndex)
    5564    {
    56         ASSERT(static_cast<int>(argument) < argumentCount());
    57         args[argument] = value;
     65        ASSERT(static_cast<int>(argumentIndex) < argumentCount());
     66        return args[argumentIndex];
     67    }
     68    void setArgument(size_t argumentIndex, JSValue value)
     69    {
     70        ASSERT(static_cast<int>(argumentIndex) < argumentCount());
     71        args[argumentIndex] = value;
    5872    }
    5973};
  • trunk/Source/JavaScriptCore/jit/JITCode.cpp

    r160094 r160186  
    4242}
    4343
    44 #if ENABLE(JIT)
    4544JSValue JITCode::execute(VM* vm, ProtoCallFrame* protoCallFrame, Register* topOfStack)
    4645{
     
    5049    return vm->exception() ? jsNull() : result;
    5150}
    52 #endif
    5351
    5452DFG::CommonData* JITCode::dfgCommon()
  • trunk/Source/JavaScriptCore/jit/JITCode.h

    r160175 r160186  
    4848
    4949struct ProtoCallFrame;
    50 
    51 #if ENABLE(JIT)
    5250class VM;
    53 class JSStack;
    54 #endif
    5551
    5652class JITCode : public ThreadSafeRefCounted<JITCode> {
  • trunk/Source/JavaScriptCore/jit/JITExceptions.cpp

    r159321 r160186  
    11/*
    2  * Copyright (C) 2012 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4040#include "VM.h"
    4141
    42 #if ENABLE(JIT) || ENABLE(LLINT)
    43 
    4442namespace JSC {
    4543
     
    5351    if (handler) {
    5452        catchPCForInterpreter = &callFrame->codeBlock()->instructions()[handler->target];
    55         catchRoutine = ExecutableBase::catchRoutineFor(handler, catchPCForInterpreter);
    56     } else {
    57 #if ENABLE(LLINT_C_LOOP)
    58         catchRoutine = LLInt::getCodePtr(ctiOpThrowNotCaught);
     53#if ENABLE(JIT)
     54        catchRoutine = handler->nativeCode.executableAddress();
    5955#else
    60         catchRoutine = FunctionPtr(LLInt::getCodePtr(returnFromJavaScript)).value();
     56        catchRoutine = catchPCForInterpreter->u.pointer;
    6157#endif
    62     }
     58    } else
     59        catchRoutine = LLInt::getCodePtr(returnFromJavaScript);
    6360   
    6461    vm->callFrameForThrow = callFrame;
     
    6966}
    7067
    71 }
    72 
    73 #endif
     68} // namespace JSC
  • trunk/Source/JavaScriptCore/llint/LLIntCLoop.cpp

    r127374 r160186  
    11/*
    2  * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2727#include "LLIntCLoop.h"
    2828
    29 #include "Instruction.h"
     29#if ENABLE(LLINT_C_LOOP)
     30
     31#include "LLIntData.h"
    3032
    3133namespace JSC {
    32 
    3334namespace LLInt {
    34 
    35 #if ENABLE(LLINT_C_LOOP)
    3635
    3736void CLoop::initialize()
    3837{
    39     execute(0, llint_unused, true);
     38    execute(0, getOpcode(llint_unused), true);
    4039}
    4140
    42 void* CLoop::catchRoutineFor(Instruction* catchPCForInterpreter)
    43 {
    44     return reinterpret_cast<Instruction*>(catchPCForInterpreter->u.opcode);
    45 }
    46 
    47 MacroAssemblerCodePtr CLoop::hostCodeEntryFor(CodeSpecializationKind kind)
    48 {
    49     MacroAssemblerCodePtr codePtr;
    50     codePtr = (kind == CodeForCall) ?
    51         MacroAssemblerCodePtr::createLLIntCodePtr(llint_native_call_trampoline) :
    52         MacroAssemblerCodePtr::createLLIntCodePtr(llint_native_construct_trampoline);
    53     return codePtr;
    54 }
    55 
    56 MacroAssemblerCodePtr CLoop::jsCodeEntryWithArityCheckFor(CodeSpecializationKind kind)
    57 {
    58     MacroAssemblerCodePtr codePtr;
    59     codePtr = (kind == CodeForCall) ?
    60         MacroAssemblerCodePtr::createLLIntCodePtr(llint_function_for_call_arity_check) :
    61         MacroAssemblerCodePtr::createLLIntCodePtr(llint_function_for_construct_arity_check);
    62     return codePtr;
    63 }
    64 
    65 MacroAssemblerCodePtr CLoop::jsCodeEntryFor(CodeSpecializationKind kind)
    66 {
    67     MacroAssemblerCodePtr codePtr;
    68     codePtr = (kind == CodeForCall) ?
    69         MacroAssemblerCodePtr::createLLIntCodePtr(llint_function_for_call_prologue) :
    70         MacroAssemblerCodePtr::createLLIntCodePtr(llint_function_for_construct_prologue);
    71     return codePtr;
    72 }
     41} // namespace LLInt
     42} // namespace JSC
    7343
    7444#endif // ENABLE(LLINT_C_LOOP)
    75 
    76 } } // namespace JSC::LLInt
  • trunk/Source/JavaScriptCore/llint/LLIntCLoop.h

    r140718 r160186  
    11/*
    2  * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2929#if ENABLE(LLINT_C_LOOP)
    3030
    31 #include "CodeSpecializationKind.h"
     31#include "CallFrame.h"
    3232#include "JSCJSValue.h"
    33 #include "MacroAssemblerCodeRef.h"
    3433#include "Opcode.h"
    35 #include "Register.h"
    3634
    3735namespace JSC {
    38 
    3936namespace LLInt {
    4037
     
    4441public:
    4542    static void initialize();
    46     static JSValue execute(CallFrame*, OpcodeID bootstrapOpcodeId, bool isInitializationPass = false);
    47 
    48     static void* catchRoutineFor(Instruction* catchPCForInterpreter);
    49 
    50     static MacroAssemblerCodePtr hostCodeEntryFor(CodeSpecializationKind);
    51     static MacroAssemblerCodePtr jsCodeEntryWithArityCheckFor(CodeSpecializationKind);
    52     static MacroAssemblerCodePtr jsCodeEntryFor(CodeSpecializationKind);
     43    static JSValue execute(CallFrame*, Opcode entryOpcode, bool isInitializationPass = false);
    5344};
    5445
    5546} } // namespace JSC::LLInt
    5647
     48using JSC::LLInt::CLoop;
     49
    5750#endif // ENABLE(LLINT_C_LOOP)
    5851
  • trunk/Source/JavaScriptCore/llint/LLIntEntrypoint.cpp

    r159721 r160186  
    3636#include "VM.h"
    3737
    38 
    3938namespace JSC { namespace LLInt {
    4039
     
    4342    CodeSpecializationKind kind = codeBlock->specializationKind();
    4443   
    45     if (!vm.canUseJIT()) {
     44#if ENABLE(JIT)
     45    if (vm.canUseJIT()) {
    4646        if (kind == CodeForCall) {
    4747            codeBlock->setJITCode(
    48                 adoptRef(new DirectJITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_function_for_call_prologue), JITCode::InterpreterThunk)),
    49                 MacroAssemblerCodePtr::createLLIntCodePtr(llint_function_for_call_arity_check));
     48                adoptRef(new DirectJITCode(vm.getCTIStub(functionForCallEntryThunkGenerator), JITCode::InterpreterThunk)),
     49                vm.getCTIStub(functionForCallArityCheckThunkGenerator).code());
    5050            return;
    5151        }
    52 
    5352        ASSERT(kind == CodeForConstruct);
    5453        codeBlock->setJITCode(
    55             adoptRef(new DirectJITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_function_for_construct_prologue), JITCode::InterpreterThunk)),
    56             MacroAssemblerCodePtr::createLLIntCodePtr(llint_function_for_construct_arity_check));
     54            adoptRef(new DirectJITCode(vm.getCTIStub(functionForConstructEntryThunkGenerator), JITCode::InterpreterThunk)),
     55            vm.getCTIStub(functionForConstructArityCheckThunkGenerator).code());
    5756        return;
    5857    }
    59    
    60 #if ENABLE(JIT)
     58#endif // ENABLE(JIT)
     59
     60    UNUSED_PARAM(vm);
    6161    if (kind == CodeForCall) {
    6262        codeBlock->setJITCode(
    63             adoptRef(new DirectJITCode(vm.getCTIStub(functionForCallEntryThunkGenerator), JITCode::InterpreterThunk)),
    64             vm.getCTIStub(functionForCallArityCheckThunkGenerator).code());
     63            adoptRef(new DirectJITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_function_for_call_prologue), JITCode::InterpreterThunk)),
     64            MacroAssemblerCodePtr::createLLIntCodePtr(llint_function_for_call_arity_check));
    6565        return;
    6666    }
    67 
    6867    ASSERT(kind == CodeForConstruct);
    6968    codeBlock->setJITCode(
    70         adoptRef(new DirectJITCode(vm.getCTIStub(functionForConstructEntryThunkGenerator), JITCode::InterpreterThunk)),
    71         vm.getCTIStub(functionForConstructArityCheckThunkGenerator).code());
    72 #endif // ENABLE(JIT)
     69        adoptRef(new DirectJITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_function_for_construct_prologue), JITCode::InterpreterThunk)),
     70        MacroAssemblerCodePtr::createLLIntCodePtr(llint_function_for_construct_arity_check));
    7371}
    7472
    7573static void setEvalEntrypoint(VM& vm, CodeBlock* codeBlock)
    7674{
    77     if (!vm.canUseJIT()) {
     75#if ENABLE(JIT)
     76    if (vm.canUseJIT()) {
    7877        codeBlock->setJITCode(
    79             adoptRef(new DirectJITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_eval_prologue), JITCode::InterpreterThunk)),
     78            adoptRef(new DirectJITCode(vm.getCTIStub(evalEntryThunkGenerator), JITCode::InterpreterThunk)),
    8079            MacroAssemblerCodePtr());
    8180        return;
    8281    }
    83 #if ENABLE(JIT)
     82#endif // ENABLE(JIT)
     83
     84    UNUSED_PARAM(vm);
    8485    codeBlock->setJITCode(
    85         adoptRef(new DirectJITCode(vm.getCTIStub(evalEntryThunkGenerator), JITCode::InterpreterThunk)),
     86        adoptRef(new DirectJITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_eval_prologue), JITCode::InterpreterThunk)),
    8687        MacroAssemblerCodePtr());
    87 #endif
    8888}
    8989
    9090static void setProgramEntrypoint(VM& vm, CodeBlock* codeBlock)
    9191{
    92     if (!vm.canUseJIT()) {
     92#if ENABLE(JIT)
     93    if (vm.canUseJIT()) {
    9394        codeBlock->setJITCode(
    94             adoptRef(new DirectJITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_program_prologue), JITCode::InterpreterThunk)),
     95            adoptRef(new DirectJITCode(vm.getCTIStub(programEntryThunkGenerator), JITCode::InterpreterThunk)),
    9596            MacroAssemblerCodePtr());
    9697        return;
    9798    }
    98 #if ENABLE(JIT)
     99#endif // ENABLE(JIT)
     100
     101    UNUSED_PARAM(vm);
    99102    codeBlock->setJITCode(
    100         adoptRef(new DirectJITCode(vm.getCTIStub(programEntryThunkGenerator), JITCode::InterpreterThunk)),
     103        adoptRef(new DirectJITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_program_prologue), JITCode::InterpreterThunk)),
    101104        MacroAssemblerCodePtr());
    102 #endif
    103105}
    104106
  • trunk/Source/JavaScriptCore/llint/LLIntOpcode.h

    r127374 r160186  
    11/*
    2  * Copyright (C) 2012 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3535#define FOR_EACH_LLINT_NOJIT_NATIVE_HELPER(macro) \
    3636    macro(getHostCallReturnValue, 1) \
    37     macro(ctiOpThrowNotCaught, 1)
     37    macro(returnFromJavaScript, 1)
    3838
    3939#else // !ENABLE(LLINT_C_LOOP)
  • trunk/Source/JavaScriptCore/llint/LLIntThunks.cpp

    r160003 r160186  
    11/*
    2  * Copyright (C) 2012 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2727#include "LLIntThunks.h"
    2828
    29 #if ENABLE(LLINT) && ENABLE(JIT)
    30 
     29#include "CallData.h"
     30#include "ExceptionHelpers.h"
     31#include "Interpreter.h"
    3132#include "JSInterfaceJIT.h"
    3233#include "JSObject.h"
     34#include "JSStackInlines.h"
     35#include "LLIntCLoop.h"
    3336#include "LinkBuffer.h"
    3437#include "LowLevelInterpreter.h"
     38#include "ProtoCallFrame.h"
     39#include "VM.h"
    3540
     41namespace JSC {
    3642
    37 namespace JSC { namespace LLInt {
     43#if ENABLE(JIT)
     44#if ENABLE(LLINT)
     45
     46namespace LLInt {
    3847
    3948static MacroAssemblerCodeRef generateThunkWithJumpTo(VM* vm, void (*target)(), const char *thunkKind)
     
    7988}
    8089
    81 } } // namespace JSC::LLInt
     90} // namespace LLInt
    8291
    83 #endif // ENABLE(LLINT) && ENABLE(JIT)
     92#endif // ENABLE(LLINT)
     93#else // ENABLE(JIT)
     94
     95// Non-JIT (i.e. C Loop LLINT) case:
     96
     97typedef JSValue (*ExecuteCode) (CallFrame*, void* executableAddress);
     98
     99template<ExecuteCode execute>
     100EncodedJSValue doCallToJavaScript(void* executableAddress, ProtoCallFrame* protoCallFrame)
     101{
     102    CodeBlock* codeBlock = protoCallFrame->codeBlock();
     103    JSScope* scope = protoCallFrame->scope();
     104    JSObject* callee = protoCallFrame->callee();
     105    int argCountIncludingThis = protoCallFrame->argumentCountIncludingThis();
     106    int argCount = protoCallFrame->argumentCount();
     107    JSValue thisValue = protoCallFrame->thisValue();
     108    JSStack& stack = scope->vm()->interpreter->stack();
     109
     110    CallFrame* newCallFrame = stack.pushFrame(codeBlock, scope, argCountIncludingThis, callee);
     111    if (UNLIKELY(!newCallFrame)) {
     112        JSGlobalObject* globalObject = scope->globalObject();
     113        ExecState* exec = globalObject->globalExec();
     114        return JSValue::encode(throwStackOverflowError(exec));
     115    }
     116
     117    // Set the arguments for the callee:
     118    newCallFrame->setThisValue(thisValue);
     119    for (int i = 0; i < argCount; ++i)
     120        newCallFrame->setArgument(i, protoCallFrame->argument(i));
     121
     122    JSValue result = execute(newCallFrame, executableAddress);
     123
     124    stack.popFrame(newCallFrame);
     125
     126    return JSValue::encode(result);
     127}
     128
     129static inline JSValue executeJS(CallFrame* newCallFrame, void* executableAddress)
     130{
     131    Opcode entryOpcode = *reinterpret_cast<Opcode*>(&executableAddress);
     132    return CLoop::execute(newCallFrame, entryOpcode);
     133}
     134
     135EncodedJSValue callToJavaScript(void* executableAddress, ExecState**, ProtoCallFrame* protoCallFrame, Register*)
     136{
     137    return doCallToJavaScript<executeJS>(executableAddress, protoCallFrame);
     138}
     139
     140static inline JSValue executeNative(CallFrame* newCallFrame, void* executableAddress)
     141{
     142    NativeFunction function = reinterpret_cast<NativeFunction>(executableAddress);
     143    return JSValue::decode(function(newCallFrame));
     144}
     145
     146EncodedJSValue callToNativeFunction(void* executableAddress, ExecState**, ProtoCallFrame* protoCallFrame, Register*)
     147{
     148    return doCallToJavaScript<executeNative>(executableAddress, protoCallFrame);
     149}
     150
     151#endif // ENABLE(JIT)
     152
     153} // namespace JSC
  • trunk/Source/JavaScriptCore/llint/LLIntThunks.h

    r160094 r160186  
    11/*
    2  * Copyright (C) 2012 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4242extern "C" {
    4343    EncodedJSValue callToJavaScript(void*, ExecState**, ProtoCallFrame*, Register*);
     44    EncodedJSValue callToNativeFunction(void*, ExecState**, ProtoCallFrame*, Register*);
     45#if ENABLE(JIT)
    4446    void returnFromJavaScript();
    45     EncodedJSValue callToNativeFunction(void*, ExecState**, ProtoCallFrame*, Register*);
     47#endif
    4648}
    4749
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp

    r160062 r160186  
    238238//
    239239
    240 JSValue CLoop::execute(CallFrame* callFrame, OpcodeID bootstrapOpcodeId,
    241                        bool isInitializationPass)
     240JSValue CLoop::execute(CallFrame* callFrame, Opcode entryOpcode, bool isInitializationPass)
    242241{
    243242    #define CAST reinterpret_cast
     
    353352    Opcode opcode;
    354353
    355     opcode = LLInt::getOpcode(bootstrapOpcodeId);
     354    opcode = entryOpcode;
    356355
    357356    #if ENABLE(OPCODE_STATS)
     
    433432        }
    434433
    435         OFFLINE_ASM_GLUE_LABEL(ctiOpThrowNotCaught)
     434        OFFLINE_ASM_GLUE_LABEL(returnFromJavaScript)
    436435        {
    437436            return vm->exception();
  • trunk/Source/JavaScriptCore/runtime/Executable.h

    r159795 r160186  
    3737#include "JITCode.h"
    3838#include "JSGlobalObject.h"
    39 #include "LLIntCLoop.h"
    4039#include "SamplingTool.h"
    4140#include "SourceCode.h"
     
    127126    static void clearCodeVirtual(ExecutableBase*);
    128127
    129 #if ENABLE(JIT)
    130128    PassRefPtr<JITCode> generatedJITCodeForCall()
    131129    {
     
    185183        return OBJECT_OFFSETOF(ExecutableBase, m_numParametersForConstruct);
    186184    }
    187 #endif // ENABLE(JIT)
    188185
    189186    bool hasJITCodeForCall() const
     
    215212    }
    216213       
    217 #if ENABLE(JIT) || ENABLE(LLINT_C_LOOP)
    218214    MacroAssemblerCodePtr hostCodeEntryFor(CodeSpecializationKind kind)
    219215    {
    220 #if ENABLE(JIT)
    221216        return generatedJITCodeFor(kind)->addressForCall();
    222 #else
    223         return LLInt::CLoop::hostCodeEntryFor(kind);
    224 #endif
    225217    }
    226218
    227219    MacroAssemblerCodePtr jsCodeEntryFor(CodeSpecializationKind kind)
    228220    {
    229 #if ENABLE(JIT)
    230221        return generatedJITCodeFor(kind)->addressForCall();
    231 #else
    232         return LLInt::CLoop::jsCodeEntryFor(kind);
    233 #endif
    234222    }
    235223
    236224    MacroAssemblerCodePtr jsCodeWithArityCheckEntryFor(CodeSpecializationKind kind)
    237225    {
    238 #if ENABLE(JIT)
    239226        return generatedJITCodeWithArityCheckFor(kind);
    240 #else
    241         return LLInt::CLoop::jsCodeEntryWithArityCheckFor(kind);
    242 #endif
    243     }
    244 
    245     static void* catchRoutineFor(HandlerInfo* handler, Instruction* catchPCForInterpreter)
    246     {
    247 #if ENABLE(JIT)
    248         UNUSED_PARAM(catchPCForInterpreter);
    249         return handler->nativeCode.executableAddress();
    250 #else
    251         UNUSED_PARAM(handler);
    252         return LLInt::CLoop::catchRoutineFor(catchPCForInterpreter);
    253 #endif
    254     }
    255    
    256 #endif // ENABLE(JIT || ENABLE(LLINT_C_LOOP)
     227    }
    257228
    258229protected:
     
    272243    typedef ExecutableBase Base;
    273244
    274 #if ENABLE(JIT)
    275245    static NativeExecutable* create(VM& vm, MacroAssemblerCodeRef callThunk, NativeFunction function, MacroAssemblerCodeRef constructThunk, NativeFunction constructor, Intrinsic intrinsic)
    276246    {
    277247        NativeExecutable* executable;
    278         if (!callThunk) {
    279             executable = new (NotNull, allocateCell<NativeExecutable>(vm.heap)) NativeExecutable(vm, function, constructor);
     248        executable = new (NotNull, allocateCell<NativeExecutable>(vm.heap)) NativeExecutable(vm, function, constructor);
     249        if (!callThunk)
    280250            executable->finishCreation(vm, 0, 0, intrinsic);
    281         } else {
    282             executable = new (NotNull, allocateCell<NativeExecutable>(vm.heap)) NativeExecutable(vm, function, constructor);
     251        else
    283252            executable->finishCreation(vm, JITCode::hostFunction(callThunk), JITCode::hostFunction(constructThunk), intrinsic);
    284         }
    285253        return executable;
    286254    }
    287 #endif
    288 
    289 #if ENABLE(LLINT_C_LOOP)
    290     static NativeExecutable* create(VM& vm, NativeFunction function, NativeFunction constructor)
    291     {
    292         ASSERT(!vm.canUseJIT());
    293         NativeExecutable* executable = new (NotNull, allocateCell<NativeExecutable>(vm.heap)) NativeExecutable(vm, function, constructor);
    294         executable->finishCreation(vm);
    295         return executable;
    296     }
    297 #endif
    298255
    299256#if ENABLE(JIT)
     
    329286
    330287protected:
    331 #if ENABLE(JIT)
    332288    void finishCreation(VM& vm, PassRefPtr<JITCode> callThunk, PassRefPtr<JITCode> constructThunk, Intrinsic intrinsic)
    333289    {
     
    339295        m_intrinsic = intrinsic;
    340296    }
    341 #endif
    342297
    343298private:
     
    471426    static EvalExecutable* create(ExecState*, const SourceCode&, bool isInStrictContext);
    472427
    473 #if ENABLE(JIT)
    474428    PassRefPtr<JITCode> generatedJITCode()
    475429    {
    476430        return generatedJITCodeForCall();
    477431    }
    478 #endif
     432
    479433    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto)
    480434    {
     
    528482    JSObject* checkSyntax(ExecState*);
    529483
    530 #if ENABLE(JIT)
    531484    PassRefPtr<JITCode> generatedJITCode()
    532485    {
    533486        return generatedJITCodeForCall();
    534487    }
    535 #endif
    536488       
    537489    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto)
  • trunk/Source/JavaScriptCore/runtime/JSArray.cpp

    r160094 r160186  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2003, 2007, 2008, 2009, 2012 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2003, 2007, 2008, 2009, 2012, 2013 Apple Inc. All rights reserved.
    44 *  Copyright (C) 2003 Peter Kelly (pmk@post.com)
    55 *  Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
     
    13211321            m_cachedCall->setArgument(0, va);
    13221322            m_cachedCall->setArgument(1, vb);
    1323 #if ENABLE(LLINT_C_LOOP)
    1324             compareResult = m_cachedCall->call().toNumber(m_cachedCall->newCallFrame(m_exec));
    1325 #else
    13261323            compareResult = m_cachedCall->call().toNumber(m_exec);
    1327 #endif
    13281324        } else {
    13291325            MarkedArgumentBuffer arguments;
  • trunk/Source/JavaScriptCore/runtime/StringPrototype.cpp

    r160094 r160186  
    505505                cachedCall.setThis(jsUndefined());
    506506                JSValue jsResult = cachedCall.call();
    507 #if ENABLE(LLINT_C_LOOP)
    508                 replacements.append(jsResult.toString(cachedCall.newCallFrame(exec))->value(exec));
    509 #else
    510507                replacements.append(jsResult.toString(exec)->value(exec));
    511 #endif
    512508                if (exec->hadException())
    513509                    break;
     
    548544                cachedCall.setThis(jsUndefined());
    549545                JSValue jsResult = cachedCall.call();
    550 #if ENABLE(LLINT_C_LOOP)
    551                 replacements.append(jsResult.toString(cachedCall.newCallFrame(exec))->value(exec));
    552 #else
    553546                replacements.append(jsResult.toString(exec)->value(exec));
    554 #endif
    555547                if (exec->hadException())
    556548                    break;
  • trunk/Source/JavaScriptCore/runtime/VM.cpp

    r160150 r160186  
    457457
    458458#else // !ENABLE(JIT)
     459
    459460NativeExecutable* VM::getHostFunction(NativeFunction function, NativeFunction constructor)
    460461{
    461     return NativeExecutable::create(*this, function, constructor);
    462 }
     462    return NativeExecutable::create(*this,
     463        MacroAssemblerCodeRef::createLLIntCodeRef(llint_native_call_trampoline), function,
     464        MacroAssemblerCodeRef::createLLIntCodeRef(llint_native_construct_trampoline), constructor,
     465        NoIntrinsic);
     466}
     467
    463468#endif // !ENABLE(JIT)
    464469
Note: See TracChangeset for help on using the changeset viewer.