Commit fa2a142f authored by mark.lam@apple.com's avatar mark.lam@apple.com
Browse files

Renamed StackIterator to StackVisitor.

https://bugs.webkit.org/show_bug.cgi?id=120706.

Reviewed by Geoffrey Garen.

Source/JavaScriptCore: 

Also did some minor refactoring:
- Renamed StackIterator::iterate() to StackVisitor::visit().
- Make StackVisitor::visit() a static method.
- Move the instantiation of the StackVisitor instance into StackVisitor::visit()
  from CallFrame::iterate().
- Removed StackIterator::resetIterator() and inline its body into the
  StackVisitor constructor since this is the only remaining caller of it.

* API/JSContextRef.cpp:
(BacktraceFunctor::operator()):
* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* interpreter/CallFrame.h:
(JSC::ExecState::iterate):
* interpreter/Interpreter.cpp:
(JSC::DumpRegisterFunctor::operator()):
(JSC::unwindCallFrame):
(JSC::getStackFrameCodeType):
(JSC::GetStackTraceFunctor::operator()):
(JSC::UnwindFunctor::operator()):
* interpreter/Interpreter.h:
* interpreter/StackIterator.cpp: Removed.
* interpreter/StackIterator.h: Removed.
* interpreter/StackVisitor.cpp: Copied from Source/JavaScriptCore/interpreter/StackIterator.cpp.
(JSC::StackVisitor::StackVisitor):
(JSC::StackVisitor::gotoNextFrame):
(JSC::StackVisitor::readFrame):
(JSC::StackVisitor::readNonInlinedFrame):
(JSC::StackVisitor::readInlinedFrame):
(JSC::StackVisitor::Frame::codeType):
(JSC::StackVisitor::Frame::functionName):
(JSC::StackVisitor::Frame::sourceURL):
(JSC::StackVisitor::Frame::toString):
(JSC::StackVisitor::Frame::arguments):
(JSC::StackVisitor::Frame::computeLineAndColumn):
(JSC::StackVisitor::Frame::retrieveExpressionInfo):
(JSC::StackVisitor::Frame::setToEnd):
(JSC::StackVisitor::Frame::print):
(DebugPrintFrameFunctor::operator()):
* interpreter/StackVisitor.h: Copied from Source/JavaScriptCore/interpreter/StackIterator.h.
(JSC::StackVisitor::visit):
* jsc.cpp:
(FunctionJSCStackFunctor::operator()):
* profiler/ProfileGenerator.cpp:
(JSC::AddParentForConsoleStartFunctor::operator()):
* runtime/JSFunction.cpp:
(JSC::RetrieveArgumentsFunctor::operator()):
(JSC::RetrieveCallerFunctionFunctor::operator()):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::GlobalFuncProtoGetterFunctor::operator()):
(JSC::GlobalFuncProtoSetterFunctor::operator()):
* runtime/ObjectConstructor.cpp:
(JSC::ObjectConstructorGetPrototypeOfFunctor::operator()):

Source/WebCore: 

No new tests.

* ForwardingHeaders/interpreter/StackIterator.h: Removed.
* ForwardingHeaders/interpreter/StackVisitor.h: Copied from Source/WebCore/ForwardingHeaders/interpreter/StackIterator.h.
* bindings/js/JSXMLHttpRequestCustom.cpp:
(WebCore::SendFunctor::operator()):
* bindings/js/ScriptCallStackFactory.cpp:
(WebCore::CreateScriptCallStackFunctor::operator()):
(WebCore::CreateScriptCallStackForConsoleFunctor::operator()):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a23b6f92
......@@ -37,7 +37,7 @@
#include "JSObject.h"
#include "Operations.h"
#include "SourceProvider.h"
#include "StackIterator.h"
#include "StackVisitor.h"
#include <wtf/text/StringBuilder.h>
#include <wtf/text/StringHash.h>
......@@ -221,39 +221,39 @@ public:
{
}
StackIterator::Status operator()(StackIterator& iter)
StackVisitor::Status operator()(StackVisitor& visitor)
{
if (m_remainingCapacityForFrameCapture) {
// If callee is unknown, but we've not added any frame yet, we should
// still add the frame, because something called us, and gave us arguments.
JSObject* callee = iter->callee();
if (!callee && iter->index())
return StackIterator::Done;
JSObject* callee = visitor->callee();
if (!callee && visitor->index())
return StackVisitor::Done;
StringBuilder& builder = m_builder;
if (!builder.isEmpty())
builder.append('\n');
builder.append('#');
builder.appendNumber(iter->index());
builder.appendNumber(visitor->index());
builder.append(' ');
builder.append(iter->functionName());
builder.append(visitor->functionName());
builder.appendLiteral("() at ");
builder.append(iter->sourceURL());
if (iter->isJSFrame()) {
builder.append(visitor->sourceURL());
if (visitor->isJSFrame()) {
builder.append(':');
unsigned lineNumber;
unsigned unusedColumn;
iter->computeLineAndColumn(lineNumber, unusedColumn);
visitor->computeLineAndColumn(lineNumber, unusedColumn);
builder.appendNumber(lineNumber);
}
if (!callee)
return StackIterator::Done;
return StackVisitor::Done;
m_remainingCapacityForFrameCapture--;
return StackIterator::Continue;
return StackVisitor::Continue;
}
return StackIterator::Done;
return StackVisitor::Done;
}
private:
......
......@@ -206,7 +206,7 @@ set(JavaScriptCore_SOURCES
interpreter/CallFrame.cpp
interpreter/Interpreter.cpp
interpreter/JSStack.cpp
interpreter/StackIterator.cpp
interpreter/StackVisitor.cpp
interpreter/VMInspector.cpp
jit/ClosureCallStubRoutine.cpp
......
2013-09-04 Mark Lam <mark.lam@apple.com>
Renamed StackIterator to StackVisitor.
https://bugs.webkit.org/show_bug.cgi?id=120706.
Reviewed by Geoffrey Garen.
Also did some minor refactoring:
- Renamed StackIterator::iterate() to StackVisitor::visit().
- Make StackVisitor::visit() a static method.
- Move the instantiation of the StackVisitor instance into StackVisitor::visit()
from CallFrame::iterate().
- Removed StackIterator::resetIterator() and inline its body into the
StackVisitor constructor since this is the only remaining caller of it.
* API/JSContextRef.cpp:
(BacktraceFunctor::operator()):
* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* interpreter/CallFrame.h:
(JSC::ExecState::iterate):
* interpreter/Interpreter.cpp:
(JSC::DumpRegisterFunctor::operator()):
(JSC::unwindCallFrame):
(JSC::getStackFrameCodeType):
(JSC::GetStackTraceFunctor::operator()):
(JSC::UnwindFunctor::operator()):
* interpreter/Interpreter.h:
* interpreter/StackIterator.cpp: Removed.
* interpreter/StackIterator.h: Removed.
* interpreter/StackVisitor.cpp: Copied from Source/JavaScriptCore/interpreter/StackIterator.cpp.
(JSC::StackVisitor::StackVisitor):
(JSC::StackVisitor::gotoNextFrame):
(JSC::StackVisitor::readFrame):
(JSC::StackVisitor::readNonInlinedFrame):
(JSC::StackVisitor::readInlinedFrame):
(JSC::StackVisitor::Frame::codeType):
(JSC::StackVisitor::Frame::functionName):
(JSC::StackVisitor::Frame::sourceURL):
(JSC::StackVisitor::Frame::toString):
(JSC::StackVisitor::Frame::arguments):
(JSC::StackVisitor::Frame::computeLineAndColumn):
(JSC::StackVisitor::Frame::retrieveExpressionInfo):
(JSC::StackVisitor::Frame::setToEnd):
(JSC::StackVisitor::Frame::print):
(DebugPrintFrameFunctor::operator()):
* interpreter/StackVisitor.h: Copied from Source/JavaScriptCore/interpreter/StackIterator.h.
(JSC::StackVisitor::visit):
* jsc.cpp:
(FunctionJSCStackFunctor::operator()):
* profiler/ProfileGenerator.cpp:
(JSC::AddParentForConsoleStartFunctor::operator()):
* runtime/JSFunction.cpp:
(JSC::RetrieveArgumentsFunctor::operator()):
(JSC::RetrieveCallerFunctionFunctor::operator()):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::GlobalFuncProtoGetterFunctor::operator()):
(JSC::GlobalFuncProtoSetterFunctor::operator()):
* runtime/ObjectConstructor.cpp:
(JSC::ObjectConstructorGetPrototypeOfFunctor::operator()):
2013-09-04 Roger Fong <roger_fong@apple.com>
 
Unreviewed Build fix for Windows DebugSuffix configuration.
......
......@@ -589,8 +589,8 @@ javascriptcore_sources += \
Source/JavaScriptCore/interpreter/JSStack.h \
Source/JavaScriptCore/interpreter/JSStackInlines.h \
Source/JavaScriptCore/interpreter/Register.h \
Source/JavaScriptCore/interpreter/StackIterator.cpp \
Source/JavaScriptCore/interpreter/StackIterator.h \
Source/JavaScriptCore/interpreter/StackVisitor.cpp \
Source/JavaScriptCore/interpreter/StackVisitor.h \
Source/JavaScriptCore/interpreter/VMInspector.cpp \
Source/JavaScriptCore/interpreter/VMInspector.h \
Source/JavaScriptCore/JavaScriptCorePrefix.h \
......
......@@ -360,7 +360,7 @@
<ClCompile Include="..\interpreter\CallFrame.cpp" />
<ClCompile Include="..\interpreter\Interpreter.cpp" />
<ClCompile Include="..\interpreter\JSStack.cpp" />
<ClCompile Include="..\interpreter\StackIterator.cpp" />
<ClCompile Include="..\interpreter\StackVisitor.cpp" />
<ClCompile Include="..\interpreter\VMInspector.cpp" />
<ClCompile Include="..\jit\ClosureCallStubRoutine.cpp" />
<ClCompile Include="..\jit\ExecutableAllocator.cpp" />
......@@ -743,7 +743,7 @@
<ClInclude Include="..\interpreter\JSStack.h" />
<ClInclude Include="..\interpreter\JSStackInlines.h" />
<ClInclude Include="..\interpreter\Register.h" />
<ClInclude Include="..\interpreter\StackIterator.h" />
<ClInclude Include="..\interpreter\StackVisitor.h" />
<ClInclude Include="..\interpreter\VMInspector.h" />
<ClInclude Include="..\jit\ClosureCallStubRoutine.h" />
<ClInclude Include="..\jit\CompactJITCodeMap.h" />
......
......@@ -285,7 +285,7 @@
<ClCompile Include="..\interpreter\JSStack.cpp">
<Filter>interpreter</Filter>
</ClCompile>
<ClCompile Include="..\interpreter\StackIterator.cpp">
<ClCompile Include="..\interpreter\StackVisitor.cpp">
<Filter>interpreter</Filter>
</ClCompile>
<ClCompile Include="..\interpreter\VMInspector.cpp">
......@@ -1329,7 +1329,7 @@
<ClInclude Include="..\interpreter\Register.h">
<Filter>interpreter</Filter>
</ClInclude>
<ClInclude Include="..\interpreter\StackIterator.h">
<ClInclude Include="..\interpreter\StackVisitor.h">
<Filter>interpreter</Filter>
</ClInclude>
<ClInclude Include="..\interpreter\VMInspector.h">
......
......@@ -935,8 +935,8 @@
A7C1E8E4112E72EF00A37F98 /* JITPropertyAccess32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7C1E8C8112E701C00A37F98 /* JITPropertyAccess32_64.cpp */; };
A7C1EAEF17987AB600299DB2 /* CallFrameInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = A7C1EAEA17987AB600299DB2 /* CallFrameInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7C1EAF017987AB600299DB2 /* JSStackInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = A7C1EAEB17987AB600299DB2 /* JSStackInlines.h */; };
A7C1EAF117987AB600299DB2 /* StackIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7C1EAEC17987AB600299DB2 /* StackIterator.cpp */; };
A7C1EAF217987AB600299DB2 /* StackIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = A7C1EAED17987AB600299DB2 /* StackIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7C1EAF117987AB600299DB2 /* StackVisitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7C1EAEC17987AB600299DB2 /* StackVisitor.cpp */; };
A7C1EAF217987AB600299DB2 /* StackVisitor.h in Headers */ = {isa = PBXBuildFile; fileRef = A7C1EAED17987AB600299DB2 /* StackVisitor.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7D89CF217A0B8CC00773AD8 /* DFGBasicBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D89CE317A0B8CC00773AD8 /* DFGBasicBlock.cpp */; };
A7D89CF317A0B8CC00773AD8 /* DFGBlockInsertionSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D89CE417A0B8CC00773AD8 /* DFGBlockInsertionSet.cpp */; };
A7D89CF417A0B8CC00773AD8 /* DFGBlockInsertionSet.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D89CE517A0B8CC00773AD8 /* DFGBlockInsertionSet.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -2139,8 +2139,8 @@
A7C1E8C8112E701C00A37F98 /* JITPropertyAccess32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITPropertyAccess32_64.cpp; sourceTree = "<group>"; };
A7C1EAEA17987AB600299DB2 /* CallFrameInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallFrameInlines.h; sourceTree = "<group>"; };
A7C1EAEB17987AB600299DB2 /* JSStackInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStackInlines.h; sourceTree = "<group>"; };
A7C1EAEC17987AB600299DB2 /* StackIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StackIterator.cpp; sourceTree = "<group>"; };
A7C1EAED17987AB600299DB2 /* StackIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackIterator.h; sourceTree = "<group>"; };
A7C1EAEC17987AB600299DB2 /* StackVisitor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StackVisitor.cpp; sourceTree = "<group>"; };
A7C1EAED17987AB600299DB2 /* StackVisitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackVisitor.h; sourceTree = "<group>"; };
A7C225CC139981F100FF1662 /* KeywordLookupGenerator.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = KeywordLookupGenerator.py; sourceTree = "<group>"; };
A7C225CD1399849C00FF1662 /* KeywordLookup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeywordLookup.h; sourceTree = "<group>"; };
A7D89CE317A0B8CC00773AD8 /* DFGBasicBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGBasicBlock.cpp; path = dfg/DFGBasicBlock.cpp; sourceTree = "<group>"; };
......@@ -2669,8 +2669,8 @@
14D792640DAA03FB001A9F05 /* JSStack.h */,
A7C1EAEB17987AB600299DB2 /* JSStackInlines.h */,
149B24FF0D8AF6D1009CB8C7 /* Register.h */,
A7C1EAEC17987AB600299DB2 /* StackIterator.cpp */,
A7C1EAED17987AB600299DB2 /* StackIterator.h */,
A7C1EAEC17987AB600299DB2 /* StackVisitor.cpp */,
A7C1EAED17987AB600299DB2 /* StackVisitor.h */,
FE4A331D15BD2E07006F54F3 /* VMInspector.cpp */,
FE4A331E15BD2E07006F54F3 /* VMInspector.h */,
);
......@@ -4386,7 +4386,7 @@
0F5541B21613C1FB00CE3E25 /* SpecialPointer.h in Headers */,
0FD8A31C17D51F2200CA2C40 /* FTLOSREntry.h in Headers */,
0FD82E54141DAEEE00179C94 /* SpeculatedType.h in Headers */,
A7C1EAF217987AB600299DB2 /* StackIterator.h in Headers */,
A7C1EAF217987AB600299DB2 /* StackVisitor.h in Headers */,
14DF04DA16B3996D0016A513 /* StaticPropertyAnalysis.h in Headers */,
14CA958B16AB50DE00938A06 /* StaticPropertyAnalyzer.h in Headers */,
A730B6121250068F009D25B1 /* StrictEvalActivation.h in Headers */,
......@@ -5174,7 +5174,7 @@
0F0CD4C415F6B6BB0032F1C0 /* SparseArrayValueMap.cpp in Sources */,
0F5541B11613C1FB00CE3E25 /* SpecialPointer.cpp in Sources */,
0FD82E86141F3FF100179C94 /* SpeculatedType.cpp in Sources */,
A7C1EAF117987AB600299DB2 /* StackIterator.cpp in Sources */,
A7C1EAF117987AB600299DB2 /* StackVisitor.cpp in Sources */,
A730B6131250068F009D25B1 /* StrictEvalActivation.cpp in Sources */,
14469DEB107EC7E700650446 /* StringConstructor.cpp in Sources */,
14469DEC107EC7E700650446 /* StringObject.cpp in Sources */,
......
......@@ -205,7 +205,7 @@ SOURCES += \
interpreter/CallFrame.cpp \
interpreter/Interpreter.cpp \
interpreter/JSStack.cpp \
interpreter/StackIterator.cpp \
interpreter/StackVisitor.cpp \
jit/ClosureCallStubRoutine.cpp \
jit/ExecutableAllocatorFixedVMPool.cpp \
jit/ExecutableAllocator.cpp \
......
......@@ -28,7 +28,7 @@
#include "JSStack.h"
#include "MacroAssemblerCodeRef.h"
#include "Register.h"
#include "StackIterator.h"
#include "StackVisitor.h"
namespace JSC {
......@@ -284,12 +284,11 @@ namespace JSC {
CallFrame* callerFrameNoFlags() { return callerFrame()->removeHostCallFrameFlag(); }
// CallFrame::iterate() expects a Functor that implements the following method:
// StackIterator::Status operator()(StackIterator&);
// StackVisitor::Status operator()(StackVisitor&);
template <typename Functor> void iterate(Functor& functor)
{
StackIterator iter(this);
iter.iterate<Functor>(functor);
StackVisitor::visit<Functor>(this, functor);
}
private:
......
......@@ -63,7 +63,7 @@
#include "RegExpPrototype.h"
#include "Register.h"
#include "SamplingTool.h"
#include "StackIterator.h"
#include "StackVisitor.h"
#include "StrictEvalActivation.h"
#include "StrongInlines.h"
#include "VMStackBounds.h"
......@@ -282,19 +282,19 @@ public:
{
}
StackIterator::Status operator()(StackIterator& iter)
StackVisitor::Status operator()(StackVisitor& visitor)
{
if (!m_hasSkippedFirstFrame) {
m_hasSkippedFirstFrame = true;
return StackIterator::Continue;
return StackVisitor::Continue;
}
unsigned line = 0;
unsigned unusedColumn = 0;
iter->computeLineAndColumn(line, unusedColumn);
dataLogF("[ReturnVPC] | %10p | %d (line %d)\n", m_it, iter->bytecodeOffset(), line);
visitor->computeLineAndColumn(line, unusedColumn);
dataLogF("[ReturnVPC] | %10p | %d (line %d)\n", m_it, visitor->bytecodeOffset(), line);
++m_it;
return StackIterator::Done;
return StackVisitor::Done;
}
private:
......@@ -389,10 +389,10 @@ bool Interpreter::isOpcode(Opcode opcode)
#endif
}
static bool unwindCallFrame(StackIterator& iter, JSValue exceptionValue)
static bool unwindCallFrame(StackVisitor& visitor, JSValue exceptionValue)
{
CallFrame* callFrame = iter->callFrame();
CodeBlock* codeBlock = iter->codeBlock();
CallFrame* callFrame = visitor->callFrame();
CodeBlock* codeBlock = visitor->codeBlock();
CodeBlock* oldCodeBlock = codeBlock;
JSScope* scope = callFrame->scope();
......@@ -431,16 +431,16 @@ static ALWAYS_INLINE const String getSourceURLFromCallFrame(CallFrame* callFrame
return callFrame->codeBlock()->ownerExecutable()->sourceURL();
}
static StackFrameCodeType getStackFrameCodeType(StackIterator iter)
static StackFrameCodeType getStackFrameCodeType(StackVisitor& visitor)
{
switch (iter->codeType()) {
case StackIterator::Frame::Eval:
switch (visitor->codeType()) {
case StackVisitor::Frame::Eval:
return StackFrameEvalCode;
case StackIterator::Frame::Function:
case StackVisitor::Frame::Function:
return StackFrameFunctionCode;
case StackIterator::Frame::Global:
case StackVisitor::Frame::Global:
return StackFrameGlobalCode;
case StackIterator::Frame::Native:
case StackVisitor::Frame::Native:
ASSERT_NOT_REACHED();
return StackFrameNativeCode;
}
......@@ -506,34 +506,34 @@ public:
{
}
StackIterator::Status operator()(StackIterator& iter)
StackVisitor::Status operator()(StackVisitor& visitor)
{
VM& vm = m_vm;
if (m_remainingCapacityForFrameCapture) {
if (iter->isJSFrame()) {
CodeBlock* codeBlock = iter->codeBlock();
if (visitor->isJSFrame()) {
CodeBlock* codeBlock = visitor->codeBlock();
StackFrame s = {
Strong<JSObject>(vm, iter->callee()),
getStackFrameCodeType(iter),
Strong<JSObject>(vm, visitor->callee()),
getStackFrameCodeType(visitor),
Strong<ExecutableBase>(vm, codeBlock->ownerExecutable()),
Strong<UnlinkedCodeBlock>(vm, codeBlock->unlinkedCodeBlock()),
codeBlock->source(),
codeBlock->ownerExecutable()->lineNo(),
codeBlock->firstLineColumnOffset(),
codeBlock->sourceOffset(),
iter->bytecodeOffset(),
iter->sourceURL()
visitor->bytecodeOffset(),
visitor->sourceURL()
};
m_results.append(s);
} else {
StackFrame s = { Strong<JSObject>(vm, iter->callee()), StackFrameNativeCode, Strong<ExecutableBase>(), Strong<UnlinkedCodeBlock>(), 0, 0, 0, 0, 0, String()};
StackFrame s = { Strong<JSObject>(vm, visitor->callee()), StackFrameNativeCode, Strong<ExecutableBase>(), Strong<UnlinkedCodeBlock>(), 0, 0, 0, 0, 0, String()};
m_results.append(s);
}
m_remainingCapacityForFrameCapture--;
return StackIterator::Continue;
return StackVisitor::Continue;
}
return StackIterator::Done;
return StackVisitor::Done;
}
private:
......@@ -577,23 +577,23 @@ public:
{
}
StackIterator::Status operator()(StackIterator& iter)
StackVisitor::Status operator()(StackVisitor& visitor)
{
VM& vm = m_callFrame->vm();
m_callFrame = iter->callFrame();
m_codeBlock = iter->codeBlock();
unsigned bytecodeOffset = iter->bytecodeOffset();
m_callFrame = visitor->callFrame();
m_codeBlock = visitor->codeBlock();
unsigned bytecodeOffset = visitor->bytecodeOffset();
if (m_isTermination || !(m_handler = m_codeBlock->handlerForBytecodeOffset(bytecodeOffset))) {
if (!unwindCallFrame(iter, m_exceptionValue)) {
if (!unwindCallFrame(visitor, m_exceptionValue)) {
if (LegacyProfiler* profiler = vm.enabledProfiler())
profiler->exceptionUnwind(m_callFrame);
return StackIterator::Done;
return StackVisitor::Done;
}
} else
return StackIterator::Done;
return StackVisitor::Done;
return StackIterator::Continue;
return StackVisitor::Continue;
}
private:
......
......@@ -56,7 +56,6 @@ namespace JSC {
class Register;
class JSScope;
class SamplingTool;
class StackIterator;
struct CallFrameClosure;
struct HandlerInfo;
struct Instruction;
......
......@@ -24,7 +24,7 @@
*/
#include "config.h"
#include "StackIterator.h"
#include "StackVisitor.h"
#include "Arguments.h"
#include "CallFrameInlines.h"
......@@ -35,13 +35,13 @@
namespace JSC {
StackIterator::StackIterator(CallFrame* startFrame)
: m_startFrame(startFrame)
StackVisitor::StackVisitor(CallFrame* startFrame)
{
resetIterator();
m_frame.m_index = 0;
readFrame(startFrame);
}
void StackIterator::gotoNextFrame()
void StackVisitor::gotoNextFrame()
{
#if ENABLE(DFG_JIT)
if (m_frame.isInlinedFrame()) {
......@@ -54,13 +54,7 @@ void StackIterator::gotoNextFrame()
readFrame(m_frame.callerFrame());
}
void StackIterator::resetIterator()
{
m_frame.m_index = 0;
readFrame(m_startFrame);
}
void StackIterator::readFrame(CallFrame* callFrame)
void StackVisitor::readFrame(CallFrame* callFrame)
{
ASSERT(!callFrame->hasHostCallFrameFlag());
if (!callFrame) {
......@@ -106,7 +100,7 @@ void StackIterator::readFrame(CallFrame* callFrame)
#endif // !ENABLE(DFG_JIT)
}
void StackIterator::readNonInlinedFrame(CallFrame* callFrame, CodeOrigin* codeOrigin)
void StackVisitor::readNonInlinedFrame(CallFrame* callFrame, CodeOrigin* codeOrigin)
{
m_frame.m_callFrame = callFrame;
m_frame.m_argumentCountIncludingThis = callFrame->argumentCountIncludingThis();
......@@ -130,7 +124,7 @@ static unsigned inlinedFrameOffset(CodeOrigin* codeOrigin)
return frameOffset;
}
void StackIterator::readInlinedFrame(CallFrame* callFrame, CodeOrigin* codeOrigin)
void StackVisitor::readInlinedFrame(CallFrame* callFrame, CodeOrigin* codeOrigin)
{
ASSERT(codeOrigin);
ASSERT(!callFrame->hasHostCallFrameFlag());
......@@ -170,67 +164,67 @@ void StackIterator::readInlinedFrame(CallFrame* callFrame, CodeOrigin* codeOrigi
}
#endif // ENABLE(DFG_JIT)
StackIterator::Frame::CodeType StackIterator::Frame::codeType() const
StackVisitor::Frame::CodeType StackVisitor::Frame::codeType() const
{
if (!isJSFrame())
return StackIterator::Frame::Native;
return StackVisitor::Frame::Native;
switch (codeBlock()->codeType()) {
case EvalCode:
return StackIterator::Frame::Eval;
return StackVisitor::Frame::Eval;
case FunctionCode:
return StackIterator::Frame::Function;
return StackVisitor::Frame::Function;
case GlobalCode:
return StackIterator::Frame::Global;
return StackVisitor::Frame::Global;
}
RELEASE_ASSERT_NOT_REACHED();
return StackIterator::Frame::Global;
return StackVisitor::Frame::Global;
}
String StackIterator::Frame::functionName()
String StackVisitor::Frame::functionName()
{
String traceLine;
JSObject* callee = this->callee();
switch (codeType()) {
case StackIterator::Frame::Eval:
case StackVisitor::Frame::Eval:
traceLine = "eval code";
break;
case StackIterator::Frame::Native:
case StackVisitor::Frame::Native:
if (callee)
traceLine = getCalculatedDisplayName(callFrame(), callee).impl();
break;
case StackIterator::Frame::Function:
case StackVisitor::Frame::Function:
traceLine = getCalculatedDisplayName(callFrame(), callee).impl();
break;
case StackIterator::Frame::Global:
case StackVisitor::Frame::Global:
traceLine = "global code";
break;
}
return traceLine.isNull() ? emptyString() : traceLine;
}
String StackIterator::Frame::sourceURL()
String StackVisitor::Frame::sourceURL()
{
String traceLine;
switch (codeType()) {
case StackIterator::Frame::Eval:
case StackIterator::Frame::Function:
case StackIterator::Frame::Global: {
case StackVisitor::Frame::Eval:
case StackVisitor::Frame::Function:
case StackVisitor::Frame::Global: {
String sourceURL = codeBlock()->ownerExecutable()->sourceURL();
if (!sourceURL.isEmpty())
traceLine = sourceURL.impl();
break;
}
case StackIterator::Frame::Native:
case StackVisitor::Frame::Native:
traceLine = "[native code]";
break;
}
return traceLine.isNull() ? emptyString() : traceLine;
}
String StackIterator::Frame::toString()
String StackVisitor::Frame::toString()
{
StringBuilder traceBuild;
String functionName = this->functionName();
......@@ -253,7 +247,7 @@ String StackIterator::Frame::toString()
return traceBuild.toString().impl();
}
Arguments* StackIterator::Frame::arguments()
Arguments* StackVisitor::Frame::arguments()
{
ASSERT(m_callFrame);
CallFrame* physicalFrame = m_callFrame;
......@@ -273,7 +267,7 @@ Arguments* StackIterator::Frame::arguments()
return arguments;
}
void StackIterator::Frame::computeLineAndColumn(unsigned& line, unsigned& column)
void StackVisitor::Frame::computeLineAndColumn(unsigned& line, unsigned& column)
{
CodeBlock* codeBlock = this->codeBlock();
if (!codeBlock) {
......@@ -293,14 +287,14 @@ void StackIterator::Frame::computeLineAndColumn(unsigned& line, unsigned& column
column = divotColumn + (divotLine ? 1 : codeBlock->firstLineColumnOffset());
}
void StackIterator::Frame::retrieveExpressionInfo(int& divot, int& startOffset, int& endOffset, unsigned& line, unsigned& column)
void StackVisitor::Frame::retrieveExpressionInfo(int& divot, int& startOffset, int& endOffset, unsigned& line, unsigned& column)