Changeset 34309 in webkit for trunk/JavaScriptCore/kjs/object.cpp
- Timestamp:
- Jun 2, 2008, 10:08:42 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/object.cpp
r34090 r34309 35 35 #include <wtf/Assertions.h> 36 36 37 // maximum global call stack size. Protects against accidental or38 // malicious infinite recursions. Define to -1 if you want no limit.39 // In real-world testing it appears ok to bump the stack depth count to 500.40 // This of course is dependent on stack frame size.41 #define KJS_MAX_STACK 50042 43 #define JAVASCRIPT_CALL_TRACING 044 37 #define JAVASCRIPT_MARK_TRACING 0 45 38 46 #if JAVASCRIPT_CALL_TRACING47 static bool _traceJavaScript = false;48 49 extern "C" {50 void setTraceJavaScript(bool f)51 {52 _traceJavaScript = f;53 }54 55 static bool traceJavaScript()56 {57 return _traceJavaScript;58 }59 }60 #endif61 62 39 namespace KJS { 63 40 64 41 // ------------------------------ Object --------------------------------------- 65 42 66 JSValue *JSObject::call(ExecState *exec, JSObject *thisObj, const List &args) 67 { 68 ASSERT(implementsCall()); 69 70 #if KJS_MAX_STACK > 0 71 static int depth = 0; // sum of all extant function calls 72 73 #if JAVASCRIPT_CALL_TRACING 74 static bool tracing = false; 75 if (traceJavaScript() && !tracing) { 76 tracing = true; 77 for (int i = 0; i < depth; i++) 78 putchar (' '); 79 printf ("*** calling: %s\n", toString(exec).ascii()); 80 for (int j = 0; j < args.size(); j++) { 81 for (int i = 0; i < depth; i++) 82 putchar (' '); 83 printf ("*** arg[%d] = %s\n", j, args[j]->toString(exec).ascii()); 84 } 85 tracing = false; 86 } 87 #endif 88 89 if (++depth > KJS_MAX_STACK) { 90 --depth; 91 return throwError(exec, RangeError, "Maximum call stack size exceeded."); 92 } 93 #endif 94 JSValue* ret = callAsFunction(exec,thisObj,args); 95 96 #if KJS_MAX_STACK > 0 97 --depth; 98 #endif 99 100 #if JAVASCRIPT_CALL_TRACING 101 if (traceJavaScript() && !tracing) { 102 tracing = true; 103 for (int i = 0; i < depth; i++) 104 putchar (' '); 105 printf ("*** returning: %s\n", ret->toString(exec).ascii()); 106 tracing = false; 107 } 108 #endif 109 110 return ret; 43 JSValue* JSObject::call(ExecState* exec, JSObject* thisObj, const List& args) 44 { 45 ASSERT(implementsCall()); 46 return callAsFunction(exec, thisObj, args); 111 47 } 112 48
Note:
See TracChangeset
for help on using the changeset viewer.