summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/bytecode/CodeOrigin.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2013-09-13 12:51:20 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-19 20:50:05 +0200
commitd441d6f39bb846989d95bcf5caf387b42414718d (patch)
treee367e64a75991c554930278175d403c072de6bb8 /Source/JavaScriptCore/bytecode/CodeOrigin.cpp
parent0060b2994c07842f4c59de64b5e3e430525c4b90 (diff)
downloadqtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit. Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/JavaScriptCore/bytecode/CodeOrigin.cpp')
-rw-r--r--Source/JavaScriptCore/bytecode/CodeOrigin.cpp58
1 files changed, 57 insertions, 1 deletions
diff --git a/Source/JavaScriptCore/bytecode/CodeOrigin.cpp b/Source/JavaScriptCore/bytecode/CodeOrigin.cpp
index 92e2b0fc9..52bc2bf7f 100644
--- a/Source/JavaScriptCore/bytecode/CodeOrigin.cpp
+++ b/Source/JavaScriptCore/bytecode/CodeOrigin.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,7 +26,10 @@
#include "config.h"
#include "CodeOrigin.h"
+#include "CallFrame.h"
+#include "CodeBlock.h"
#include "Executable.h"
+#include "Operations.h"
namespace JSC {
@@ -50,13 +53,66 @@ Vector<CodeOrigin> CodeOrigin::inlineStack() const
unsigned index = result.size() - 2;
for (InlineCallFrame* current = inlineCallFrame; current; current = current->caller.inlineCallFrame)
result[index--] = current->caller;
+ RELEASE_ASSERT(!result[0].inlineCallFrame);
return result;
}
+void CodeOrigin::dump(PrintStream& out) const
+{
+ Vector<CodeOrigin> stack = inlineStack();
+ for (unsigned i = 0; i < stack.size(); ++i) {
+ if (i)
+ out.print(" --> ");
+
+ if (InlineCallFrame* frame = stack[i].inlineCallFrame) {
+ out.print(frame->briefFunctionInformation(), ":<", RawPointer(frame->executable.get()), "> ");
+ if (frame->isClosureCall())
+ out.print("(closure) ");
+ }
+
+ out.print("bc#", stack[i].bytecodeIndex);
+ }
+}
+
+JSFunction* InlineCallFrame::calleeForCallFrame(ExecState* exec) const
+{
+ if (!isClosureCall())
+ return callee.get();
+
+ return jsCast<JSFunction*>((exec + stackOffset)->callee());
+}
+
CodeBlockHash InlineCallFrame::hash() const
{
return executable->hashFor(specializationKind());
}
+String InlineCallFrame::inferredName() const
+{
+ return jsCast<FunctionExecutable*>(executable.get())->inferredName().string();
+}
+
+CodeBlock* InlineCallFrame::baselineCodeBlock() const
+{
+ return jsCast<FunctionExecutable*>(executable.get())->baselineCodeBlockFor(specializationKind());
+}
+
+void InlineCallFrame::dumpBriefFunctionInformation(PrintStream& out) const
+{
+ out.print(inferredName(), "#", hash());
+}
+
+void InlineCallFrame::dump(PrintStream& out) const
+{
+ out.print(briefFunctionInformation(), ":<", RawPointer(executable.get()), ", bc#", caller.bytecodeIndex, ", ", specializationKind());
+ if (callee)
+ out.print(", known callee: ", JSValue(callee.get()));
+ else
+ out.print(", closure call");
+ out.print(", numArgs+this = ", arguments.size());
+ out.print(", stack >= r", stackOffset);
+ out.print(">");
+}
+
} // namespace JSC