2010-11-17 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r72160.
http://trac.webkit.org/changeset/72160
https://bugs.webkit.org/show_bug.cgi?id=49646
Broke lots of fast/profiler tests, among others (Requested by
aroben on #webkit).
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dump):
(JSC::CodeBlock::functionRegisterForBytecodeOffset):
(JSC::CodeBlock::shrinkToFit):
* bytecode/CodeBlock.h:
(JSC::CodeBlock::addFunctionRegisterInfo):
* bytecode/Opcode.h:
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitCall):
(JSC::BytecodeGenerator::emitCallVarargs):
(JSC::BytecodeGenerator::emitReturn):
(JSC::BytecodeGenerator::emitConstruct):
* bytecompiler/BytecodeGenerator.h:
(JSC::CallArguments::profileHookRegister):
* bytecompiler/NodesCodegen.cpp:
(JSC::CallArguments::CallArguments):
* interpreter/Interpreter.cpp:
(JSC::Interpreter::unwindCallFrame):
(JSC::Interpreter::throwException):
(JSC::Interpreter::execute):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::privateExecute):
* jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):
* jit/JIT.h:
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_profile_will_call):
(JSC::JIT::emit_op_profile_did_call):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_profile_will_call):
(JSC::JIT::emit_op_profile_did_call):
* jit/JITStubs.cpp:
(JSC::DEFINE_STUB_FUNCTION):
* jit/JITStubs.h:
* profiler/Profile.cpp:
(JSC::Profile::Profile):
* profiler/ProfileGenerator.cpp:
(JSC::ProfileGenerator::addParentForConsoleStart):
(JSC::ProfileGenerator::willExecute):
(JSC::ProfileGenerator::didExecute):
(JSC::ProfileGenerator::stopProfiling):
* profiler/ProfileGenerator.h:
* profiler/ProfileNode.cpp:
(JSC::ProfileNode::ProfileNode):
(JSC::ProfileNode::willExecute):
* profiler/ProfileNode.h:
(JSC::ProfileNode::create):
(JSC::ProfileNode::operator==):
* profiler/Profiler.cpp:
(JSC::dispatchFunctionToProfiles):
(JSC::Profiler::willExecute):
(JSC::Profiler::didExecute):
* profiler/Profiler.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72176 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
index 00673d8..1fa5aa4 100644
--- a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
+++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
@@ -324,11 +324,7 @@
m_codeBlock->setNeedsFullScopeChain(true);
codeBlock->setGlobalData(m_globalData);
-
-
- if (m_shouldEmitProfileHooks)
- emitOpcode(op_profile_has_called);
-
+
emitOpcode(op_enter);
if (m_codeBlock->needsFullScopeChain()) {
m_activationRegister = addVar();
@@ -1637,6 +1633,9 @@
ASSERT(opcodeID == op_call || opcodeID == op_call_eval);
ASSERT(func->refCount());
+ if (m_shouldEmitProfileHooks)
+ emitMove(callArguments.profileHookRegister(), func);
+
// Generate code for arguments.
unsigned argumentIndex = 0;
for (ArgumentListNode* n = callArguments.argumentsNode()->m_listNode; n; n = n->m_next)
@@ -1647,6 +1646,15 @@
for (int i = 0; i < RegisterFile::CallFrameHeaderSize; ++i)
callFrame.append(newTemporary());
+ if (m_shouldEmitProfileHooks) {
+ emitOpcode(op_profile_will_call);
+ instructions().append(callArguments.profileHookRegister()->index());
+
+#if ENABLE(JIT)
+ m_codeBlock->addFunctionRegisterInfo(instructions().size(), callArguments.profileHookRegister()->index());
+#endif
+ }
+
emitExpressionInfo(divot, startOffset, endOffset);
#if ENABLE(JIT)
@@ -1663,6 +1671,11 @@
instructions().append(dst->index()); // dst
}
+ if (m_shouldEmitProfileHooks) {
+ emitOpcode(op_profile_did_call);
+ instructions().append(callArguments.profileHookRegister()->index());
+ }
+
return dst;
}
@@ -1681,6 +1694,14 @@
ASSERT(func->refCount());
ASSERT(thisRegister->refCount());
ASSERT(dst != func);
+ if (m_shouldEmitProfileHooks) {
+ emitOpcode(op_profile_will_call);
+ instructions().append(func->index());
+
+#if ENABLE(JIT)
+ m_codeBlock->addFunctionRegisterInfo(instructions().size(), func->index());
+#endif
+ }
emitExpressionInfo(divot, startOffset, endOffset);
@@ -1693,6 +1714,10 @@
emitOpcode(op_call_put_result);
instructions().append(dst->index()); // dst
}
+ if (m_shouldEmitProfileHooks) {
+ emitOpcode(op_profile_did_call);
+ instructions().append(func->index());
+ }
return dst;
}
@@ -1708,9 +1733,6 @@
instructions().append(m_codeBlock->argumentsRegister());
}
- if (m_shouldEmitProfileHooks)
- emitOpcode(op_profile_will_return);
-
// Constructors use op_ret_object_or_this to check the result is an
// object, unless we can trivially determine the check is not
// necessary (currently, if the return value is 'this').
@@ -1734,6 +1756,9 @@
{
ASSERT(func->refCount());
+ if (m_shouldEmitProfileHooks)
+ emitMove(callArguments.profileHookRegister(), func);
+
// Generate code for arguments.
unsigned argumentIndex = 0;
if (ArgumentsNode* argumentsNode = callArguments.argumentsNode()) {
@@ -1741,6 +1766,11 @@
emitNode(callArguments.argumentRegister(argumentIndex++), n);
}
+ if (m_shouldEmitProfileHooks) {
+ emitOpcode(op_profile_will_call);
+ instructions().append(callArguments.profileHookRegister()->index());
+ }
+
// Reserve space for call frame.
Vector<RefPtr<RegisterID>, RegisterFile::CallFrameHeaderSize> callFrame;
for (int i = 0; i < RegisterFile::CallFrameHeaderSize; ++i)
@@ -1761,6 +1791,11 @@
instructions().append(dst->index()); // dst
}
+ if (m_shouldEmitProfileHooks) {
+ emitOpcode(op_profile_did_call);
+ instructions().append(callArguments.profileHookRegister()->index());
+ }
+
return dst;
}
diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/JavaScriptCore/bytecompiler/BytecodeGenerator.h
index 7acc00b..499d232 100644
--- a/JavaScriptCore/bytecompiler/BytecodeGenerator.h
+++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.h
@@ -59,9 +59,11 @@
RegisterID* argumentRegister(unsigned i) { return m_argv[i + 1].get(); }
unsigned callFrame() { return thisRegister()->index() + count() + RegisterFile::CallFrameHeaderSize; }
unsigned count() { return m_argv.size(); }
+ RegisterID* profileHookRegister() { return m_profileHookRegister.get(); }
ArgumentsNode* argumentsNode() { return m_argumentsNode; }
private:
+ RefPtr<RegisterID> m_profileHookRegister;
ArgumentsNode* m_argumentsNode;
Vector<RefPtr<RegisterID>, 16> m_argv;
};
diff --git a/JavaScriptCore/bytecompiler/NodesCodegen.cpp b/JavaScriptCore/bytecompiler/NodesCodegen.cpp
index 2a7eacd..a850c96 100644
--- a/JavaScriptCore/bytecompiler/NodesCodegen.cpp
+++ b/JavaScriptCore/bytecompiler/NodesCodegen.cpp
@@ -326,6 +326,8 @@
CallArguments::CallArguments(BytecodeGenerator& generator, ArgumentsNode* argumentsNode)
: m_argumentsNode(argumentsNode)
{
+ if (generator.shouldEmitProfileHooks())
+ m_profileHookRegister = generator.newTemporary();
m_argv.append(generator.newTemporary());
if (argumentsNode) {
for (ArgumentListNode* n = argumentsNode->m_listNode; n; n = n->m_next) {