Changeset 96131 in webkit for trunk/Source/JavaScriptCore/interpreter/Interpreter.h
- Timestamp:
- Sep 27, 2011, 10:58:55 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/interpreter/Interpreter.h
r95901 r96131 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 Strong<CallFrame> callFrame; 76 StackFrameCodeType codeType; 77 Strong<ExecutableBase> executable; 78 int line; 79 UString sourceURL; 80 UString toString() const 81 { 82 bool hasSourceURLInfo = !sourceURL.isNull() && !sourceURL.isEmpty(); 83 bool hasLineInfo = line > -1; 84 String traceLine; 85 JSObject* stackFrameCallee = callee.get(); 86 87 switch (codeType) { 88 case StackFrameEvalCode: 89 if (hasSourceURLInfo) 90 traceLine = hasLineInfo ? String::format("eval at %s:%d", sourceURL.ascii().data(), line) 91 : String::format("eval at %s", sourceURL.ascii().data()); 92 else 93 traceLine = String::format("eval"); 94 break; 95 case StackFrameNativeCode: 96 traceLine = "Native code"; 97 break; 98 case StackFrameFunctionCode: 99 if (stackFrameCallee && stackFrameCallee->inherits(&JSFunction::s_info)) { 100 UString functionName = asFunction(stackFrameCallee)->name(callFrame.get()); 101 if (hasSourceURLInfo) 102 traceLine = hasLineInfo ? String::format("%s at %s:%d", functionName.ascii().data(), sourceURL.ascii().data(), line) 103 : String::format("%s at %s", functionName.ascii().data(), sourceURL.ascii().data()); 104 else 105 traceLine = String::format("%s\n", functionName.ascii().data()); 106 break; 107 } 108 case StackFrameGlobalCode: 109 traceLine = hasLineInfo ? String::format("at %s:%d", sourceURL.ascii().data(), line) 110 : String::format("at %s", sourceURL.ascii().data()); 111 } 112 return traceLine.impl(); 113 } 114 }; 115 65 116 class TopCallFrameSetter { 66 117 public: … … 129 180 NEVER_INLINE HandlerInfo* throwException(CallFrame*&, JSValue&, unsigned bytecodeOffset); 130 181 NEVER_INLINE void debug(CallFrame*, DebugHookID, int firstLine, int lastLine); 182 static const UString getTraceLine(CallFrame*, StackFrameCodeType, const UString&, int); 183 static void getStackTrace(JSGlobalData*, int line, Vector<StackFrame>& results); 131 184 132 185 void dumpSampleData(ExecState* exec);
Note:
See TracChangeset
for help on using the changeset viewer.