#ifndef ProtoCallFrame_h
#define ProtoCallFrame_h
#include "Register.h"
namespace JSC {
struct ProtoCallFrame {
Register codeBlockValue;
Register scopeChainValue;
Register calleeValue;
Register argCountAndCodeOriginValue;
Register thisArg;
uint32_t paddedArgCount;
JSValue *args;
void init(CodeBlock*, JSScope*, JSObject*, JSValue, int, JSValue* otherArgs = 0);
CodeBlock* codeBlock() const { return codeBlockValue.Register::codeBlock(); }
void setCodeBlock(CodeBlock* codeBlock) { codeBlockValue = codeBlock; }
JSScope* scope() const { return scopeChainValue.Register::scope(); }
void setScope(JSScope* scope) { scopeChainValue = scope; }
JSObject* callee() const { return calleeValue.Register::function(); }
void setCallee(JSObject* callee) { calleeValue = Register::withCallee(callee); }
int argumentCountIncludingThis() const { return argCountAndCodeOriginValue.payload(); }
int argumentCount() const { return argumentCountIncludingThis() - 1; }
void setArgumentCountIncludingThis(int count) { argCountAndCodeOriginValue.payload() = count; }
void setPaddedArgCount(uint32_t argCount) { paddedArgCount = argCount; }
void clearCurrentVPC() { argCountAndCodeOriginValue.tag() = 0; }
JSValue thisValue() const { return thisArg.Register::jsValue(); }
void setThisValue(JSValue value) { thisArg = value; }
JSValue argument(size_t argumentIndex)
{
ASSERT(static_cast<int>(argumentIndex) < argumentCount());
return args[argumentIndex];
}
void setArgument(size_t argumentIndex, JSValue value)
{
ASSERT(static_cast<int>(argumentIndex) < argumentCount());
args[argumentIndex] = value;
}
};
}
#endif // ProtoCallFrame_h