Changeset 96146 in webkit for trunk/Source/JavaScriptCore/interpreter/Interpreter.h
- Timestamp:
- Sep 27, 2011, 1:16:37 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/interpreter/Interpreter.h
r96131 r96146 32 32 #include "ArgList.h" 33 33 #include "JSCell.h" 34 #include "JSFunction.h"35 34 #include "JSValue.h" 36 35 #include "JSObject.h" … … 44 43 class CodeBlock; 45 44 class EvalExecutable; 46 class ExecutableBase;47 45 class FunctionExecutable; 46 class JSFunction; 48 47 class JSGlobalObject; 49 48 class ProgramExecutable; … … 62 61 WillLeaveCallFrame, 63 62 WillExecuteStatement 64 };65 66 enum StackFrameCodeType {67 StackFrameGlobalCode,68 StackFrameEvalCode,69 StackFrameFunctionCode,70 StackFrameNativeCode71 };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() const81 {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 else93 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 else105 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 63 }; 115 64 … … 180 129 NEVER_INLINE HandlerInfo* throwException(CallFrame*&, JSValue&, unsigned bytecodeOffset); 181 130 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);184 131 185 132 void dumpSampleData(ExecState* exec);
Note:
See TracChangeset
for help on using the changeset viewer.