Changeset 108112 in webkit for trunk/Source/JavaScriptCore/interpreter/Interpreter.h
- Timestamp:
- Feb 17, 2012, 1:17:59 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/interpreter/Interpreter.h
r108036 r108112 32 32 #include "ArgList.h" 33 33 #include "JSCell.h" 34 #include "JSFunction.h" 34 35 #include "JSValue.h" 35 36 #include "JSObject.h" … … 43 44 class CodeBlock; 44 45 class EvalExecutable; 46 class ExecutableBase; 45 47 class FunctionExecutable; 46 class JSFunction;47 48 class JSGlobalObject; 48 49 class ProgramExecutable; … … 63 64 }; 64 65 66 enum StackFrameCodeType { 67 StackFrameGlobalCode, 68 StackFrameEvalCode, 69 StackFrameFunctionCode, 70 StackFrameNativeCode 71 }; 72 73 struct StackFrame { 74 Strong<JSObject> callee; 75 StackFrameCodeType codeType; 76 Strong<ExecutableBase> executable; 77 int line; 78 UString sourceURL; 79 UString toString(CallFrame* callFrame) const 80 { 81 bool hasSourceURLInfo = !sourceURL.isNull() && !sourceURL.isEmpty(); 82 bool hasLineInfo = line > -1; 83 String traceLine; 84 JSObject* stackFrameCallee = callee.get(); 85 86 switch (codeType) { 87 case StackFrameEvalCode: 88 if (hasSourceURLInfo) { 89 traceLine = hasLineInfo ? String::format("eval code@%s:%d", sourceURL.ascii().data(), line) 90 : String::format("eval code@%s", sourceURL.ascii().data()); 91 } else 92 traceLine = String::format("eval code"); 93 break; 94 case StackFrameNativeCode: { 95 if (callee) { 96 UString functionName = getCalculatedDisplayName(callFrame, stackFrameCallee); 97 traceLine = String::format("%s@[native code]", functionName.ascii().data()); 98 } else 99 traceLine = "[native code]"; 100 break; 101 } 102 case StackFrameFunctionCode: { 103 UString functionName = getCalculatedDisplayName(callFrame, stackFrameCallee); 104 if (hasSourceURLInfo) { 105 traceLine = hasLineInfo ? String::format("%s@%s:%d", functionName.ascii().data(), sourceURL.ascii().data(), line) 106 : String::format("%s@%s", functionName.ascii().data(), sourceURL.ascii().data()); 107 } else 108 traceLine = String::format("%s\n", functionName.ascii().data()); 109 break; 110 } 111 case StackFrameGlobalCode: 112 if (hasSourceURLInfo) { 113 traceLine = hasLineInfo ? String::format("global code@%s:%d", sourceURL.ascii().data(), line) 114 : String::format("global code@%s", sourceURL.ascii().data()); 115 } else 116 traceLine = String::format("global code"); 117 118 } 119 return traceLine.impl(); 120 } 121 }; 122 65 123 class TopCallFrameSetter { 66 124 public: … … 152 210 NEVER_INLINE HandlerInfo* throwException(CallFrame*&, JSValue&, unsigned bytecodeOffset); 153 211 NEVER_INLINE void debug(CallFrame*, DebugHookID, int firstLine, int lastLine); 212 static const UString getTraceLine(CallFrame*, StackFrameCodeType, const UString&, int); 213 JS_EXPORT_PRIVATE static void getStackTrace(JSGlobalData*, int line, Vector<StackFrame>& results); 154 214 155 215 void dumpSampleData(ExecState* exec);
Note:
See TracChangeset
for help on using the changeset viewer.