Changeset 39229 in webkit for trunk/JavaScriptCore/bytecode/CodeBlock.h
- Timestamp:
- Dec 12, 2008, 12:02:09 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/bytecode/CodeBlock.h
r39184 r39229 41 41 #include <wtf/Vector.h> 42 42 43 #if ENABLE(JIT) 44 #include "StructureStubInfo.h" 45 #endif 46 43 47 namespace JSC { 44 48 … … 54 58 uint32_t target; 55 59 uint32_t scopeDepth; 60 #if ENABLE(JIT) 56 61 void* nativeCode; 62 #endif 57 63 }; 58 64 … … 73 79 }; 74 80 75 struct StructureStubInfo { 76 StructureStubInfo(unsigned bytecodeIndex) 77 : bytecodeIndex(bytecodeIndex) 78 , stubRoutine(0) 79 , callReturnLocation(0) 80 , hotPathBegin(0) 81 { 82 } 83 84 unsigned bytecodeIndex; 85 void* stubRoutine; 86 void* callReturnLocation; 87 void* hotPathBegin; 88 }; 89 81 #if ENABLE(JIT) 90 82 struct CallLinkInfo { 91 83 CallLinkInfo() … … 110 102 }; 111 103 112 #if ENABLE(JIT) 104 struct GlobalResolveInfo { 105 GlobalResolveInfo() 106 : structure(0) 107 , offset(0) 108 { 109 } 110 111 Structure* structure; 112 unsigned offset; 113 }; 114 113 115 struct PC { 114 116 PC(void* nativePC, unsigned bytecodeIndex) … … 121 123 unsigned bytecodeIndex; 122 124 }; 123 #endif124 125 125 126 // valueAtPosition helpers for the binaryChop algorithm below. … … 135 136 } 136 137 137 #if ENABLE(JIT)138 138 inline void* getNativePC(PC* pc) 139 139 { 140 140 return pc->nativePC; 141 141 } 142 #endif143 142 144 143 // Binary chop algorithm, calls valueAtPosition on pre-sorted elements in array, … … 177 176 return &array[0]; 178 177 } 178 #endif 179 179 180 180 class CodeBlock { … … 184 184 ~CodeBlock(); 185 185 186 void mark(); 187 void refStructures(Instruction* vPC) const; 188 void derefStructures(Instruction* vPC) const; 189 #if ENABLE(JIT) 190 void unlinkCallers(); 191 #endif 192 186 193 static void dumpStatistics(); 187 194 188 #if ENABLE(JIT) 189 void unlinkCallers(); 190 #endif 191 195 #if !defined(NDEBUG) || ENABLE_OPCODE_SAMPLING 196 void dump(ExecState*) const; 197 void printStructures(const Instruction*) const; 198 void printStructure(const char* name, const Instruction*, int operand) const; 199 #endif 200 201 inline bool isKnownNotImmediate(int index) 202 { 203 if (index == m_thisRegister) 204 return true; 205 206 if (isConstantRegisterIndex(index)) 207 return !JSImmediate::isImmediate(getConstant(index)); 208 209 return false; 210 } 211 212 ALWAYS_INLINE bool isConstantRegisterIndex(int index) 213 { 214 return index >= m_numVars && index < m_numVars + m_numConstants; 215 } 216 217 ALWAYS_INLINE JSValue* getConstant(int index) 218 { 219 return m_constantRegisters[index - m_numVars].getJSValue(); 220 } 221 222 ALWAYS_INLINE bool isTemporaryRegisterIndex(int index) 223 { 224 return index >= m_numVars + m_numConstants; 225 } 226 227 int expressionRangeForVPC(const Instruction*, int& divot, int& startOffset, int& endOffset); 228 int lineNumberForVPC(const Instruction* vPC); 229 HandlerInfo* handlerForVPC(const Instruction* vPC); 230 231 #if ENABLE(JIT) 192 232 void addCaller(CallLinkInfo* caller) 193 233 { … … 209 249 } 210 250 211 inline bool isKnownNotImmediate(int index)212 {213 if (index == m_thisRegister)214 return true;215 216 if (isConstantRegisterIndex(index))217 return !JSImmediate::isImmediate(getConstant(index));218 219 return false;220 }221 222 ALWAYS_INLINE bool isConstantRegisterIndex(int index)223 {224 return index >= m_numVars && index < m_numVars + m_numConstants;225 }226 227 ALWAYS_INLINE JSValue* getConstant(int index)228 {229 return m_constantRegisters[index - m_numVars].getJSValue();230 }231 232 ALWAYS_INLINE bool isTemporaryRegisterIndex(int index)233 {234 return index >= m_numVars + m_numConstants;235 }236 237 #if !defined(NDEBUG) || ENABLE_OPCODE_SAMPLING238 void dump(ExecState*) const;239 void printStructures(const Instruction*) const;240 void printStructure(const char* name, const Instruction*, int operand) const;241 #endif242 int expressionRangeForVPC(const Instruction*, int& divot, int& startOffset, int& endOffset);243 int lineNumberForVPC(const Instruction* vPC);244 HandlerInfo* handlerForVPC(const Instruction* vPC);245 246 void mark();247 void refStructures(Instruction* vPC) const;248 void derefStructures(Instruction* vPC) const;249 250 251 StructureStubInfo& getStubInfo(void* returnAddress) 251 252 { 252 return *(binaryChop<StructureStubInfo, void*, getStructureStubInfoReturnLocation>(m_ propertyAccessInstructions.begin(), m_propertyAccessInstructions.size(), returnAddress));253 return *(binaryChop<StructureStubInfo, void*, getStructureStubInfoReturnLocation>(m_structureStubInfos.begin(), m_structureStubInfos.size(), returnAddress)); 253 254 } 254 255 … … 258 259 } 259 260 260 #if ENABLE(JIT)261 261 unsigned getBytecodeIndex(void* nativePC) 262 262 { … … 266 266 267 267 Vector<Instruction>& instructions() { return m_instructions; } 268 268 269 #if ENABLE(JIT) 269 270 void setJITCode(void* jitCode) { m_jitCode = jitCode; } … … 292 293 unsigned sourceOffset() const { return m_sourceOffset; } 293 294 294 void addGlobalResolveInstruction(unsigned globalResolveInstructions) { m_globalResolveInstructions.append(globalResolveInstructions); }295 296 size_t numberOfPropertyAccessInstructions() const { return m_propertyAccessInstructions.size(); }297 void addPropertyAccessInstruction(unsigned propertyAccessInstructions) { m_propertyAccessInstructions.append(StructureStubInfo(propertyAccessInstructions)); }298 StructureStubInfo& propertyAccessInstruction(int index) { return m_propertyAccessInstructions[index]; }299 300 size_t numberOfCallLinkInfos() const { return m_callLinkInfos.size(); }301 void addCallLinkInfo() { m_callLinkInfos.append(CallLinkInfo()); }302 CallLinkInfo& callLinkInfo(int index) { return m_callLinkInfos[index]; }303 304 295 size_t numberOfJumpTargets() const { return m_jumpTargets.size(); } 305 296 void addJumpTarget(unsigned jumpTarget) { m_jumpTargets.append(jumpTarget); } … … 317 308 LineInfo& lastLineInfo() { return m_lineInfo.last(); } 318 309 319 #if ENABLE(JIT) 310 #if !ENABLE(JIT) 311 void addPropertyAccessInstruction(unsigned propertyAccessInstruction) { m_propertyAccessInstructions.append(propertyAccessInstruction); } 312 void addGlobalResolveInstruction(unsigned globalResolveInstructions) { m_globalResolveInstructions.append(globalResolveInstructions); } 313 #else 314 size_t numberOfStructureStubInfos() const { return m_structureStubInfos.size(); } 315 void addStructureStubInfo(const StructureStubInfo& stubInfo) { m_structureStubInfos.append(stubInfo); } 316 StructureStubInfo& structureStubInfo(int index) { return m_structureStubInfos[index]; } 317 318 void addGlobalResolveInfo() { m_globalResolveInfos.append(GlobalResolveInfo()); } 319 GlobalResolveInfo& globalResolveInfo(int index) { return m_globalResolveInfos[index]; } 320 321 size_t numberOfCallLinkInfos() const { return m_callLinkInfos.size(); } 322 void addCallLinkInfo() { m_callLinkInfos.append(CallLinkInfo()); } 323 CallLinkInfo& callLinkInfo(int index) { return m_callLinkInfos[index]; } 324 320 325 Vector<PC>& pcVector() { return m_pcVector; } 321 326 #endif … … 408 413 unsigned m_sourceOffset; 409 414 415 #if !ENABLE(JIT) 416 Vector<unsigned> m_propertyAccessInstructions; 410 417 Vector<unsigned> m_globalResolveInstructions; 411 Vector<StructureStubInfo> m_propertyAccessInstructions; 418 #else 419 Vector<StructureStubInfo> m_structureStubInfos; 420 Vector<GlobalResolveInfo> m_globalResolveInfos; 412 421 Vector<CallLinkInfo> m_callLinkInfos; 413 422 Vector<CallLinkInfo*> m_linkedCallerList; 423 #endif 414 424 415 425 Vector<unsigned> m_jumpTargets;
Note:
See TracChangeset
for help on using the changeset viewer.