Ignore:
Timestamp:
Feb 22, 2009, 3:26:07 PM (16 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2009-02-22 Geoffrey Garen <[email protected]>

Reviewed by Sam Weinig.

Next step in splitting JIT functionality out of the Interpreter class:
Created a JITStubs class and renamed Interpreter::cti_* to JITStubs::cti_*.


Also, moved timeout checking into its own class, located in JSGlobalData,
so both the Interpreter and the JIT could have access to it.

  • JavaScriptCore.exp:
  • JavaScriptCore.pri:
  • JavaScriptCore.scons:
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • JavaScriptCoreSources.bkl:
  • interpreter/CallFrame.h:
  • interpreter/Interpreter.cpp: (JSC::Interpreter::Interpreter): (JSC::Interpreter::privateExecute):
  • interpreter/Interpreter.h:
  • interpreter/Register.h:
  • jit/JIT.cpp: (JSC::): (JSC::JIT::emitTimeoutCheck): (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): (JSC::JIT::privateCompileCTIMachineTrampolines):
  • jit/JIT.h:
  • jit/JITArithmetic.cpp: (JSC::JIT::compileFastArithSlow_op_lshift): (JSC::JIT::compileFastArithSlow_op_rshift): (JSC::JIT::compileFastArithSlow_op_bitand): (JSC::JIT::compileFastArithSlow_op_mod): (JSC::JIT::compileFastArith_op_mod): (JSC::JIT::compileFastArithSlow_op_post_inc): (JSC::JIT::compileFastArithSlow_op_post_dec): (JSC::JIT::compileFastArithSlow_op_pre_inc): (JSC::JIT::compileFastArithSlow_op_pre_dec): (JSC::JIT::compileFastArith_op_add): (JSC::JIT::compileFastArith_op_mul): (JSC::JIT::compileFastArith_op_sub): (JSC::JIT::compileBinaryArithOpSlowCase): (JSC::JIT::compileFastArithSlow_op_add): (JSC::JIT::compileFastArithSlow_op_mul):
  • jit/JITCall.cpp: (JSC::JIT::compileOpCall): (JSC::JIT::compileOpCallSlowCase):
  • jit/JITPropertyAccess.cpp: (JSC::JIT::compileGetByIdHotPath): (JSC::JIT::compilePutByIdHotPath): (JSC::JIT::compileGetByIdSlowCase): (JSC::JIT::compilePutByIdSlowCase): (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::patchGetByIdSelf): (JSC::JIT::patchPutByIdReplace): (JSC::JIT::privateCompilePatchGetArrayLength): (JSC::JIT::privateCompileGetByIdSelf): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdChain): (JSC::JIT::privateCompilePutByIdReplace):
  • jit/JITStubs.cpp: (JSC::JITStubs::tryCachePutByID): (JSC::JITStubs::tryCacheGetByID): (JSC::JITStubs::cti_op_convert_this): (JSC::JITStubs::cti_op_end): (JSC::JITStubs::cti_op_add): (JSC::JITStubs::cti_op_pre_inc): (JSC::JITStubs::cti_timeout_check): (JSC::JITStubs::cti_register_file_check): (JSC::JITStubs::cti_op_loop_if_less): (JSC::JITStubs::cti_op_loop_if_lesseq): (JSC::JITStubs::cti_op_new_object): (JSC::JITStubs::cti_op_put_by_id_generic): (JSC::JITStubs::cti_op_get_by_id_generic): (JSC::JITStubs::cti_op_put_by_id): (JSC::JITStubs::cti_op_put_by_id_second): (JSC::JITStubs::cti_op_put_by_id_fail): (JSC::JITStubs::cti_op_get_by_id): (JSC::JITStubs::cti_op_get_by_id_second): (JSC::JITStubs::cti_op_get_by_id_self_fail): (JSC::JITStubs::cti_op_get_by_id_proto_list): (JSC::JITStubs::cti_op_get_by_id_proto_list_full): (JSC::JITStubs::cti_op_get_by_id_proto_fail): (JSC::JITStubs::cti_op_get_by_id_array_fail): (JSC::JITStubs::cti_op_get_by_id_string_fail): (JSC::JITStubs::cti_op_instanceof): (JSC::JITStubs::cti_op_del_by_id): (JSC::JITStubs::cti_op_mul): (JSC::JITStubs::cti_op_new_func): (JSC::JITStubs::cti_op_call_JSFunction): (JSC::JITStubs::cti_op_call_arityCheck): (JSC::JITStubs::cti_vm_dontLazyLinkCall): (JSC::JITStubs::cti_vm_lazyLinkCall): (JSC::JITStubs::cti_op_push_activation): (JSC::JITStubs::cti_op_call_NotJSFunction): (JSC::JITStubs::cti_op_create_arguments): (JSC::JITStubs::cti_op_create_arguments_no_params): (JSC::JITStubs::cti_op_tear_off_activation): (JSC::JITStubs::cti_op_tear_off_arguments): (JSC::JITStubs::cti_op_profile_will_call): (JSC::JITStubs::cti_op_profile_did_call): (JSC::JITStubs::cti_op_ret_scopeChain): (JSC::JITStubs::cti_op_new_array): (JSC::JITStubs::cti_op_resolve): (JSC::JITStubs::cti_op_construct_JSConstruct): (JSC::JITStubs::cti_op_construct_NotJSConstruct): (JSC::JITStubs::cti_op_get_by_val): (JSC::JITStubs::cti_op_get_by_val_byte_array): (JSC::JITStubs::cti_op_resolve_func): (JSC::JITStubs::cti_op_sub): (JSC::JITStubs::cti_op_put_by_val): (JSC::JITStubs::cti_op_put_by_val_array): (JSC::JITStubs::cti_op_put_by_val_byte_array): (JSC::JITStubs::cti_op_lesseq): (JSC::JITStubs::cti_op_loop_if_true): (JSC::JITStubs::cti_op_negate): (JSC::JITStubs::cti_op_resolve_base): (JSC::JITStubs::cti_op_resolve_skip): (JSC::JITStubs::cti_op_resolve_global): (JSC::JITStubs::cti_op_div): (JSC::JITStubs::cti_op_pre_dec): (JSC::JITStubs::cti_op_jless): (JSC::JITStubs::cti_op_not): (JSC::JITStubs::cti_op_jtrue): (JSC::JITStubs::cti_op_post_inc): (JSC::JITStubs::cti_op_eq): (JSC::JITStubs::cti_op_lshift): (JSC::JITStubs::cti_op_bitand): (JSC::JITStubs::cti_op_rshift): (JSC::JITStubs::cti_op_bitnot): (JSC::JITStubs::cti_op_resolve_with_base): (JSC::JITStubs::cti_op_new_func_exp): (JSC::JITStubs::cti_op_mod): (JSC::JITStubs::cti_op_less): (JSC::JITStubs::cti_op_neq): (JSC::JITStubs::cti_op_post_dec): (JSC::JITStubs::cti_op_urshift): (JSC::JITStubs::cti_op_bitxor): (JSC::JITStubs::cti_op_new_regexp): (JSC::JITStubs::cti_op_bitor): (JSC::JITStubs::cti_op_call_eval): (JSC::JITStubs::cti_op_throw): (JSC::JITStubs::cti_op_get_pnames): (JSC::JITStubs::cti_op_next_pname): (JSC::JITStubs::cti_op_push_scope): (JSC::JITStubs::cti_op_pop_scope): (JSC::JITStubs::cti_op_typeof): (JSC::JITStubs::cti_op_is_undefined): (JSC::JITStubs::cti_op_is_boolean): (JSC::JITStubs::cti_op_is_number): (JSC::JITStubs::cti_op_is_string): (JSC::JITStubs::cti_op_is_object): (JSC::JITStubs::cti_op_is_function): (JSC::JITStubs::cti_op_stricteq): (JSC::JITStubs::cti_op_nstricteq): (JSC::JITStubs::cti_op_to_jsnumber): (JSC::JITStubs::cti_op_in): (JSC::JITStubs::cti_op_push_new_scope): (JSC::JITStubs::cti_op_jmp_scopes): (JSC::JITStubs::cti_op_put_by_index): (JSC::JITStubs::cti_op_switch_imm): (JSC::JITStubs::cti_op_switch_char): (JSC::JITStubs::cti_op_switch_string): (JSC::JITStubs::cti_op_del_by_val): (JSC::JITStubs::cti_op_put_getter): (JSC::JITStubs::cti_op_put_setter): (JSC::JITStubs::cti_op_new_error): (JSC::JITStubs::cti_op_debug): (JSC::JITStubs::cti_vm_throw):
  • jit/JITStubs.h: (JSC::):
  • runtime/JSFunction.h:
  • runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData):
  • runtime/JSGlobalData.h:
  • runtime/JSGlobalObject.cpp:
  • runtime/JSGlobalObject.h:
  • runtime/TimeoutChecker.cpp: Copied from interpreter/Interpreter.cpp. (JSC::TimeoutChecker::TimeoutChecker): (JSC::TimeoutChecker::reset): (JSC::TimeoutChecker::didTimeOut):
  • runtime/TimeoutChecker.h: Copied from interpreter/Interpreter.h. (JSC::TimeoutChecker::setTimeoutInterval): (JSC::TimeoutChecker::ticksUntilNextCheck): (JSC::TimeoutChecker::start): (JSC::TimeoutChecker::stop):

WebCore:

2009-02-20 Geoffrey Garen <[email protected]>

Reviewed by Sam Weinig.

Updated for JavaScriptCore changes to timeout checking.

  • bindings/js/JSCustomPositionCallback.cpp: (WebCore::JSCustomPositionCallback::handleEvent):
  • bindings/js/JSCustomPositionErrorCallback.cpp: (WebCore::JSCustomPositionErrorCallback::handleEvent):
  • bindings/js/JSCustomSQLStatementCallback.cpp: (WebCore::JSCustomSQLStatementCallback::handleEvent):
  • bindings/js/JSCustomSQLStatementErrorCallback.cpp: (WebCore::JSCustomSQLStatementErrorCallback::handleEvent):
  • bindings/js/JSCustomSQLTransactionCallback.cpp: (WebCore::JSCustomSQLTransactionCallback::handleEvent):
  • bindings/js/JSCustomSQLTransactionErrorCallback.cpp: (WebCore::JSCustomSQLTransactionErrorCallback::handleEvent):
  • bindings/js/JSCustomVoidCallback.cpp: (WebCore::JSCustomVoidCallback::handleEvent):
  • bindings/js/JSCustomXPathNSResolver.cpp: (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
  • bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::JSDOMWindowBase): (WebCore::JSDOMWindowBase::commonJSGlobalData):
  • bindings/js/JSEventListener.cpp: (WebCore::JSAbstractEventListener::handleEvent):
  • bindings/js/ScheduledAction.cpp: (WebCore::ScheduledAction::executeFunctionInContext):
  • bindings/js/ScriptController.cpp: (WebCore::ScriptController::evaluate):
  • bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::evaluate): (WebCore::WorkerScriptController::forbidExecution):
  • bindings/objc/WebScriptObject.mm: (-[WebScriptObject callWebScriptMethod:withArguments:]): (-[WebScriptObject evaluateWebScript:]):
  • bridge/NP_jsobject.cpp: (_NPN_InvokeDefault): (_NPN_Invoke): (_NPN_Evaluate): (_NPN_Construct):
  • bridge/jni/jni_jsobject.mm: (JavaJSObject::call): (JavaJSObject::eval):
File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/TimeoutChecker.h

    r41100 r41126  
    2727 */
    2828
    29 #ifndef Interpreter_h
    30 #define Interpreter_h
     29#ifndef TimeoutChecker_h
     30#define TimeoutChecker_h
    3131
    32 #include "ArgList.h"
    33 #include "JSCell.h"
    34 #include "JSValue.h"
    35 #include "JSObject.h"
    36 #include "Opcode.h"
    37 #include "RegisterFile.h"
    38 #include <wtf/HashMap.h>
     32#include <wtf/Assertions.h>
    3933
    4034namespace JSC {
    4135
    42     class CodeBlock;
    43     class EvalNode;
    44     class FunctionBodyNode;
    45     class Instruction;
    46     class InternalFunction;
    47     class AssemblerBuffer;
    48     class JSFunction;
    49     class JSGlobalObject;
    50     class ProgramNode;
    51     class Register;
    52     class ScopeChainNode;
    53     class SamplingTool;
    54     struct HandlerInfo;
     36    class ExecState;
    5537
    56 #if ENABLE(JIT)
     38    class TimeoutChecker {
     39    public:
     40        TimeoutChecker();
    5741
    58 #if USE(JIT_STUB_ARGUMENT_VA_LIST)
    59     #define STUB_ARGS void* args, ...
    60     #define ARGS (reinterpret_cast<void**>(vl_args) - 1)
    61 #else // JIT_STUB_ARGUMENT_REGISTER or JIT_STUB_ARGUMENT_STACK
    62     #define STUB_ARGS void** args
    63     #define ARGS (args)
    64 #endif
    65 
    66 #if USE(JIT_STUB_ARGUMENT_REGISTER)
    67     #if PLATFORM(X86_64)
    68     #define JIT_STUB
    69     #elif COMPILER(MSVC)
    70     #define JIT_STUB __fastcall
    71     #elif COMPILER(GCC)
    72     #define JIT_STUB  __attribute__ ((fastcall))
    73     #else
    74     #error Need to support register calling convention in this compiler
    75     #endif
    76 #else // JIT_STUB_ARGUMENT_VA_LIST or JIT_STUB_ARGUMENT_STACK
    77     #if COMPILER(MSVC)
    78     #define JIT_STUB __cdecl
    79     #else
    80     #define JIT_STUB
    81     #endif
    82 #endif
    83 
    84 // The Mac compilers are fine with this,
    85 #if PLATFORM(MAC)
    86     struct VoidPtrPair {
    87         void* first;
    88         void* second;
    89     };
    90 #define RETURN_PAIR(a,b) VoidPtrPair pair = { a, b }; return pair
    91 #else
    92     typedef uint64_t VoidPtrPair;
    93     union VoidPtrPairValue {
    94         struct { void* first; void* second; } s;
    95         VoidPtrPair i;
    96     };
    97 #define RETURN_PAIR(a,b) VoidPtrPairValue pair = {{ a, b }}; return pair.i
    98 #endif
    99 
    100 #endif // ENABLE(JIT)
    101 
    102     enum DebugHookID {
    103         WillExecuteProgram,
    104         DidExecuteProgram,
    105         DidEnterCallFrame,
    106         DidReachBreakpoint,
    107         WillLeaveCallFrame,
    108         WillExecuteStatement
    109     };
    110 
    111     enum { MaxReentryDepth = 128 };
    112 
    113     class Interpreter {
    114         friend class JIT;
    115     public:
    116         Interpreter();
    117         ~Interpreter();
    118 
    119         void initialize(JSGlobalData*);
     42        void setTimeoutInterval(unsigned timeoutInterval) { m_timeoutInterval = timeoutInterval; }
    12043       
    121         RegisterFile& registerFile() { return m_registerFile; }
     44        unsigned ticksUntilNextCheck() { return m_ticksUntilNextCheck; }
    12245       
    123         Opcode getOpcode(OpcodeID id)
     46        void start()
    12447        {
    125             #if HAVE(COMPUTED_GOTO)
    126                 return m_opcodeTable[id];
    127             #else
    128                 return id;
    129             #endif
     48            if (!m_startCount)
     49                reset();
     50            ++m_startCount;
    13051        }
    13152
    132         OpcodeID getOpcodeID(Opcode opcode)
     53        void stop()
    13354        {
    134             #if HAVE(COMPUTED_GOTO)
    135                 ASSERT(isOpcode(opcode));
    136                 return m_opcodeIDTable.get(opcode);
    137             #else
    138                 return opcode;
    139             #endif
     55            ASSERT(m_startCount);
     56            --m_startCount;
    14057        }
    14158
    142         bool isOpcode(Opcode);
    143        
    144         JSValuePtr execute(ProgramNode*, CallFrame*, ScopeChainNode*, JSObject* thisObj, JSValuePtr* exception);
    145         JSValuePtr execute(FunctionBodyNode*, CallFrame*, JSFunction*, JSObject* thisObj, const ArgList& args, ScopeChainNode*, JSValuePtr* exception);
    146         JSValuePtr execute(EvalNode* evalNode, CallFrame* exec, JSObject* thisObj, ScopeChainNode* scopeChain, JSValuePtr* exception);
     59        void reset();
    14760
    148         JSValuePtr retrieveArguments(CallFrame*, JSFunction*) const;
    149         JSValuePtr retrieveCaller(CallFrame*, InternalFunction*) const;
    150         void retrieveLastCaller(CallFrame*, int& lineNumber, intptr_t& sourceID, UString& sourceURL, JSValuePtr& function) const;
    151        
    152         void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc);
    153         void setTimeoutTime(unsigned timeoutTime) { m_timeoutTime = timeoutTime; }
    154        
    155         void startTimeoutCheck()
    156         {
    157             if (!m_timeoutCheckCount)
    158                 resetTimeoutCheck();
    159            
    160             ++m_timeoutCheckCount;
    161         }
    162        
    163         void stopTimeoutCheck()
    164         {
    165             ASSERT(m_timeoutCheckCount);
    166             --m_timeoutCheckCount;
    167         }
    168 
    169         inline void initTimeout()
    170         {
    171             ASSERT(!m_timeoutCheckCount);
    172             resetTimeoutCheck();
    173             m_timeoutTime = 0;
    174             m_timeoutCheckCount = 0;
    175         }
    176 
    177         void setSampler(SamplingTool* sampler) { m_sampler = sampler; }
    178         SamplingTool* sampler() { return m_sampler; }
    179 
    180 #if ENABLE(JIT)
    181 
    182         static int JIT_STUB cti_timeout_check(STUB_ARGS);
    183         static void JIT_STUB cti_register_file_check(STUB_ARGS);
    184 
    185         static JSObject* JIT_STUB cti_op_convert_this(STUB_ARGS);
    186         static void JIT_STUB cti_op_end(STUB_ARGS);
    187         static JSValueEncodedAsPointer* JIT_STUB cti_op_add(STUB_ARGS);
    188         static JSValueEncodedAsPointer* JIT_STUB cti_op_pre_inc(STUB_ARGS);
    189         static int JIT_STUB cti_op_loop_if_less(STUB_ARGS);
    190         static int JIT_STUB cti_op_loop_if_lesseq(STUB_ARGS);
    191         static JSObject* JIT_STUB cti_op_new_object(STUB_ARGS);
    192         static void JIT_STUB cti_op_put_by_id(STUB_ARGS);
    193         static void JIT_STUB cti_op_put_by_id_second(STUB_ARGS);
    194         static void JIT_STUB cti_op_put_by_id_generic(STUB_ARGS);
    195         static void JIT_STUB cti_op_put_by_id_fail(STUB_ARGS);
    196         static JSValueEncodedAsPointer* JIT_STUB cti_op_get_by_id(STUB_ARGS);
    197         static JSValueEncodedAsPointer* JIT_STUB cti_op_get_by_id_second(STUB_ARGS);
    198         static JSValueEncodedAsPointer* JIT_STUB cti_op_get_by_id_generic(STUB_ARGS);
    199         static JSValueEncodedAsPointer* JIT_STUB cti_op_get_by_id_self_fail(STUB_ARGS);
    200         static JSValueEncodedAsPointer* JIT_STUB cti_op_get_by_id_proto_list(STUB_ARGS);
    201         static JSValueEncodedAsPointer* JIT_STUB cti_op_get_by_id_proto_list_full(STUB_ARGS);
    202         static JSValueEncodedAsPointer* JIT_STUB cti_op_get_by_id_proto_fail(STUB_ARGS);
    203         static JSValueEncodedAsPointer* JIT_STUB cti_op_get_by_id_array_fail(STUB_ARGS);
    204         static JSValueEncodedAsPointer* JIT_STUB cti_op_get_by_id_string_fail(STUB_ARGS);
    205         static JSValueEncodedAsPointer* JIT_STUB cti_op_del_by_id(STUB_ARGS);
    206         static JSValueEncodedAsPointer* JIT_STUB cti_op_instanceof(STUB_ARGS);
    207         static JSValueEncodedAsPointer* JIT_STUB cti_op_mul(STUB_ARGS);
    208         static JSObject* JIT_STUB cti_op_new_func(STUB_ARGS);
    209         static void* JIT_STUB cti_op_call_JSFunction(STUB_ARGS);
    210         static VoidPtrPair JIT_STUB cti_op_call_arityCheck(STUB_ARGS);
    211         static JSValueEncodedAsPointer* JIT_STUB cti_op_call_NotJSFunction(STUB_ARGS);
    212         static void JIT_STUB cti_op_create_arguments(STUB_ARGS);
    213         static void JIT_STUB cti_op_create_arguments_no_params(STUB_ARGS);
    214         static void JIT_STUB cti_op_tear_off_activation(STUB_ARGS);
    215         static void JIT_STUB cti_op_tear_off_arguments(STUB_ARGS);
    216         static void JIT_STUB cti_op_profile_will_call(STUB_ARGS);
    217         static void JIT_STUB cti_op_profile_did_call(STUB_ARGS);
    218         static void JIT_STUB cti_op_ret_scopeChain(STUB_ARGS);
    219         static JSObject* JIT_STUB cti_op_new_array(STUB_ARGS);
    220         static JSValueEncodedAsPointer* JIT_STUB cti_op_resolve(STUB_ARGS);
    221         static JSValueEncodedAsPointer* JIT_STUB cti_op_resolve_global(STUB_ARGS);
    222         static JSObject* JIT_STUB cti_op_construct_JSConstruct(STUB_ARGS);
    223         static JSValueEncodedAsPointer* JIT_STUB cti_op_construct_NotJSConstruct(STUB_ARGS);
    224         static JSValueEncodedAsPointer* JIT_STUB cti_op_get_by_val(STUB_ARGS);
    225         static JSValueEncodedAsPointer* JIT_STUB cti_op_get_by_val_byte_array(STUB_ARGS);
    226         static VoidPtrPair JIT_STUB cti_op_resolve_func(STUB_ARGS);
    227         static JSValueEncodedAsPointer* JIT_STUB cti_op_sub(STUB_ARGS);
    228         static void JIT_STUB cti_op_put_by_val(STUB_ARGS);
    229         static void JIT_STUB cti_op_put_by_val_array(STUB_ARGS);
    230         static void JIT_STUB cti_op_put_by_val_byte_array(STUB_ARGS);
    231         static JSValueEncodedAsPointer* JIT_STUB cti_op_lesseq(STUB_ARGS);
    232         static int JIT_STUB cti_op_loop_if_true(STUB_ARGS);
    233         static JSValueEncodedAsPointer* JIT_STUB cti_op_resolve_base(STUB_ARGS);
    234         static JSValueEncodedAsPointer* JIT_STUB cti_op_negate(STUB_ARGS);
    235         static JSValueEncodedAsPointer* JIT_STUB cti_op_resolve_skip(STUB_ARGS);
    236         static JSValueEncodedAsPointer* JIT_STUB cti_op_div(STUB_ARGS);
    237         static JSValueEncodedAsPointer* JIT_STUB cti_op_pre_dec(STUB_ARGS);
    238         static int JIT_STUB cti_op_jless(STUB_ARGS);
    239         static JSValueEncodedAsPointer* JIT_STUB cti_op_not(STUB_ARGS);
    240         static int JIT_STUB cti_op_jtrue(STUB_ARGS);
    241         static VoidPtrPair JIT_STUB cti_op_post_inc(STUB_ARGS);
    242         static JSValueEncodedAsPointer* JIT_STUB cti_op_eq(STUB_ARGS);
    243         static JSValueEncodedAsPointer* JIT_STUB cti_op_lshift(STUB_ARGS);
    244         static JSValueEncodedAsPointer* JIT_STUB cti_op_bitand(STUB_ARGS);
    245         static JSValueEncodedAsPointer* JIT_STUB cti_op_rshift(STUB_ARGS);
    246         static JSValueEncodedAsPointer* JIT_STUB cti_op_bitnot(STUB_ARGS);
    247         static VoidPtrPair JIT_STUB cti_op_resolve_with_base(STUB_ARGS);
    248         static JSObject* JIT_STUB cti_op_new_func_exp(STUB_ARGS);
    249         static JSValueEncodedAsPointer* JIT_STUB cti_op_mod(STUB_ARGS);
    250         static JSValueEncodedAsPointer* JIT_STUB cti_op_less(STUB_ARGS);
    251         static JSValueEncodedAsPointer* JIT_STUB cti_op_neq(STUB_ARGS);
    252         static VoidPtrPair JIT_STUB cti_op_post_dec(STUB_ARGS);
    253         static JSValueEncodedAsPointer* JIT_STUB cti_op_urshift(STUB_ARGS);
    254         static JSValueEncodedAsPointer* JIT_STUB cti_op_bitxor(STUB_ARGS);
    255         static JSObject* JIT_STUB cti_op_new_regexp(STUB_ARGS);
    256         static JSValueEncodedAsPointer* JIT_STUB cti_op_bitor(STUB_ARGS);
    257         static JSValueEncodedAsPointer* JIT_STUB cti_op_call_eval(STUB_ARGS);
    258         static JSValueEncodedAsPointer* JIT_STUB cti_op_throw(STUB_ARGS);
    259         static JSPropertyNameIterator* JIT_STUB cti_op_get_pnames(STUB_ARGS);
    260         static JSValueEncodedAsPointer* JIT_STUB cti_op_next_pname(STUB_ARGS);
    261         static JSObject* JIT_STUB cti_op_push_scope(STUB_ARGS);
    262         static void JIT_STUB cti_op_pop_scope(STUB_ARGS);
    263         static JSValueEncodedAsPointer* JIT_STUB cti_op_typeof(STUB_ARGS);
    264         static JSValueEncodedAsPointer* JIT_STUB cti_op_is_undefined(STUB_ARGS);
    265         static JSValueEncodedAsPointer* JIT_STUB cti_op_is_boolean(STUB_ARGS);
    266         static JSValueEncodedAsPointer* JIT_STUB cti_op_is_number(STUB_ARGS);
    267         static JSValueEncodedAsPointer* JIT_STUB cti_op_is_string(STUB_ARGS);
    268         static JSValueEncodedAsPointer* JIT_STUB cti_op_is_object(STUB_ARGS);
    269         static JSValueEncodedAsPointer* JIT_STUB cti_op_is_function(STUB_ARGS);
    270         static JSValueEncodedAsPointer* JIT_STUB cti_op_stricteq(STUB_ARGS);
    271         static JSValueEncodedAsPointer* JIT_STUB cti_op_nstricteq(STUB_ARGS);
    272         static JSValueEncodedAsPointer* JIT_STUB cti_op_to_jsnumber(STUB_ARGS);
    273         static JSValueEncodedAsPointer* JIT_STUB cti_op_in(STUB_ARGS);
    274         static JSObject* JIT_STUB cti_op_push_new_scope(STUB_ARGS);
    275         static void JIT_STUB cti_op_jmp_scopes(STUB_ARGS);
    276         static void JIT_STUB cti_op_put_by_index(STUB_ARGS);
    277         static void* JIT_STUB cti_op_switch_imm(STUB_ARGS);
    278         static void* JIT_STUB cti_op_switch_char(STUB_ARGS);
    279         static void* JIT_STUB cti_op_switch_string(STUB_ARGS);
    280         static JSValueEncodedAsPointer* JIT_STUB cti_op_del_by_val(STUB_ARGS);
    281         static void JIT_STUB cti_op_put_getter(STUB_ARGS);
    282         static void JIT_STUB cti_op_put_setter(STUB_ARGS);
    283         static JSObject* JIT_STUB cti_op_new_error(STUB_ARGS);
    284         static void JIT_STUB cti_op_debug(STUB_ARGS);
    285 
    286         static JSValueEncodedAsPointer* JIT_STUB cti_vm_throw(STUB_ARGS);
    287         static void* JIT_STUB cti_vm_dontLazyLinkCall(STUB_ARGS);
    288         static void* JIT_STUB cti_vm_lazyLinkCall(STUB_ARGS);
    289         static JSObject* JIT_STUB cti_op_push_activation(STUB_ARGS);
    290        
    291 #endif // ENABLE(JIT)
    292 
    293         // Default number of ticks before a timeout check should be done.
    294         static const int initialTickCountThreshold = 1024;
    295 
    296         bool isJSArray(JSValuePtr v) { return v.isCell() && v.asCell()->vptr() == m_jsArrayVptr; }
    297         bool isJSString(JSValuePtr v) { return v.isCell() && v.asCell()->vptr() == m_jsStringVptr; }
    298         bool isJSByteArray(JSValuePtr v) { return v.isCell() && v.asCell()->vptr() == m_jsByteArrayVptr; }
     61        bool didTimeOut(ExecState*);
    29962
    30063    private:
    301         enum ExecutionFlag { Normal, InitializeAndReturn };
    302 
    303         NEVER_INLINE JSValuePtr callEval(CallFrame*, RegisterFile*, Register* argv, int argc, int registerOffset, JSValuePtr& exceptionValue);
    304         JSValuePtr execute(EvalNode*, CallFrame*, JSObject* thisObject, int globalRegisterOffset, ScopeChainNode*, JSValuePtr* exception);
    305 
    306         NEVER_INLINE void debug(CallFrame*, DebugHookID, int firstLine, int lastLine);
    307 
    308         NEVER_INLINE bool resolve(CallFrame*, Instruction*, JSValuePtr& exceptionValue);
    309         NEVER_INLINE bool resolveSkip(CallFrame*, Instruction*, JSValuePtr& exceptionValue);
    310         NEVER_INLINE bool resolveGlobal(CallFrame*, Instruction*, JSValuePtr& exceptionValue);
    311         NEVER_INLINE void resolveBase(CallFrame*, Instruction* vPC);
    312         NEVER_INLINE bool resolveBaseAndProperty(CallFrame*, Instruction*, JSValuePtr& exceptionValue);
    313         NEVER_INLINE ScopeChainNode* createExceptionScope(CallFrame*, const Instruction* vPC);
    314 
    315         NEVER_INLINE bool unwindCallFrame(CallFrame*&, JSValuePtr, unsigned& bytecodeOffset, CodeBlock*&);
    316         NEVER_INLINE HandlerInfo* throwException(CallFrame*&, JSValuePtr&, unsigned bytecodeOffset, bool);
    317         NEVER_INLINE bool resolveBaseAndFunc(CallFrame*, Instruction*, JSValuePtr& exceptionValue);
    318 
    319         static ALWAYS_INLINE CallFrame* slideRegisterWindowForCall(CodeBlock*, RegisterFile*, CallFrame*, size_t registerOffset, int argc);
    320 
    321         static CallFrame* findFunctionCallFrame(CallFrame*, InternalFunction*);
    322 
    323         JSValuePtr privateExecute(ExecutionFlag, RegisterFile*, CallFrame*, JSValuePtr* exception);
    324 
    325         void dumpCallFrame(CallFrame*);
    326         void dumpRegisters(CallFrame*);
    327 
    328         bool checkTimeout(JSGlobalObject*);
    329         void resetTimeoutCheck();
    330 
    331         void tryCacheGetByID(CallFrame*, CodeBlock*, Instruction*, JSValuePtr baseValue, const Identifier& propertyName, const PropertySlot&);
    332         void uncacheGetByID(CodeBlock*, Instruction* vPC);
    333         void tryCachePutByID(CallFrame*, CodeBlock*, Instruction*, JSValuePtr baseValue, const PutPropertySlot&);
    334         void uncachePutByID(CodeBlock*, Instruction* vPC);
    335        
    336         bool isCallBytecode(Opcode opcode) { return opcode == getOpcode(op_call) || opcode == getOpcode(op_construct) || opcode == getOpcode(op_call_eval); }
    337 
    338 #if ENABLE(JIT)
    339         void tryCTICacheGetByID(CallFrame*, CodeBlock*, void* returnAddress, JSValuePtr baseValue, const Identifier& propertyName, const PropertySlot&);
    340         void tryCTICachePutByID(CallFrame*, CodeBlock*, void* returnAddress, JSValuePtr baseValue, const PutPropertySlot&);
    341 #endif
    342 
    343         SamplingTool* m_sampler;
    344 
    345 #if ENABLE(JIT)
    346         RefPtr<ExecutablePool> m_executablePool;
    347         void* m_ctiArrayLengthTrampoline;
    348         void* m_ctiStringLengthTrampoline;
    349         void* m_ctiVirtualCallPreLink;
    350         void* m_ctiVirtualCallLink;
    351         void* m_ctiVirtualCall;
    352 #endif
    353 
    354         int m_reentryDepth;
    355         unsigned m_timeoutTime;
    356         unsigned m_timeAtLastCheckTimeout;
     64        unsigned m_timeoutInterval;
     65        unsigned m_timeAtLastCheck;
    35766        unsigned m_timeExecuting;
    358         unsigned m_timeoutCheckCount;
    359         unsigned m_ticksUntilNextTimeoutCheck;
    360 
    361         RegisterFile m_registerFile;
    362        
    363         void* m_jsArrayVptr;
    364         void* m_jsByteArrayVptr;
    365         void* m_jsStringVptr;
    366         void* m_jsFunctionVptr;
    367 
    368 #if HAVE(COMPUTED_GOTO)
    369         Opcode m_opcodeTable[numOpcodeIDs]; // Maps OpcodeID => Opcode for compiling
    370         HashMap<Opcode, OpcodeID> m_opcodeIDTable; // Maps Opcode => OpcodeID for decompiling
    371 #endif
     67        unsigned m_startCount;
     68        unsigned m_ticksUntilNextCheck;
    37269    };
    37370
    37471} // namespace JSC
    37572
    376 #endif // Interpreter_h
     73#endif // TimeoutChecker_h
Note: See TracChangeset for help on using the changeset viewer.