summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/interpreter/CallFrame.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-16 14:56:46 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-16 14:57:30 +0200
commitb297e0fa5c217c9467033b7c8b46891a52870120 (patch)
tree43fc14689295e9e64f2719d05aad94e3049f6cd7 /Source/JavaScriptCore/interpreter/CallFrame.h
parent69d517dbfa69903d8593cc1737f0474b21e3251e (diff)
downloadqtwebkit-b297e0fa5c217c9467033b7c8b46891a52870120.tar.gz
Revert "Imported WebKit commit 0dc6cd75e1d4836eaffbb520be96fac4847cc9d2 (http://svn.webkit.org/repository/webkit/trunk@131300)"
This reverts commit 5466563f4b5b6b86523e3f89bb7f77e5b5270c78. Caused OOM issues on some CI machines :(
Diffstat (limited to 'Source/JavaScriptCore/interpreter/CallFrame.h')
-rw-r--r--Source/JavaScriptCore/interpreter/CallFrame.h65
1 files changed, 28 insertions, 37 deletions
diff --git a/Source/JavaScriptCore/interpreter/CallFrame.h b/Source/JavaScriptCore/interpreter/CallFrame.h
index 7aa49a9b0..4758e5bd0 100644
--- a/Source/JavaScriptCore/interpreter/CallFrame.h
+++ b/Source/JavaScriptCore/interpreter/CallFrame.h
@@ -25,8 +25,8 @@
#include "AbstractPC.h"
#include "JSGlobalData.h"
-#include "JSStack.h"
#include "MacroAssemblerCodeRef.h"
+#include "RegisterFile.h"
namespace JSC {
@@ -39,13 +39,13 @@ namespace JSC {
// Passed as the first argument to most functions.
class ExecState : private Register {
public:
- JSValue calleeAsValue() const { return this[JSStack::Callee].jsValue(); }
- JSObject* callee() const { return this[JSStack::Callee].function(); }
- CodeBlock* codeBlock() const { return this[JSStack::CodeBlock].Register::codeBlock(); }
+ JSValue calleeAsValue() const { return this[RegisterFile::Callee].jsValue(); }
+ JSObject* callee() const { return this[RegisterFile::Callee].function(); }
+ CodeBlock* codeBlock() const { return this[RegisterFile::CodeBlock].Register::codeBlock(); }
JSScope* scope() const
{
- ASSERT(this[JSStack::ScopeChain].Register::scope());
- return this[JSStack::ScopeChain].Register::scope();
+ ASSERT(this[RegisterFile::ScopeChain].Register::scope());
+ return this[RegisterFile::ScopeChain].Register::scope();
}
// Global object in which execution began.
@@ -102,11 +102,11 @@ namespace JSC {
CallFrame& operator=(const Register& r) { *static_cast<Register*>(this) = r; return *this; }
- CallFrame* callerFrame() const { return this[JSStack::CallerFrame].callFrame(); }
+ CallFrame* callerFrame() const { return this[RegisterFile::CallerFrame].callFrame(); }
#if ENABLE(JIT) || ENABLE(LLINT)
- ReturnAddressPtr returnPC() const { return ReturnAddressPtr(this[JSStack::ReturnPC].vPC()); }
- bool hasReturnPC() const { return !!this[JSStack::ReturnPC].vPC(); }
- void clearReturnPC() { registers()[JSStack::ReturnPC] = static_cast<Instruction*>(0); }
+ ReturnAddressPtr returnPC() const { return ReturnAddressPtr(this[RegisterFile::ReturnPC].vPC()); }
+ bool hasReturnPC() const { return !!this[RegisterFile::ReturnPC].vPC(); }
+ void clearReturnPC() { registers()[RegisterFile::ReturnPC] = static_cast<Instruction*>(0); }
#endif
AbstractPC abstractReturnPC(JSGlobalData& globalData) { return AbstractPC(globalData, this); }
#if USE(JSVALUE32_64)
@@ -116,13 +116,13 @@ namespace JSC {
unsigned bytecodeOffsetForNonDFGCode() const
{
ASSERT(codeBlock());
- return this[JSStack::ArgumentCount].tag();
+ return this[RegisterFile::ArgumentCount].tag();
}
void setBytecodeOffsetForNonDFGCode(unsigned offset)
{
ASSERT(codeBlock());
- this[JSStack::ArgumentCount].tag() = static_cast<int32_t>(offset);
+ this[RegisterFile::ArgumentCount].tag() = static_cast<int32_t>(offset);
}
#endif
@@ -136,8 +136,8 @@ namespace JSC {
Register* frameExtentInternal();
#if ENABLE(DFG_JIT)
- InlineCallFrame* inlineCallFrame() const { return this[JSStack::ReturnPC].asInlineCallFrame(); }
- unsigned codeOriginIndexForDFG() const { return this[JSStack::ArgumentCount].tag(); }
+ InlineCallFrame* inlineCallFrame() const { return this[RegisterFile::ReturnPC].asInlineCallFrame(); }
+ unsigned codeOriginIndexForDFG() const { return this[RegisterFile::ArgumentCount].tag(); }
#else
// This will never be called if !ENABLE(DFG_JIT) since all calls should be guarded by
// isInlineCallFrame(). But to make it easier to write code without having a bunch of
@@ -151,25 +151,25 @@ namespace JSC {
#if USE(JSVALUE32_64)
Instruction* currentVPC() const
{
- return bitwise_cast<Instruction*>(this[JSStack::ArgumentCount].tag());
+ return bitwise_cast<Instruction*>(this[RegisterFile::ArgumentCount].tag());
}
void setCurrentVPC(Instruction* vpc)
{
- this[JSStack::ArgumentCount].tag() = bitwise_cast<int32_t>(vpc);
+ this[RegisterFile::ArgumentCount].tag() = bitwise_cast<int32_t>(vpc);
}
#else
Instruction* currentVPC() const;
void setCurrentVPC(Instruction* vpc);
#endif
- void setCallerFrame(CallFrame* callerFrame) { static_cast<Register*>(this)[JSStack::CallerFrame] = callerFrame; }
- void setScope(JSScope* scope) { static_cast<Register*>(this)[JSStack::ScopeChain] = scope; }
+ void setCallerFrame(CallFrame* callerFrame) { static_cast<Register*>(this)[RegisterFile::CallerFrame] = callerFrame; }
+ void setScope(JSScope* scope) { static_cast<Register*>(this)[RegisterFile::ScopeChain] = scope; }
ALWAYS_INLINE void init(CodeBlock* codeBlock, Instruction* vPC, JSScope* scope,
CallFrame* callerFrame, int argc, JSObject* callee)
{
ASSERT(callerFrame); // Use noCaller() rather than 0 for the outer host call frame caller.
- ASSERT(callerFrame == noCaller() || callerFrame->removeHostCallFrameFlag()->stack()->end() >= this);
+ ASSERT(callerFrame == noCaller() || callerFrame->removeHostCallFrameFlag()->registerFile()->end() >= this);
setCodeBlock(codeBlock);
setScope(scope);
@@ -186,19 +186,10 @@ namespace JSC {
// Access to arguments as passed. (After capture, arguments may move to a different location.)
size_t argumentCount() const { return argumentCountIncludingThis() - 1; }
- size_t argumentCountIncludingThis() const { return this[JSStack::ArgumentCount].payload(); }
+ size_t argumentCountIncludingThis() const { return this[RegisterFile::ArgumentCount].payload(); }
static int argumentOffset(int argument) { return s_firstArgumentOffset - argument; }
static int argumentOffsetIncludingThis(int argument) { return s_thisArgumentOffset - argument; }
- // In the following (argument() and setArgument()), the 'argument'
- // parameter is the index of the arguments of the target function of
- // this frame. The index starts at 0 for the first arg, 1 for the
- // second, etc.
- //
- // The arguments (in this case) do not include the 'this' value.
- // arguments(0) will not fetch the 'this' value. To get/set 'this',
- // use thisValue() and setThisValue() below.
-
JSValue argument(size_t argument)
{
if (argument >= argumentCount())
@@ -216,7 +207,7 @@ namespace JSC {
JSValue argumentAfterCapture(size_t argument);
- static int offsetFor(size_t argumentCountIncludingThis) { return argumentCountIncludingThis + JSStack::CallFrameHeaderSize; }
+ static int offsetFor(size_t argumentCountIncludingThis) { return argumentCountIncludingThis + RegisterFile::CallFrameHeaderSize; }
// FIXME: Remove these.
int hostThisRegister() { return thisArgumentOffset(); }
@@ -228,15 +219,15 @@ namespace JSC {
CallFrame* addHostCallFrameFlag() const { return reinterpret_cast<CallFrame*>(reinterpret_cast<intptr_t>(this) | HostCallFrameFlag); }
CallFrame* removeHostCallFrameFlag() { return reinterpret_cast<CallFrame*>(reinterpret_cast<intptr_t>(this) & ~HostCallFrameFlag); }
- void setArgumentCountIncludingThis(int count) { static_cast<Register*>(this)[JSStack::ArgumentCount].payload() = count; }
- void setCallee(JSObject* callee) { static_cast<Register*>(this)[JSStack::Callee] = Register::withCallee(callee); }
- void setCodeBlock(CodeBlock* codeBlock) { static_cast<Register*>(this)[JSStack::CodeBlock] = codeBlock; }
- void setReturnPC(void* value) { static_cast<Register*>(this)[JSStack::ReturnPC] = (Instruction*)value; }
+ void setArgumentCountIncludingThis(int count) { static_cast<Register*>(this)[RegisterFile::ArgumentCount].payload() = count; }
+ void setCallee(JSObject* callee) { static_cast<Register*>(this)[RegisterFile::Callee] = Register::withCallee(callee); }
+ void setCodeBlock(CodeBlock* codeBlock) { static_cast<Register*>(this)[RegisterFile::CodeBlock] = codeBlock; }
+ void setReturnPC(void* value) { static_cast<Register*>(this)[RegisterFile::ReturnPC] = (Instruction*)value; }
#if ENABLE(DFG_JIT)
bool isInlineCallFrame();
- void setInlineCallFrame(InlineCallFrame* inlineCallFrame) { static_cast<Register*>(this)[JSStack::ReturnPC] = inlineCallFrame; }
+ void setInlineCallFrame(InlineCallFrame* inlineCallFrame) { static_cast<Register*>(this)[RegisterFile::ReturnPC] = inlineCallFrame; }
// Call this to get the semantically correct JS CallFrame* for the
// currently executing function.
@@ -269,11 +260,11 @@ namespace JSC {
private:
static const intptr_t HostCallFrameFlag = 1;
- static const int s_thisArgumentOffset = -1 - JSStack::CallFrameHeaderSize;
+ static const int s_thisArgumentOffset = -1 - RegisterFile::CallFrameHeaderSize;
static const int s_firstArgumentOffset = s_thisArgumentOffset - 1;
#ifndef NDEBUG
- JSStack* stack();
+ RegisterFile* registerFile();
#endif
#if ENABLE(DFG_JIT)
bool isInlineCallFrameSlow();