| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 DidReachBreakpoint, | 60 DidReachBreakpoint, |
| 61 WillLeaveCallFrame, | 61 WillLeaveCallFrame, |
| 62 WillExecuteStatement | 62 WillExecuteStatement |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 enum { MaxReentryDepth = 128 }; | 65 enum { MaxReentryDepth = 128 }; |
| 66 | 66 |
| 67 class Interpreter { | 67 class Interpreter { |
| 68 friend class JIT; | 68 friend class JIT; |
| 69 friend class JITStubs; | 69 friend class JITStubs; |
| 70 |
| 70 public: | 71 public: |
| 71 Interpreter(); | 72 Interpreter(); |
| 72 ~Interpreter(); | |
| 73 | 73 |
| 74 void initialize(JSGlobalData*); | |
| 75 | |
| 76 RegisterFile& registerFile() { return m_registerFile; } | 74 RegisterFile& registerFile() { return m_registerFile; } |
| 77 | 75 |
| 78 Opcode getOpcode(OpcodeID id) | 76 Opcode getOpcode(OpcodeID id) |
| 79 { | 77 { |
| 80 #if HAVE(COMPUTED_GOTO) | 78 #if HAVE(COMPUTED_GOTO) |
| 81 return m_opcodeTable[id]; | 79 return m_opcodeTable[id]; |
| 82 #else | 80 #else |
| 83 return id; | 81 return id; |
| 84 #endif | 82 #endif |
| 85 } | 83 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 102 | 100 |
| 103 JSValuePtr retrieveArguments(CallFrame*, JSFunction*) const; | 101 JSValuePtr retrieveArguments(CallFrame*, JSFunction*) const; |
| 104 JSValuePtr retrieveCaller(CallFrame*, InternalFunction*) const; | 102 JSValuePtr retrieveCaller(CallFrame*, InternalFunction*) const; |
| 105 void retrieveLastCaller(CallFrame*, int& lineNumber, intptr_t& sourceID,
UString& sourceURL, JSValuePtr& function) const; | 103 void retrieveLastCaller(CallFrame*, int& lineNumber, intptr_t& sourceID,
UString& sourceURL, JSValuePtr& function) const; |
| 106 | 104 |
| 107 void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParamete
rIndex, Register*& argv, int& argc); | 105 void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParamete
rIndex, Register*& argv, int& argc); |
| 108 | 106 |
| 109 void setSampler(SamplingTool* sampler) { m_sampler = sampler; } | 107 void setSampler(SamplingTool* sampler) { m_sampler = sampler; } |
| 110 SamplingTool* sampler() { return m_sampler; } | 108 SamplingTool* sampler() { return m_sampler; } |
| 111 | 109 |
| 112 bool isJSArray(JSValuePtr v) { return v.isCell() && v.asCell()->vptr() =
= m_jsArrayVptr; } | |
| 113 bool isJSString(JSValuePtr v) { return v.isCell() && v.asCell()->vptr()
== m_jsStringVptr; } | |
| 114 bool isJSByteArray(JSValuePtr v) { return v.isCell() && v.asCell()->vptr
() == m_jsByteArrayVptr; } | |
| 115 | |
| 116 private: | 110 private: |
| 117 enum ExecutionFlag { Normal, InitializeAndReturn }; | 111 enum ExecutionFlag { Normal, InitializeAndReturn }; |
| 118 | 112 |
| 119 NEVER_INLINE JSValuePtr callEval(CallFrame*, RegisterFile*, Register* ar
gv, int argc, int registerOffset, JSValuePtr& exceptionValue); | 113 NEVER_INLINE JSValuePtr callEval(CallFrame*, RegisterFile*, Register* ar
gv, int argc, int registerOffset, JSValuePtr& exceptionValue); |
| 120 JSValuePtr execute(EvalNode*, CallFrame*, JSObject* thisObject, int glob
alRegisterOffset, ScopeChainNode*, JSValuePtr* exception); | 114 JSValuePtr execute(EvalNode*, CallFrame*, JSObject* thisObject, int glob
alRegisterOffset, ScopeChainNode*, JSValuePtr* exception); |
| 121 | 115 |
| 122 NEVER_INLINE void debug(CallFrame*, DebugHookID, int firstLine, int last
Line); | 116 NEVER_INLINE void debug(CallFrame*, DebugHookID, int firstLine, int last
Line); |
| 123 | 117 |
| 124 NEVER_INLINE bool resolve(CallFrame*, Instruction*, JSValuePtr& exceptio
nValue); | 118 NEVER_INLINE bool resolve(CallFrame*, Instruction*, JSValuePtr& exceptio
nValue); |
| 125 NEVER_INLINE bool resolveSkip(CallFrame*, Instruction*, JSValuePtr& exce
ptionValue); | 119 NEVER_INLINE bool resolveSkip(CallFrame*, Instruction*, JSValuePtr& exce
ptionValue); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 143 | 137 |
| 144 void tryCacheGetByID(CallFrame*, CodeBlock*, Instruction*, JSValuePtr ba
seValue, const Identifier& propertyName, const PropertySlot&); | 138 void tryCacheGetByID(CallFrame*, CodeBlock*, Instruction*, JSValuePtr ba
seValue, const Identifier& propertyName, const PropertySlot&); |
| 145 void uncacheGetByID(CodeBlock*, Instruction* vPC); | 139 void uncacheGetByID(CodeBlock*, Instruction* vPC); |
| 146 void tryCachePutByID(CallFrame*, CodeBlock*, Instruction*, JSValuePtr ba
seValue, const PutPropertySlot&); | 140 void tryCachePutByID(CallFrame*, CodeBlock*, Instruction*, JSValuePtr ba
seValue, const PutPropertySlot&); |
| 147 void uncachePutByID(CodeBlock*, Instruction* vPC); | 141 void uncachePutByID(CodeBlock*, Instruction* vPC); |
| 148 | 142 |
| 149 bool isCallBytecode(Opcode opcode) { return opcode == getOpcode(op_call)
|| opcode == getOpcode(op_construct) || opcode == getOpcode(op_call_eval); } | 143 bool isCallBytecode(Opcode opcode) { return opcode == getOpcode(op_call)
|| opcode == getOpcode(op_construct) || opcode == getOpcode(op_call_eval); } |
| 150 | 144 |
| 151 SamplingTool* m_sampler; | 145 SamplingTool* m_sampler; |
| 152 | 146 |
| 153 #if ENABLE(JIT) | |
| 154 RefPtr<ExecutablePool> m_executablePool; | |
| 155 void* m_ctiArrayLengthTrampoline; | |
| 156 void* m_ctiStringLengthTrampoline; | |
| 157 void* m_ctiVirtualCallPreLink; | |
| 158 void* m_ctiVirtualCallLink; | |
| 159 void* m_ctiVirtualCall; | |
| 160 #endif | |
| 161 | |
| 162 int m_reentryDepth; | 147 int m_reentryDepth; |
| 163 | 148 |
| 164 RegisterFile m_registerFile; | 149 RegisterFile m_registerFile; |
| 165 | 150 |
| 166 void* m_jsArrayVptr; | |
| 167 void* m_jsByteArrayVptr; | |
| 168 void* m_jsStringVptr; | |
| 169 void* m_jsFunctionVptr; | |
| 170 | |
| 171 #if HAVE(COMPUTED_GOTO) | 151 #if HAVE(COMPUTED_GOTO) |
| 172 Opcode m_opcodeTable[numOpcodeIDs]; // Maps OpcodeID => Opcode for compi
ling | 152 Opcode m_opcodeTable[numOpcodeIDs]; // Maps OpcodeID => Opcode for compi
ling |
| 173 HashMap<Opcode, OpcodeID> m_opcodeIDTable; // Maps Opcode => OpcodeID fo
r decompiling | 153 HashMap<Opcode, OpcodeID> m_opcodeIDTable; // Maps Opcode => OpcodeID fo
r decompiling |
| 174 #endif | 154 #endif |
| 175 }; | 155 }; |
| 176 | 156 |
| 177 } // namespace JSC | 157 } // namespace JSC |
| 178 | 158 |
| 179 #endif // Interpreter_h | 159 #endif // Interpreter_h |
| 180 | 160 |
| OLD | NEW |