Changeset 32819 in webkit for trunk/JavaScriptCore
- Timestamp:
- May 2, 2008, 11:10:33 AM (17 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r32808 r32819 1 2008-05-02 Alexey Proskuryakov <[email protected]> 2 3 Reviewed by Darin. 4 5 Move call stack depth counter to global object. 6 7 * kjs/ExecState.h: (KJS::ExecState::functionCallDepth): Added a recursion depth counter to 8 per-thread data. 9 * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): Initialize PerThreadData.functionCallDepth. 10 * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::perThreadData): Made the result non-const. 11 12 * kjs/object.cpp: 13 (KJS::throwStackSizeExceededError): Moved throwError to a separate function, since it is now 14 the only thing in JSObject::call that needs a PIC branch. 15 (KJS::JSObject::call): Use a per-thread variable instead of local static for recursion depth 16 tracking. 17 1 18 2008-05-02 Alexey Proskuryakov <[email protected]> 2 19 -
trunk/JavaScriptCore/kjs/ExecState.h
r32807 r32819 61 61 62 62 Heap* heap; 63 64 unsigned functionCallDepth; 63 65 }; 64 66 … … 125 127 Heap* heap() const { return m_perThreadData->heap; } 126 128 129 unsigned& functionCallDepth() { return m_perThreadData->functionCallDepth; } 130 127 131 LocalStorage& localStorage() { return *m_localStorage; } 128 132 void setLocalStorage(LocalStorage* s) { m_localStorage = s; } … … 205 209 ExecState* m_callingExec; 206 210 207 constPerThreadData* m_perThreadData;211 PerThreadData* m_perThreadData; 208 212 209 213 ScopeNode* m_scopeNode; -
trunk/JavaScriptCore/kjs/JSGlobalObject.cpp
r32807 r32819 231 231 d()->perThreadData.propertyNames = CommonIdentifiers::shared(); 232 232 d()->perThreadData.heap = Heap::threadHeap(); 233 d()->perThreadData.functionCallDepth = 0; 233 234 234 235 d()->globalExec.set(new GlobalExecState(this, thisValue)); -
trunk/JavaScriptCore/kjs/JSGlobalObject.h
r32807 r32819 251 251 252 252 // Per-thread hash tables, cached on the global object for faster access. 253 const PerThreadData* perThreadData() const{ return &d()->perThreadData; }253 PerThreadData* perThreadData() { return &d()->perThreadData; } 254 254 255 255 // Initialize and/or retrieve per-thread hash tables - use perThreadData() for faster access instead. -
trunk/JavaScriptCore/kjs/object.cpp
r32807 r32819 64 64 // ------------------------------ Object --------------------------------------- 65 65 66 JSValue* NEVER_INLINE throwStackSizeExceededError(ExecState* exec) 67 { 68 // This function takes a PIC branch to access a string literal, so moving it out of JSObject::call() improves performance. 69 return throwError(exec, RangeError, "Maximum call stack size exceeded."); 70 } 71 66 72 JSValue *JSObject::call(ExecState *exec, JSObject *thisObj, const List &args) 67 73 { … … 69 75 70 76 #if KJS_MAX_STACK > 0 71 static int depth = 0; // sum of all extant function calls72 73 77 #if JAVASCRIPT_CALL_TRACING 74 78 static bool tracing = false; … … 87 91 #endif 88 92 93 unsigned& depth = exec->functionCallDepth(); 89 94 if (++depth > KJS_MAX_STACK) { 95 // FIXME: secondary threads probably need a different limit than main thread. 96 // Ideally, the limit should be calculated from available stack space, and not just hardcoded. 90 97 --depth; 91 return throw Error(exec, RangeError, "Maximum call stack size exceeded.");98 return throwStackSizeExceededError(exec); 92 99 } 93 100 #endif
Note:
See TracChangeset
for help on using the changeset viewer.