Changeset 151651 in webkit
- Timestamp:
- Jun 17, 2013 11:54:34 AM (11 years ago)
- Location:
- branches/dfgFourthTier/Source
- Files:
-
- 4 added
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/dfgFourthTier/Source/JavaScriptCore/API/JSContextRef.cpp
r151500 r151651 31 31 #include "InitializeThreading.h" 32 32 #include <interpreter/CallFrame.h> 33 #include <interpreter/Interpreter.h>34 33 #include "JSCallbackObject.h" 35 34 #include "JSClassRef.h" … … 38 37 #include "Operations.h" 39 38 #include "SourceProvider.h" 39 #include "StackIterator.h" 40 40 #include <wtf/text/StringBuilder.h> 41 41 #include <wtf/text/StringHash.h> … … 206 206 JSLockHolder lock(exec); 207 207 StringBuilder builder; 208 Vector<StackFrame> stackTrace; 209 exec->interpreter()->getStackTrace(stackTrace, maxStackSize); 210 211 for (size_t i = 0; i < stackTrace.size(); i++) { 212 String urlString; 213 String functionName; 214 StackFrame& frame = stackTrace[i]; 215 JSValue function = frame.callee.get(); 216 if (frame.callee) 217 functionName = frame.friendlyFunctionName(exec); 218 else { 219 // Caller is unknown, but if frame is empty we should still add the frame, because 220 // something called us, and gave us arguments. 221 if (i) 222 break; 223 } 224 unsigned lineNumber = frame.line(); 208 CallFrame* frame = exec->vm().topCallFrame; 209 size_t i = 0; 210 ASSERT(maxStackSize); 211 for (StackIterator iter = frame->begin(); iter != frame->end() && maxStackSize--; ++iter, ++i) { 212 JSObject* callee = iter->callee(); 213 // If callee is unknown, but we've not added any frame yet, we should 214 // still add the frame, because something called us, and gave us arguments. 215 if (!callee && i) 216 break; 217 225 218 if (!builder.isEmpty()) 226 219 builder.append('\n'); … … 228 221 builder.appendNumber(i); 229 222 builder.append(' '); 230 builder.append( stackTrace[i].friendlyFunctionName(exec));223 builder.append(iter->functionName()); 231 224 builder.appendLiteral("() at "); 232 builder.append( stackTrace[i].friendlySourceURL());233 if ( frame.codeType != StackFrameNativeCode) {225 builder.append(iter->sourceURL()); 226 if (iter->isJSFrame()) { 234 227 builder.append(':'); 235 builder.appendNumber( lineNumber);228 builder.appendNumber(iter->line()); 236 229 } 237 if (!function) 230 231 if (!callee) 238 232 break; 239 233 } -
branches/dfgFourthTier/Source/JavaScriptCore/CMakeLists.txt
r151500 r151651 164 164 interpreter/Interpreter.cpp 165 165 interpreter/JSStack.cpp 166 interpreter/StackIterator.cpp 166 167 interpreter/VMInspector.cpp 167 168 -
branches/dfgFourthTier/Source/JavaScriptCore/ChangeLog
r151649 r151651 1 2013-06-17 Mark Lam <mark.lam@apple.com> 2 3 Rolling r151456, r151420 back in with some fixes. 4 https://bugs.webkit.org/show_bug.cgi?id=117390. 5 6 Reviewed by Geoffrey Garen. 7 8 New changes on top of the old patch: 9 - Renamed CallFrame::beginAt() to CallFrame::find(), and also provide 10 a version that takes a CallFrame* to search for. 11 12 There are 3 types of users of the StackIterator. We need to cater 13 to each of these as follows: 14 15 1. Users who want a stack trace 16 - Here we need to start iterating from vm.topCallFrame. 17 - To do this, create the StackIterator as follows: 18 StackIterator iter = vm.topCallFrame->begin(); 19 20 2. Users who want their caller frame 21 - Here we need to start iterating from the specified CallFrame*. 22 - To do this, create the StackIterator as follows: 23 StackIterator iter = callFrame->begin(); 24 25 3. Users who want the frame of a specific JSFunction object 26 - Here we need to start iterating from vm.topCallFrame and find 27 the frame that has a callee matching the specified JSFunction*. 28 - To do this, create the StackIterator as follows: 29 StackIterator iter = exec->find(functionObj); 30 31 The previous layout test failures were due to conflation of case 1 32 and 2. They are now handled appropriately. 33 34 - Fixed a pre-existing layout test crash in 35 inspector/profiler/cpu-profiler-agent-crash-on-start.html. 36 37 * API/JSContextRef.cpp: 38 (JSContextCreateBacktrace): 39 * CMakeLists.txt: 40 * GNUmakefile.list.am: 41 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: 42 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: 43 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: 44 * JavaScriptCore.xcodeproj/project.pbxproj: 45 * Target.pri: 46 * interpreter/CallFrame.cpp: 47 * interpreter/CallFrame.h: 48 (JSC::ExecState::setInlineCallFrame): 49 (ExecState): 50 * interpreter/CallFrameInlines.h: 51 (JSC::CallFrame::begin): 52 (JSC::CallFrame::find): 53 (JSC::CallFrame::end): 54 * interpreter/Interpreter.cpp: 55 (JSC::Interpreter::dumpRegisters): 56 (JSC::Interpreter::unwindCallFrame): 57 (JSC::Interpreter::getStackTrace): 58 (JSC::Interpreter::throwException): 59 (JSC::Interpreter::debug): 60 * interpreter/Interpreter.h: 61 (Interpreter): 62 * interpreter/StackIterator.cpp: Added. 63 (JSC::StackIterator::StackIterator): 64 (JSC::StackIterator::gotoNextFrame): 65 (JSC::StackIterator::find): 66 (JSC::StackIterator::Frame::codeType): 67 (JSC::StackIterator::Frame::functionName): 68 (JSC::StackIterator::Frame::sourceURL): 69 (JSC::StackIterator::Frame::toString): 70 (JSC::StackIterator::Frame::bytecodeOffset): 71 (JSC::StackIterator::Frame::line): 72 (JSC::StackIterator::Frame::column): 73 (JSC::StackIterator::Frame::arguments): 74 (JSC::StackIterator::Frame::retrieveExpressionInfo): 75 (JSC::StackIterator::Frame::logicalFrame): 76 (JSC::StackIterator::Frame::logicalCallerFrame): 77 (JSC::jitTypeName): 78 (JSC::printIndents): 79 (JSC::printif): 80 (JSC::StackIterator::Frame::print): 81 (debugPrintCallFrame): 82 * interpreter/StackIterator.h: Added. 83 (StackIterator::Frame): 84 (JSC::StackIterator::Frame::create): 85 (JSC::StackIterator::Frame::isJSFrame): 86 (JSC::StackIterator::Frame::callFrame): 87 * interpreter/StackIteratorPrivate.h: Added. 88 (StackIterator): 89 (JSC::StackIterator::operator*): 90 (JSC::StackIterator::operator->): 91 (JSC::StackIterator::operator==): 92 (JSC::StackIterator::operator!=): 93 (JSC::StackIterator::operator++): 94 (JSC::StackIterator::end): 95 * jsc.cpp: 96 (functionJSCStack): 97 * profiler/ProfileGenerator.cpp: 98 (JSC::ProfileGenerator::addParentForConsoleStart): 99 * profiler/ProfileNode.h: 100 (ProfileNode): 101 * runtime/JSFunction.cpp: 102 (JSC::retrieveArguments): 103 (JSC::JSFunction::argumentsGetter): 104 (JSC::skipOverBoundFunctions): 105 (JSC::retrieveCallerFunction): 106 (JSC::JSFunction::callerGetter): 107 (JSC::JSFunction::getOwnPropertyDescriptor): 108 (JSC::JSFunction::defineOwnProperty): 109 * runtime/JSGlobalObjectFunctions.cpp: 110 (JSC::globalFuncProtoGetter): 111 (JSC::globalFuncProtoSetter): 112 * runtime/ObjectConstructor.cpp: 113 (JSC::objectConstructorGetPrototypeOf): 114 * runtime/Operations.h: 115 1 116 2013-06-17 Filip Pizlo <fpizlo@apple.com> 2 117 -
branches/dfgFourthTier/Source/JavaScriptCore/GNUmakefile.list.am
r151500 r151651 434 434 Source/JavaScriptCore/interpreter/JSStackInlines.h \ 435 435 Source/JavaScriptCore/interpreter/Register.h \ 436 Source/JavaScriptCore/interpreter/StackIterator.cpp \ 437 Source/JavaScriptCore/interpreter/StackIterator.h \ 438 Source/JavaScriptCore/interpreter/StackIteratorPrivate.h \ 436 439 Source/JavaScriptCore/interpreter/VMInspector.cpp \ 437 440 Source/JavaScriptCore/interpreter/VMInspector.h \ -
branches/dfgFourthTier/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
r151500 r151651 2423 2423 </File> 2424 2424 <File 2425 RelativePath="..\..\interpreter\StackIterator.cpp" 2426 > 2427 </File> 2428 <File 2429 RelativePath="..\..\interpreter\StackIterator.h" 2430 > 2431 </File> 2432 <File 2433 RelativePath="..\..\interpreter\StackIteratorPrivate.h" 2434 > 2435 </File> 2436 <File 2425 2437 RelativePath="..\..\interpreter\VMInspector.cpp" 2426 2438 > -
branches/dfgFourthTier/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
r151500 r151651 223 223 <ClCompile Include="..\interpreter\Interpreter.cpp" /> 224 224 <ClCompile Include="..\interpreter\JSStack.cpp" /> 225 <ClCompile Include="..\interpreter\StackIterator.cpp" /> 225 226 <ClCompile Include="..\interpreter\VMInspector.cpp" /> 226 227 <ClCompile Include="..\jit\ClosureCallStubRoutine.cpp" /> … … 555 556 <ClInclude Include="..\interpreter\JSStackInlines.h" /> 556 557 <ClInclude Include="..\interpreter\Register.h" /> 558 <ClInclude Include="..\interpreter\StackIterator.h" /> 559 <ClInclude Include="..\interpreter\StackIteratorPrivate.h" /> 557 560 <ClInclude Include="..\interpreter\VMInspector.h" /> 558 561 <ClInclude Include="..\jit\ClosureCallStubRoutine.h" /> -
branches/dfgFourthTier/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters
r151500 r151651 286 286 <Filter>interpreter</Filter> 287 287 </ClCompile> 288 <ClCompile Include="..\interpreter\StackIterator.cpp"> 289 <Filter>interpreter</Filter> 290 </ClCompile> 288 291 <ClCompile Include="..\interpreter\VMInspector.cpp"> 289 292 <Filter>interpreter</Filter> … … 1210 1213 </ClInclude> 1211 1214 <ClInclude Include="..\interpreter\Register.h"> 1215 <Filter>interpreter</Filter> 1216 </ClInclude> 1217 <ClInclude Include="..\interpreter\StackIterator.h"> 1218 <Filter>interpreter</Filter> 1219 </ClInclude> 1220 <ClInclude Include="..\interpreter\StackIteratorPrivate.h"> 1212 1221 <Filter>interpreter</Filter> 1213 1222 </ClInclude> -
branches/dfgFourthTier/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r151649 r151651 955 955 FE4A331F15BD2E07006F54F3 /* VMInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE4A331D15BD2E07006F54F3 /* VMInspector.cpp */; }; 956 956 FE4A332015BD2E07006F54F3 /* VMInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = FE4A331E15BD2E07006F54F3 /* VMInspector.h */; settings = {ATTRIBUTES = (Private, ); }; }; 957 FE526BD517663A8400B120DC /* StackIteratorPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = FE526BD417663A8400B120DC /* StackIteratorPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 958 FE67DB9317519B4A006A814F /* JSStackInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = FE67DB9017519B4A006A814F /* JSStackInlines.h */; }; 959 FE67DB9417519B4A006A814F /* StackIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE67DB9117519B4A006A814F /* StackIterator.cpp */; }; 960 FE67DB9517519B4A006A814F /* StackIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = FE67DB9217519B4A006A814F /* StackIterator.h */; settings = {ATTRIBUTES = (Private, ); }; }; 957 961 FE940322174442590047CF6E /* JITStubsX86Common.h in Headers */ = {isa = PBXBuildFile; fileRef = FE940321174442590047CF6E /* JITStubsX86Common.h */; settings = {ATTRIBUTES = (Private, ); }; }; 958 962 FECE74571745456500FF9300 /* MacroAssemblerX86Common.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FECE74561745456500FF9300 /* MacroAssemblerX86Common.cpp */; }; … … 1992 1996 FE4A331D15BD2E07006F54F3 /* VMInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VMInspector.cpp; sourceTree = "<group>"; }; 1993 1997 FE4A331E15BD2E07006F54F3 /* VMInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMInspector.h; sourceTree = "<group>"; }; 1998 FE526BD417663A8400B120DC /* StackIteratorPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackIteratorPrivate.h; sourceTree = "<group>"; }; 1999 FE67DB9017519B4A006A814F /* JSStackInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStackInlines.h; sourceTree = "<group>"; }; 2000 FE67DB9117519B4A006A814F /* StackIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StackIterator.cpp; sourceTree = "<group>"; }; 2001 FE67DB9217519B4A006A814F /* StackIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackIterator.h; sourceTree = "<group>"; }; 1994 2002 FE940321174442590047CF6E /* JITStubsX86Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITStubsX86Common.h; sourceTree = "<group>"; }; 1995 2003 FECE74561745456500FF9300 /* MacroAssemblerX86Common.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacroAssemblerX86Common.cpp; sourceTree = "<group>"; }; … … 2283 2291 1429D85B0ED218E900B89619 /* JSStack.cpp */, 2284 2292 14D792640DAA03FB001A9F05 /* JSStack.h */, 2293 FE67DB9017519B4A006A814F /* JSStackInlines.h */, 2285 2294 149B24FF0D8AF6D1009CB8C7 /* Register.h */, 2295 FE67DB9117519B4A006A814F /* StackIterator.cpp */, 2296 FE67DB9217519B4A006A814F /* StackIterator.h */, 2297 FE526BD417663A8400B120DC /* StackIteratorPrivate.h */, 2286 2298 FE4A331D15BD2E07006F54F3 /* VMInspector.cpp */, 2287 2299 FE4A331E15BD2E07006F54F3 /* VMInspector.h */, … … 3264 3276 0F63945515D07057006A597C /* ArrayProfile.h in Headers */, 3265 3277 BC18C3E70E16F5CD00B34460 /* ArrayPrototype.h in Headers */, 3278 FE67DB9517519B4A006A814F /* StackIterator.h in Headers */, 3279 FE526BD517663A8400B120DC /* StackIteratorPrivate.h in Headers */, 3266 3280 FEF6835F174343CC00A32E25 /* JITStubsARMv7.h in Headers */, 3267 3281 FE24596217601D580074FCE0 /* CallFrameInlines.h in Headers */, … … 3697 3711 14DF04DA16B3996D0016A513 /* StaticPropertyAnalysis.h in Headers */, 3698 3712 14CA958B16AB50DE00938A06 /* StaticPropertyAnalyzer.h in Headers */, 3713 FE67DB9317519B4A006A814F /* JSStackInlines.h in Headers */, 3699 3714 A730B6121250068F009D25B1 /* StrictEvalActivation.h in Headers */, 3700 3715 BC18C4660E16F5CD00B34460 /* StringConstructor.h in Headers */, … … 4230 4245 86DB64640F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp in Sources */, 4231 4246 0F56A1D515001CF4002992B1 /* ExecutionCounter.cpp in Sources */, 4247 FE67DB9417519B4A006A814F /* StackIterator.cpp in Sources */, 4232 4248 0FB105851675480F00F8AB6E /* ExitKind.cpp in Sources */, 4233 4249 0FDB2CCF1742D7D8007B3C1B /* FTLJITFinalizer.cpp in Sources */, -
branches/dfgFourthTier/Source/JavaScriptCore/Target.pri
r151500 r151651 171 171 interpreter/Interpreter.cpp \ 172 172 interpreter/JSStack.cpp \ 173 interpreter/StackIterator.cpp \ 173 174 jit/ClosureCallStubRoutine.cpp \ 174 175 jit/ExecutableAllocatorFixedVMPool.cpp \ -
branches/dfgFourthTier/Source/JavaScriptCore/interpreter/CallFrame.cpp
r151500 r151651 68 68 69 69 #if ENABLE(DFG_JIT) 70 CallFrame* CallFrame::trueCallFrame()71 {72 // Am I an inline call frame? If so, we're done.73 if (isInlinedFrame())74 return this;75 76 // If I don't have a code block, then I'm not DFG code, so I'm the true call frame.77 CodeBlock* machineCodeBlock = codeBlock();78 if (!machineCodeBlock)79 return this;80 81 // If the code block does not have any code origins, then there was no inlining, so82 // I'm done.83 if (!machineCodeBlock->hasCodeOrigins())84 return this;85 86 // Try to determine the CodeOrigin. If we don't have a pc set then the only way87 // that this makes sense is if the CodeOrigin index was set in the call frame.88 CodeOrigin codeOrigin;89 unsigned index = locationAsCodeOriginIndex();90 ASSERT(machineCodeBlock->canGetCodeOrigin(index));91 if (!machineCodeBlock->canGetCodeOrigin(index)) {92 // See above. In release builds, we try to protect ourselves from crashing even93 // though stack walking will be goofed up.94 return 0;95 }96 codeOrigin = machineCodeBlock->codeOrigin(index);97 98 if (!codeOrigin.inlineCallFrame)99 return this; // Not currently in inlined code.100 101 CodeOrigin innerMostCodeOrigin = codeOrigin;102 103 for (InlineCallFrame* inlineCallFrame = codeOrigin.inlineCallFrame; inlineCallFrame;) {104 InlineCallFrame* nextInlineCallFrame = inlineCallFrame->caller.inlineCallFrame;105 106 CallFrame* inlinedCaller = this + inlineCallFrame->stackOffset;107 108 JSFunction* calleeAsFunction = inlineCallFrame->callee.get();109 110 // Fill in the inlinedCaller111 inlinedCaller->setCodeBlock(inlineCallFrame->baselineCodeBlock());112 if (calleeAsFunction)113 inlinedCaller->setScope(calleeAsFunction->scope());114 if (nextInlineCallFrame)115 inlinedCaller->setCallerFrame(this + nextInlineCallFrame->stackOffset);116 else117 inlinedCaller->setCallerFrame(this);118 119 inlinedCaller->setInlineCallFrame(inlineCallFrame);120 inlinedCaller->setArgumentCountIncludingThis(inlineCallFrame->arguments.size());121 inlinedCaller->setLocationAsBytecodeOffset(codeOrigin.bytecodeIndex);122 inlinedCaller->setIsInlinedFrame();123 if (calleeAsFunction)124 inlinedCaller->setCallee(calleeAsFunction);125 126 codeOrigin = inlineCallFrame->caller;127 inlineCallFrame = nextInlineCallFrame;128 }129 130 return this + innerMostCodeOrigin.inlineCallFrame->stackOffset;131 }132 133 CallFrame* CallFrame::trueCallerFrame()134 {135 CallFrame* callerFrame = this->callerFrame()->removeHostCallFrameFlag();136 if (!codeBlock())137 return callerFrame;138 139 // this -> The callee; this is either an inlined callee in which case it already has140 // a pointer to the true caller. Otherwise it contains current PC in the machine141 // caller.142 //143 // machineCaller -> The caller according to the machine, which may be zero or144 // more frames above the true caller due to inlining.145 146 // Am I an inline call frame? If so, we're done.147 if (isInlinedFrame())148 return callerFrame;149 150 // I am a machine call frame, so the question is: is my caller a machine call frame151 // that has inlines or a machine call frame that doesn't?152 if (!callerFrame)153 return 0;154 155 if (!callerFrame->codeBlock())156 return callerFrame;157 ASSERT(!callerFrame->isInlinedFrame());158 159 return callerFrame->trueCallFrame()->removeHostCallFrameFlag();160 }161 162 70 unsigned CallFrame::bytecodeOffsetFromCodeOriginIndex() 163 71 { -
branches/dfgFourthTier/Source/JavaScriptCore/interpreter/CallFrame.h
r151548 r151651 29 29 #include "MacroAssemblerCodeRef.h" 30 30 #include "Register.h" 31 #include "StackIteratorPrivate.h" 31 32 32 33 namespace JSC { … … 274 275 #if ENABLE(DFG_JIT) 275 276 void setInlineCallFrame(InlineCallFrame* inlineCallFrame) { static_cast<Register*>(this)[JSStack::ReturnPC] = inlineCallFrame; } 276 277 // Call this to get the semantically correct JS CallFrame* for the278 // currently executing function.279 CallFrame* trueCallFrame();280 281 // Call this to get the semantically correct JS CallFrame* corresponding282 // to the caller. This resolves issues surrounding inlining and the283 // HostCallFrameFlag stuff.284 CallFrame* trueCallerFrame();285 #else286 CallFrame* trueCallFrame() { return this; }287 CallFrame* trueCallerFrame() { return callerFrame()->removeHostCallFrameFlag(); }288 277 #endif 289 278 CallFrame* callerFrameNoFlags() { return callerFrame()->removeHostCallFrameFlag(); } 279 280 inline StackIterator begin(StackIterator::FrameFilter = nullptr); 281 inline StackIterator find(JSFunction* calleeFunctionObj, StackIterator::FrameFilter = nullptr); 282 inline StackIterator::Frame* end(); 290 283 291 284 private: -
branches/dfgFourthTier/Source/JavaScriptCore/interpreter/CallFrameInlines.h
r151329 r151651 169 169 } 170 170 171 inline StackIterator CallFrame::begin(StackIterator::FrameFilter filter) 172 { 173 ASSERT(this); 174 return StackIterator(this, filter); 175 } 176 177 inline StackIterator CallFrame::find(JSFunction* calleeFunctionObj, StackIterator::FrameFilter filter) 178 { 179 ASSERT(this); 180 StackIterator iter = StackIterator(this, filter); 181 iter.find(calleeFunctionObj); 182 return iter; 183 } 184 185 inline StackIterator::Frame* CallFrame::end() 186 { 187 return StackIterator::end(); 188 } 189 171 190 } // namespace JSC 172 191 -
branches/dfgFourthTier/Source/JavaScriptCore/interpreter/Interpreter.cpp
r151500 r151651 64 64 #include "Register.h" 65 65 #include "SamplingTool.h" 66 #include "StackIterator.h" 66 67 #include "StrictEvalActivation.h" 67 68 #include "StrongInlines.h" … … 201 202 202 203 203 static CallFrame* getCallerInfo(VM*, CallFrame*, unsigned& bytecodeOffset, CodeBlock*& callerOut);204 205 204 JSValue eval(CallFrame* callFrame) 206 205 { … … 411 410 dataLogF("[ReturnJITPC] | %10p | %p \n", it, pc.jitReturnAddress().value()); 412 411 #endif 413 unsigned bytecodeOffset = 0; 414 int line = 0; 415 CodeBlock* callerCodeBlock = 0; 416 getCallerInfo(&callFrame->vm(), callFrame, bytecodeOffset, callerCodeBlock); 417 line = callerCodeBlock->lineNumberForBytecodeOffset(bytecodeOffset); 418 dataLogF("[ReturnVPC] | %10p | %d (line %d)\n", it, bytecodeOffset, line); 419 ++it; 412 StackIterator iter = callFrame->begin(); 413 ++iter; 414 if (iter != callFrame->end()) { 415 dataLogF("[ReturnVPC] | %10p | %d (line %d)\n", it, iter->bytecodeOffset(), iter->line()); 416 ++it; 417 } 420 418 dataLogF("[CodeBlock] | %10p | %p \n", it, callFrame->codeBlock()); 421 419 ++it; … … 466 464 } 467 465 468 NEVER_INLINE bool Interpreter::unwindCallFrame(CallFrame*& callFrame, JSValue exceptionValue, unsigned& bytecodeOffset, CodeBlock*& codeBlock) 469 { 466 NEVER_INLINE bool Interpreter::unwindCallFrame(StackIterator& iter, JSValue exceptionValue) 467 { 468 CallFrame* callFrame = iter->callFrame(); 469 CodeBlock* codeBlock = iter->codeBlock(); 470 470 CodeBlock* oldCodeBlock = codeBlock; 471 471 JSScope* scope = callFrame->scope(); … … 497 497 CallFrame* callerFrame = callFrame->callerFrame(); 498 498 callFrame->vm().topCallFrame = callerFrame; 499 if (callerFrame->hasHostCallFrameFlag()) 500 return false; 501 callFrame = getCallerInfo(&callFrame->vm(), callFrame, bytecodeOffset, codeBlock); 502 return true; 499 return !callerFrame->hasHostCallFrameFlag(); 503 500 } 504 501 … … 555 552 } 556 553 557 static unsigned getBytecodeOffsetForCallFrame(CallFrame* callFrame)558 {559 callFrame = callFrame->removeHostCallFrameFlag();560 CodeBlock* codeBlock = callFrame->codeBlock();561 if (!codeBlock)562 return 0;563 #if ENABLE(JIT)564 #if ENABLE(DFG_JIT)565 if (JITCode::isOptimizingJIT(codeBlock->jitType()))566 return codeBlock->codeOrigin(callFrame->locationAsCodeOriginIndex()).bytecodeIndex;567 #endif568 return callFrame->locationAsBytecodeOffset();569 #endif570 }571 572 static CallFrame* getCallerInfo(VM* vm, CallFrame* callFrame, unsigned& bytecodeOffset, CodeBlock*& caller)573 {574 UNUSED_PARAM(vm);575 bytecodeOffset = 0;576 ASSERT(!callFrame->hasHostCallFrameFlag());577 CallFrame* trueCallerFrame = callFrame->trueCallerFrame();578 ASSERT(!trueCallerFrame->hasHostCallFrameFlag());579 580 if (trueCallerFrame == CallFrame::noCaller() || !trueCallerFrame || !trueCallerFrame->codeBlock()) {581 caller = 0;582 return trueCallerFrame;583 }584 585 CodeBlock* callerCodeBlock = trueCallerFrame->codeBlock();586 #if ENABLE(DFG_JIT)587 if (trueCallerFrame->hasLocationAsCodeOriginIndex())588 bytecodeOffset = trueCallerFrame->bytecodeOffsetFromCodeOriginIndex();589 else590 #endif // ENABLE(DFG_JIT)591 bytecodeOffset = trueCallerFrame->locationAsBytecodeOffset();592 593 caller = callerCodeBlock;594 return trueCallerFrame;595 }596 597 static ALWAYS_INLINE const String getSourceURLFromCallFrame(CallFrame* callFrame)598 {599 ASSERT(!callFrame->hasHostCallFrameFlag());600 return callFrame->codeBlock()->ownerExecutable()->sourceURL();601 }602 603 static StackFrameCodeType getStackFrameCodeType(CallFrame* callFrame)604 {605 ASSERT(!callFrame->hasHostCallFrameFlag());606 607 switch (callFrame->codeBlock()->codeType()) {608 case EvalCode:609 return StackFrameEvalCode;610 case FunctionCode:611 return StackFrameFunctionCode;612 case GlobalCode:613 return StackFrameGlobalCode;614 }615 RELEASE_ASSERT_NOT_REACHED();616 return StackFrameGlobalCode;617 }618 619 554 unsigned StackFrame::line() 620 555 { … … 663 598 VM& vm = m_vm; 664 599 CallFrame* callFrame = vm.topCallFrame->removeHostCallFrameFlag(); 665 if (!callFrame || callFrame == CallFrame::noCaller())666 return;667 unsigned bytecodeOffset = getBytecodeOffsetForCallFrame(callFrame);668 callFrame = callFrame->trueCallFrame();669 600 if (!callFrame) 670 601 return; 671 CodeBlock* callerCodeBlock = callFrame->codeBlock(); 672 673 while (callFrame && callFrame != CallFrame::noCaller() && maxStackSize--) { 674 String sourceURL; 675 if (callerCodeBlock) { 676 sourceURL = getSourceURLFromCallFrame(callFrame); 677 StackFrame s(Strong<JSObject>(vm, callFrame->callee()), 678 getStackFrameCodeType(callFrame), 679 Strong<ExecutableBase>(vm, callerCodeBlock->ownerExecutable()), 680 Strong<UnlinkedCodeBlock>(vm, callerCodeBlock->unlinkedCodeBlock()), 681 callerCodeBlock->source(), 682 callerCodeBlock->ownerExecutable()->lineNo(), 683 callerCodeBlock->sourceOffset(), 684 bytecodeOffset, 685 sourceURL); 602 603 StackIterator iter = callFrame->begin(); 604 for (; iter != callFrame->end() && maxStackSize--; ++iter) { 605 CodeBlock* codeBlock = iter->codeBlock(); 606 if (codeBlock) { 607 StackFrame s(Strong<JSObject>(vm, iter->callee()), 608 StackFrameCodeType(iter->codeType()), 609 Strong<ExecutableBase>(vm, codeBlock->ownerExecutable()), 610 Strong<UnlinkedCodeBlock>(vm, codeBlock->unlinkedCodeBlock()), 611 codeBlock->source(), 612 codeBlock->ownerExecutable()->lineNo(), 613 codeBlock->sourceOffset(), 614 iter->bytecodeOffset(), 615 iter->sourceURL()); 686 616 results.append(s); 687 617 } else { 688 StackFrame s(Strong<JSObject>(vm, callFrame->callee()), StackFrameNativeCode, Strong<ExecutableBase>(), Strong<UnlinkedCodeBlock>(), 0, 0, 0, 0, String());618 StackFrame s(Strong<JSObject>(vm, iter->callee()), StackFrameNativeCode, Strong<ExecutableBase>(), Strong<UnlinkedCodeBlock>(), 0, 0, 0, 0, String()); 689 619 results.append(s); 690 620 } 691 callFrame = getCallerInfo(&vm, callFrame, bytecodeOffset, callerCodeBlock);692 621 } 693 622 } … … 765 694 // Calculate an exception handler vPC, unwinding call frames as necessary. 766 695 HandlerInfo* handler = 0; 767 while (isTermination || !(handler = codeBlock->handlerForBytecodeOffset(bytecodeOffset))) { 768 if (!unwindCallFrame(callFrame, exceptionValue, bytecodeOffset, codeBlock)) { 769 if (LegacyProfiler* profiler = callFrame->vm().enabledProfiler()) 770 profiler->exceptionUnwind(callFrame); 771 return 0; 772 } 696 VM& vm = callFrame->vm(); 697 ASSERT(callFrame == vm.topCallFrame); 698 for (StackIterator iter = callFrame->begin(); iter != callFrame->end(); ++iter) { 699 callFrame = iter->callFrame(); 700 codeBlock = iter->codeBlock(); 701 bytecodeOffset = iter->bytecodeOffset(); 702 703 if (isTermination || !(handler = codeBlock->handlerForBytecodeOffset(bytecodeOffset))) { 704 if (!unwindCallFrame(iter, exceptionValue)) { 705 if (LegacyProfiler* profiler = vm.enabledProfiler()) 706 profiler->exceptionUnwind(callFrame); 707 return 0; 708 } 709 } else 710 break; 773 711 } 774 712 … … 1369 1307 return; 1370 1308 } 1371 } 1372 1373 JSValue Interpreter::retrieveArgumentsFromVMCode(CallFrame* callFrame, JSFunction* function) const 1374 { 1375 CallFrame* functionCallFrame = findFunctionCallFrameFromVMCode(callFrame, function); 1376 if (!functionCallFrame) 1377 return jsNull(); 1378 1379 Arguments* arguments = Arguments::create(functionCallFrame->vm(), functionCallFrame); 1380 arguments->tearOff(functionCallFrame); 1381 return JSValue(arguments); 1382 } 1383 1384 JSValue Interpreter::retrieveCallerFromVMCode(CallFrame* callFrame, JSFunction* function) const 1385 { 1386 CallFrame* functionCallFrame = findFunctionCallFrameFromVMCode(callFrame, function); 1387 1388 if (!functionCallFrame) 1389 return jsNull(); 1390 1391 unsigned bytecodeOffset; 1392 CodeBlock* unusedCallerCodeBlock = 0; 1393 CallFrame* callerFrame = getCallerInfo(&callFrame->vm(), functionCallFrame, bytecodeOffset, unusedCallerCodeBlock); 1394 if (!callerFrame) 1395 return jsNull(); 1396 JSValue caller = callerFrame->callee(); 1397 if (!caller) 1398 return jsNull(); 1399 1400 // Skip over function bindings. 1401 ASSERT(caller.isObject()); 1402 while (asObject(caller)->inherits(&JSBoundFunction::s_info)) { 1403 callerFrame = getCallerInfo(&callFrame->vm(), callerFrame, bytecodeOffset, unusedCallerCodeBlock); 1404 if (!callerFrame) 1405 return jsNull(); 1406 caller = callerFrame->callee(); 1407 if (!caller) 1408 return jsNull(); 1409 } 1410 1411 return caller; 1412 } 1413 1414 CallFrame* Interpreter::findFunctionCallFrameFromVMCode(CallFrame* callFrame, JSFunction* function) 1415 { 1416 for (CallFrame* candidate = callFrame->trueCallFrame(); candidate; candidate = candidate->trueCallerFrame()) { 1417 if (candidate->callee() == function) 1418 return candidate; 1419 } 1420 return 0; 1421 } 1309 } 1422 1310 1423 1311 void Interpreter::enableSampler() -
branches/dfgFourthTier/Source/JavaScriptCore/interpreter/Interpreter.h
r151500 r151651 57 57 class JSScope; 58 58 class SamplingTool; 59 class StackIterator; 59 60 struct CallFrameClosure; 60 61 struct HandlerInfo; … … 236 237 JSValue execute(EvalExecutable*, CallFrame*, JSValue thisValue, JSScope*); 237 238 238 JSValue retrieveArgumentsFromVMCode(CallFrame*, JSFunction*) const;239 JSValue retrieveCallerFromVMCode(CallFrame*, JSFunction*) const;240 241 239 void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc); 242 240 … … 245 243 NEVER_INLINE HandlerInfo* throwException(CallFrame*&, JSValue&, unsigned bytecodeOffset); 246 244 NEVER_INLINE void debug(CallFrame*, DebugHookID, int firstLine, int lastLine, int column); 247 static const String getTraceLine(CallFrame*, StackFrameCodeType, const String&, int);248 JS_EXPORT_PRIVATE void getStackTrace(Vector<StackFrame>& results, size_t maxStackSize = std::numeric_limits<size_t>::max());249 245 static void addStackTraceIfNecessary(CallFrame*, JSValue error); 250 246 … … 272 268 JSValue execute(CallFrameClosure&); 273 269 274 NEVER_INLINE bool unwindCallFrame(CallFrame*&, JSValue, unsigned& bytecodeOffset, CodeBlock*&); 275 276 static CallFrame* findFunctionCallFrameFromVMCode(CallFrame*, JSFunction*); 270 void getStackTrace(Vector<StackFrame>& results, size_t maxStackSize = std::numeric_limits<size_t>::max()); 271 NEVER_INLINE bool unwindCallFrame(StackIterator&, JSValue); 277 272 278 273 void dumpRegisters(CallFrame*); -
branches/dfgFourthTier/Source/JavaScriptCore/jsc.cpp
r151500 r151651 1 1 /* 2 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012 Apple Inc. All rights reserved.3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012, 2013 Apple Inc. All rights reserved. 4 4 * Copyright (C) 2006 Bjoern Graf (bjoern.graf@gmail.com) 5 5 * … … 39 39 #include "Operations.h" 40 40 #include "SamplingTool.h" 41 #include "StackIterator.h" 41 42 #include "StructureRareDataInlines.h" 42 43 #include <math.h> … … 327 328 trace.appendLiteral("--> Stack trace:\n"); 328 329 329 Vector<StackFrame> stackTrace; 330 exec->interpreter()->getStackTrace(stackTrace); 330 CallFrame* frame = exec->vm().topCallFrame; 331 331 int i = 0; 332 333 for (Vector<StackFrame>::iterator iter = stackTrace.begin(); iter < stackTrace.end(); iter++) { 334 StackFrame level = *iter; 335 trace.append(String::format(" %i %s\n", i, level.toString(exec).utf8().data())); 336 i++; 337 } 332 for (StackIterator iter = frame->begin(); iter != frame->end(); ++iter, ++i) 333 trace.append(String::format(" %i %s\n", i, iter->toString().utf8().data())); 338 334 fprintf(stderr, "%s", trace.toString().utf8().data()); 339 335 return JSValue::encode(jsUndefined()); -
branches/dfgFourthTier/Source/JavaScriptCore/profiler/ProfileGenerator.cpp
r151500 r151651 32 32 #include "JSStringRef.h" 33 33 #include "JSFunction.h" 34 #include "Interpreter.h"35 34 #include "LegacyProfiler.h" 36 35 #include "Operations.h" 37 36 #include "Profile.h" 37 #include "StackIterator.h" 38 38 #include "Tracing.h" 39 39 … … 59 59 void ProfileGenerator::addParentForConsoleStart(ExecState* exec) 60 60 { 61 Vector<StackFrame> stackTrace; 62 exec->interpreter()->getStackTrace(stackTrace, 2); 63 64 m_currentNode = ProfileNode::create(exec, LegacyProfiler::createCallIdentifier(exec, stackTrace[1].callee.get(), stackTrace[1].sourceURL, stackTrace[1].line()), m_head.get(), m_head.get()); 61 StackIterator iter = exec->begin(); 62 ++iter; 63 CallIdentifier identifier = (iter == exec->end()) 64 ? LegacyProfiler::createCallIdentifier(exec, JSValue(), String(), 0) 65 : LegacyProfiler::createCallIdentifier(exec, iter->callee(), iter->sourceURL(), iter->line()); 66 m_currentNode = ProfileNode::create(exec, identifier, m_head.get(), m_head.get()); 67 65 68 m_head->insertNode(m_currentNode.get()); 66 69 } -
branches/dfgFourthTier/Source/JavaScriptCore/profiler/ProfileNode.h
r151500 r151651 41 41 class ProfileNode; 42 42 43 typedef Vector<RefPtr<ProfileNode> >::const_iterator StackIterator;44 43 typedef HashCountedSet<StringImpl*> FunctionCallHashCount; 45 44 … … 132 131 133 132 private: 133 typedef Vector<RefPtr<ProfileNode> >::const_iterator StackIterator; 134 134 135 ProfileNode(ExecState* callerCallFrame, const CallIdentifier&, ProfileNode* headNode, ProfileNode* parentNode); 135 136 ProfileNode(ExecState* callerCallFrame, ProfileNode* headNode, ProfileNode* nodeToCopy); -
branches/dfgFourthTier/Source/JavaScriptCore/runtime/JSFunction.cpp
r151500 r151651 26 26 #include "JSFunction.h" 27 27 28 #include "Arguments.h" 28 29 #include "CodeBlock.h" 29 30 #include "CommonIdentifiers.h" … … 33 34 #include "GetterSetter.h" 34 35 #include "JSArray.h" 36 #include "JSBoundFunction.h" 35 37 #include "JSGlobalObject.h" 36 38 #include "JSNotAnObject.h" … … 41 43 #include "Parser.h" 42 44 #include "PropertyNameArray.h" 45 #include "StackIterator.h" 43 46 44 47 using namespace WTF; … … 179 182 } 180 183 184 static JSValue retrieveArguments(ExecState* exec, JSFunction* functionObj) 185 { 186 StackIterator iter = exec->find(functionObj); 187 return iter != exec->end() ? JSValue(iter->arguments()) : jsNull(); 188 } 189 181 190 JSValue JSFunction::argumentsGetter(ExecState* exec, JSValue slotBase, PropertyName) 182 191 { 183 192 JSFunction* thisObj = jsCast<JSFunction*>(slotBase); 184 193 ASSERT(!thisObj->isHostFunction()); 185 return exec->interpreter()->retrieveArgumentsFromVMCode(exec, thisObj); 194 195 return retrieveArguments(exec, thisObj); 196 } 197 198 static bool skipOverBoundFunctions(StackIterator::Frame* frame) 199 { 200 JSObject* callee = frame->callee(); 201 bool shouldSkip = callee ? callee->inherits(&JSBoundFunction::s_info) : false; 202 return shouldSkip; 203 } 204 205 static JSValue retrieveCallerFunction(ExecState* exec, JSFunction* functionObj) 206 { 207 StackIterator iter = exec->find(functionObj, skipOverBoundFunctions); 208 if (iter != exec->end()) 209 ++iter; 210 return iter != exec->end() && iter->callee() ? iter->callee() : jsNull(); 186 211 } 187 212 … … 190 215 JSFunction* thisObj = jsCast<JSFunction*>(slotBase); 191 216 ASSERT(!thisObj->isHostFunction()); 192 JSValue caller = exec->interpreter()->retrieveCallerFromVMCode(exec, thisObj);217 JSValue caller = retrieveCallerFunction(exec, thisObj); 193 218 194 219 // See ES5.1 15.3.5.4 - Function.caller may not be used to retrieve a strict caller. … … 298 323 return result; 299 324 } 300 descriptor.setDescriptor( exec->interpreter()->retrieveArgumentsFromVMCode(exec, thisObject), ReadOnly | DontEnum | DontDelete);325 descriptor.setDescriptor(retrieveArguments(exec, thisObject), ReadOnly | DontEnum | DontDelete); 301 326 return true; 302 327 } … … 322 347 return result; 323 348 } 324 descriptor.setDescriptor( exec->interpreter()->retrieveCallerFromVMCode(exec, thisObject), ReadOnly | DontEnum | DontDelete);349 descriptor.setDescriptor(retrieveCallerFunction(exec, thisObject), ReadOnly | DontEnum | DontDelete); 325 350 return true; 326 351 } … … 416 441 return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException); 417 442 } 418 valueCheck = !descriptor.value() || sameValue(exec, descriptor.value(), exec->interpreter()->retrieveArgumentsFromVMCode(exec, thisObject));443 valueCheck = !descriptor.value() || sameValue(exec, descriptor.value(), retrieveArguments(exec, thisObject)); 419 444 } else if (propertyName == exec->propertyNames().caller) { 420 445 if (thisObject->jsExecutable()->isStrictMode()) { … … 423 448 return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException); 424 449 } 425 valueCheck = !descriptor.value() || sameValue(exec, descriptor.value(), exec->interpreter()->retrieveCallerFromVMCode(exec, thisObject));450 valueCheck = !descriptor.value() || sameValue(exec, descriptor.value(), retrieveCallerFunction(exec, thisObject)); 426 451 } else if (propertyName == exec->propertyNames().length) 427 452 valueCheck = !descriptor.value() || sameValue(exec, descriptor.value(), jsNumber(thisObject->jsExecutable()->parameterCount())); -
branches/dfgFourthTier/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
r151500 r151651 37 37 #include "Operations.h" 38 38 #include "Parser.h" 39 #include "StackIterator.h" 39 40 #include <wtf/dtoa.h> 40 41 #include <stdio.h> … … 712 713 return JSValue::encode(exec->thisValue().synthesizePrototype(exec)); 713 714 714 if (!thisObject->allowsAccessFrom(exec->trueCallerFrame())) 715 StackIterator iter = exec->begin(); 716 ++iter; 717 if ((iter == exec->end()) || !thisObject->allowsAccessFrom(iter->callFrame())) 715 718 return JSValue::encode(jsUndefined()); 716 719 … … 728 731 return JSValue::encode(jsUndefined()); 729 732 730 if (!thisObject->allowsAccessFrom(exec->trueCallerFrame())) 733 StackIterator iter = exec->begin(); 734 ++iter; 735 if ((iter == exec->end()) || !thisObject->allowsAccessFrom(iter->callFrame())) 731 736 return JSValue::encode(jsUndefined()); 732 737 -
branches/dfgFourthTier/Source/JavaScriptCore/runtime/ObjectConstructor.cpp
r151500 r151651 34 34 #include "PropertyDescriptor.h" 35 35 #include "PropertyNameArray.h" 36 #include "StackIterator.h" 36 37 37 38 namespace JSC { … … 140 141 return throwVMError(exec, createTypeError(exec, ASCIILiteral("Requested prototype of a value that is not an object."))); 141 142 JSObject* object = asObject(exec->argument(0)); 142 if (!object->allowsAccessFrom(exec->trueCallerFrame())) 143 StackIterator iter = exec->begin(); 144 ++iter; 145 if ((iter == exec->end()) || !object->allowsAccessFrom(iter->callFrame())) 143 146 return JSValue::encode(jsUndefined()); 144 147 return JSValue::encode(object->prototype()); -
branches/dfgFourthTier/Source/JavaScriptCore/runtime/Operations.h
r151569 r151651 23 23 #define Operations_h 24 24 25 #include "CallFrameInlines.h" 25 26 #include "ExceptionHelpers.h" 26 27 #include "Interpreter.h" -
branches/dfgFourthTier/Source/WebCore/ChangeLog
r151618 r151651 1 2013-06-14 Mark Lam <mark.lam@apple.com> 2 3 Rolling r151456, r151420 back in with some fixes. 4 https://bugs.webkit.org/show_bug.cgi?id=117390. 5 6 Reviewed by Geoffrey Garen. 7 8 No new tests. 9 10 * ForwardingHeaders/interpreter/StackIterator.h: Copied from Source/WebCore/ForwardingHeaders/interpreter/StackIterator.h. 11 * bindings/js/JSXMLHttpRequestCustom.cpp: 12 (WebCore::JSXMLHttpRequest::send): 13 * bindings/js/ScriptCallStackFactory.cpp: 14 (WebCore::createScriptCallStack): 15 1 16 2013-06-15 Filip Pizlo <fpizlo@apple.com> 2 17 -
branches/dfgFourthTier/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
r151500 r151651 48 48 #include "JSEventListener.h" 49 49 #include "XMLHttpRequest.h" 50 #include <interpreter/StackIterator.h> 50 51 #include <runtime/Error.h> 51 #include <interpreter/Interpreter.h>52 52 #include <wtf/ArrayBuffer.h> 53 53 … … 134 134 } 135 135 136 Vector<StackFrame> stackTrace(2); 137 exec->interpreter()->getStackTrace(stackTrace, 2); 138 impl()->setLastSendLineNumber(stackTrace[1].line()); 139 impl()->setLastSendURL(stackTrace[1].sourceURL); 136 StackIterator iter = exec->begin(); 137 ++iter; 138 if (iter != exec->end()) { 139 impl()->setLastSendLineNumber(iter->line()); 140 impl()->setLastSendURL(iter->sourceURL()); 141 } else { 142 impl()->setLastSendLineNumber(0); 143 impl()->setLastSendURL(String()); 144 } 140 145 141 146 setDOMException(exec, ec); -
branches/dfgFourthTier/Source/WebCore/bindings/js/ScriptCallStackFactory.cpp
r151500 r151651 41 41 #include "ScriptValue.h" 42 42 #include <interpreter/CallFrame.h> 43 #include <interpreter/ Interpreter.h>43 #include <interpreter/StackIterator.h> 44 44 #include <runtime/ArgList.h> 45 45 #include <runtime/JSCJSValue.h> … … 58 58 Vector<ScriptCallFrame> frames; 59 59 if (JSC::ExecState* exec = JSMainThreadExecState::currentState()) { 60 Vector<StackFrame> stackTrace;61 exec->interpreter()->getStackTrace(stackTrace, maxStackSize);62 for ( size_t i = 0; i < stackTrace.size(); i++)63 frames.append(ScriptCallFrame( stackTrace[i].friendlyFunctionName(exec), stackTrace[i].friendlySourceURL(), stackTrace[i].line(), stackTrace[i].column()));60 ASSERT(exec); 61 CallFrame* frame = exec->vm().topCallFrame; 62 for (StackIterator iter = frame->begin(); iter != frame->end() && maxStackSize--; ++iter) 63 frames.append(ScriptCallFrame(iter->functionName(), iter->sourceURL(), iter->line(), iter->column())); 64 64 } 65 65 if (frames.isEmpty() && !emptyIsAllowed) { … … 75 75 { 76 76 Vector<ScriptCallFrame> frames; 77 Vector<StackFrame> stackTrace; 78 exec->interpreter()->getStackTrace(stackTrace, maxStackSize + 1); 79 for (size_t i = stackTrace.size() == 1 ? 0 : 1; i < stackTrace.size(); i++) { 77 ASSERT(exec); 78 CallFrame* frame = exec->vm().topCallFrame; 79 StackIterator iter = frame->begin(); 80 for (++iter; iter != frame->end() && maxStackSize--; ++iter) { 80 81 // This early exit is necessary to maintain our old behaviour 81 82 // but the stack trace we produce now is complete and handles all 82 83 // ways in which code may be running 83 if (! stackTrace[i].callee&& frames.size())84 if (!iter->callee() && frames.size()) 84 85 break; 85 86 String functionName = stackTrace[i].friendlyFunctionName(exec); 87 frames.append(ScriptCallFrame(functionName, stackTrace[i].sourceURL, stackTrace[i].line(), stackTrace[i].column())); 86 frames.append(ScriptCallFrame(iter->functionName(), iter->sourceURL(), iter->line(), iter->column())); 88 87 } 89 90 88 return ScriptCallStack::create(frames); 91 89 }
Note: See TracChangeset
for help on using the changeset viewer.