Commit d19c4622 authored by msaboff@apple.com's avatar msaboff@apple.com

Change local variable register allocation to start at offset -1

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

Reviewed by Geoffrey Garen.

Adjusted the virtual register mapping down by one slot.  Reduced
the CallFrame header slots offsets by one.  They now start at 0.
Changed arity fixup to no longer skip passed register slot 0 as this
is now part of the CallFrame header.

* bytecode/VirtualRegister.h:
(JSC::operandIsLocal):
(JSC::operandIsArgument):
(JSC::VirtualRegister::localToOperand):
(JSC::VirtualRegister::operandToLocal):
  Adjusted functions for shift in mapping from local to register offset.

* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::findArgumentPositionForLocal):
(JSC::DFG::ByteCodeParser::addCall):
(JSC::DFG::ByteCodeParser::handleInlining):
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGVariableEventStream.cpp:
(JSC::DFG::VariableEventStream::reconstruct):
* dfg/DFGVirtualRegisterAllocationPhase.cpp:
(JSC::DFG::VirtualRegisterAllocationPhase::run):
* interpreter/CallFrame.h:
(JSC::ExecState::frameExtent):
(JSC::ExecState::offsetFor):
* interpreter/Interpreter.cpp:
(JSC::loadVarargs):
(JSC::Interpreter::dumpRegisters):
(JSC::Interpreter::executeCall):
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LowLevelInterpreter.asm:
  Adjusted math to accomodate for shift in call frame slots.

* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::compileFunction):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::calleeFrameOffset):
* interpreter/CallFrame.cpp:
(JSC::CallFrame::frameExtentInternal):
* interpreter/JSStackInlines.h:
(JSC::JSStack::pushFrame):
* jit/JIT.cpp:
(JSC::JIT::privateCompile):
* jit/JITOperations.cpp:
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::llint_slow_path_stack_check):
* runtime/CommonSlowPaths.h:
(JSC::CommonSlowPaths::arityCheckFor):
  Fixed offset calculation to use VirtualRegister and related calculation instead of
  doing seperate calculations.

* interpreter/JSStack.h:
  Adjusted CallFrame slots down by one.  Did some miscellaneous fixing of dumpRegisters()
  in the process of testing the fixes.

* jit/ThunkGenerators.cpp:
(JSC::arityFixup):
  Changed arity fixup to no longer skip passed register slot 0 as this
  is now part of the CallFrame header.

* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
  Changed arity fixup to no longer skip passed register slot 0 as this
  is now part of the CallFrame header.  Updated op_enter processing for
  the change in local registers.

* runtime/JSGlobalObject.h:
  Removed the now unneeded extra slot in the global callframe


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158237 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 431a61b5
......@@ -3,7 +3,7 @@ Test for http://bugs.webkit.org/show_bug.cgi?id=113220: ensures select popup clo
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS internals.isSelectPopupVisible(popup) is true
FAIL internals.isSelectPopupVisible(popup) should be true. Was false.
PASS internals.isSelectPopupVisible(popup) is false
PASS successfullyParsed is true
......
2013-10-29 Michael Saboff <msaboff@apple.com>
Change local variable register allocation to start at offset -1
https://bugs.webkit.org/show_bug.cgi?id=123182
Reviewed by Geoffrey Garen.
Adjusted the virtual register mapping down by one slot. Reduced
the CallFrame header slots offsets by one. They now start at 0.
Changed arity fixup to no longer skip passed register slot 0 as this
is now part of the CallFrame header.
* bytecode/VirtualRegister.h:
(JSC::operandIsLocal):
(JSC::operandIsArgument):
(JSC::VirtualRegister::localToOperand):
(JSC::VirtualRegister::operandToLocal):
Adjusted functions for shift in mapping from local to register offset.
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::findArgumentPositionForLocal):
(JSC::DFG::ByteCodeParser::addCall):
(JSC::DFG::ByteCodeParser::handleInlining):
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGVariableEventStream.cpp:
(JSC::DFG::VariableEventStream::reconstruct):
* dfg/DFGVirtualRegisterAllocationPhase.cpp:
(JSC::DFG::VirtualRegisterAllocationPhase::run):
* interpreter/CallFrame.h:
(JSC::ExecState::frameExtent):
(JSC::ExecState::offsetFor):
* interpreter/Interpreter.cpp:
(JSC::loadVarargs):
(JSC::Interpreter::dumpRegisters):
(JSC::Interpreter::executeCall):
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LowLevelInterpreter.asm:
Adjusted math to accomodate for shift in call frame slots.
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::compileFunction):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::calleeFrameOffset):
* interpreter/CallFrame.cpp:
(JSC::CallFrame::frameExtentInternal):
* interpreter/JSStackInlines.h:
(JSC::JSStack::pushFrame):
* jit/JIT.cpp:
(JSC::JIT::privateCompile):
* jit/JITOperations.cpp:
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::llint_slow_path_stack_check):
* runtime/CommonSlowPaths.h:
(JSC::CommonSlowPaths::arityCheckFor):
Fixed offset calculation to use VirtualRegister and related calculation instead of
doing seperate calculations.
* interpreter/JSStack.h:
Adjusted CallFrame slots down by one. Did some miscellaneous fixing of dumpRegisters()
in the process of testing the fixes.
* jit/ThunkGenerators.cpp:
(JSC::arityFixup):
Changed arity fixup to no longer skip passed register slot 0 as this
is now part of the CallFrame header.
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
Changed arity fixup to no longer skip passed register slot 0 as this
is now part of the CallFrame header. Updated op_enter processing for
the change in local registers.
* runtime/JSGlobalObject.h:
Removed the now unneeded extra slot in the global callframe
2013-10-29 Julien Brianceau <jbriance@cisco.com>
[arm] Fix lots of crashes because of 4th argument register trampling.
......
......@@ -35,12 +35,12 @@ namespace JSC {
inline bool operandIsLocal(int operand)
{
return operand <= 0;
return operand < 0;
}
inline bool operandIsArgument(int operand)
{
return operand > 0;
return operand >= 0;
}
......@@ -73,8 +73,8 @@ private:
static const int s_invalidVirtualRegister = 0x3fffffff;
static const int s_firstConstantRegisterIndex = 0x40000000;
static int localToOperand(int local) { return -local; }
static int operandToLocal(int operand) { return -operand; }
static int localToOperand(int local) { return -1 - local; }
static int operandToLocal(int operand) { return -1 - operand; }
static int operandToArgument(int operand) { return operand - CallFrame::thisArgumentOffset(); }
static int argumentToOperand(int argument) { return argument + CallFrame::thisArgumentOffset(); }
......
......@@ -391,11 +391,11 @@ private:
InlineCallFrame* inlineCallFrame = stack->m_inlineCallFrame;
if (!inlineCallFrame)
break;
if (operand.offset() <= static_cast<int>(inlineCallFrame->stackOffset + JSStack::CallFrameHeaderSize))
if (operand.offset() < static_cast<int>(inlineCallFrame->stackOffset + JSStack::CallFrameHeaderSize))
continue;
if (operand.offset() == inlineCallFrame->stackOffset + CallFrame::thisArgumentOffset())
continue;
if (operand.offset() > static_cast<int>(inlineCallFrame->stackOffset + JSStack::CallFrameHeaderSize + inlineCallFrame->arguments.size()))
if (operand.offset() >= static_cast<int>(inlineCallFrame->stackOffset + CallFrame::thisArgumentOffset() + inlineCallFrame->arguments.size()))
continue;
int argument = VirtualRegister(operand.offset() - inlineCallFrame->stackOffset).toArgument();
return stack->m_argumentPositions[argument];
......@@ -769,8 +769,8 @@ private:
addVarArgChild(get(VirtualRegister(currentInstruction[2].u.operand)));
int argCount = currentInstruction[3].u.operand;
if (JSStack::CallFrameHeaderSize + (unsigned)argCount > m_parameterSlots)
m_parameterSlots = JSStack::CallFrameHeaderSize + argCount;
if (JSStack::ThisArgument + (unsigned)argCount > m_parameterSlots)
m_parameterSlots = JSStack::ThisArgument + argCount;
int registerOffset = -currentInstruction[4].u.operand;
int dummyThisArgument = op == Call ? 0 : 1;
......@@ -1290,7 +1290,7 @@ bool ByteCodeParser::handleInlining(Node* callTargetNode, int resultOperand, con
int inlineCallFrameStart = m_inlineStackTop->remapOperand(VirtualRegister(registerOffset)).offset() + JSStack::CallFrameHeaderSize;
// Make sure that we have enough locals.
unsigned newNumLocals = VirtualRegister(inlineCallFrameStart).toLocal() + JSStack::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters;
unsigned newNumLocals = VirtualRegister(inlineCallFrameStart).toLocal() + 1 + JSStack::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters;
if (newNumLocals > m_numLocals) {
m_numLocals = newNumLocals;
for (size_t i = 0; i < m_graph.numBlocks(); ++i)
......@@ -2978,8 +2978,8 @@ bool ByteCodeParser::parseBlock(unsigned limit)
addToGraph(CheckArgumentsNotCreated);
unsigned argCount = inlineCallFrame()->arguments.size();
if (JSStack::CallFrameHeaderSize + argCount > m_parameterSlots)
m_parameterSlots = JSStack::CallFrameHeaderSize + argCount;
if (JSStack::ThisArgument + argCount > m_parameterSlots)
m_parameterSlots = JSStack::ThisArgument + argCount;
addVarArgChild(get(VirtualRegister(currentInstruction[2].u.operand))); // callee
addVarArgChild(get(VirtualRegister(currentInstruction[3].u.operand))); // this
......
......@@ -332,7 +332,7 @@ void JITCompiler::compileFunction()
Label fromArityCheck(this);
// Plant a check that sufficient space is available in the JSStack.
// FIXME: https://bugs.webkit.org/show_bug.cgi?id=56291
addPtr(TrustedImm32(-m_codeBlock->m_numCalleeRegisters * sizeof(Register)), GPRInfo::callFrameRegister, GPRInfo::regT1);
addPtr(TrustedImm32(virtualRegisterForLocal(m_codeBlock->m_numCalleeRegisters).offset() * sizeof(Register)), GPRInfo::callFrameRegister, GPRInfo::regT1);
Jump stackCheck = branchPtr(Above, AbsoluteAddress(m_vm->interpreter->stack().addressOfEnd()), GPRInfo::regT1);
// Return here after stack check.
Label fromStackCheck = label();
......
......@@ -737,7 +737,7 @@ public:
ptrdiff_t calleeFrameOffset(int numArgs)
{
return -(m_jit.graph().m_nextMachineLocal + JSStack::CallFrameHeaderSize + numArgs) * sizeof(Register);
return virtualRegisterForLocal(m_jit.graph().m_nextMachineLocal + JSStack::CallFrameHeaderSize + numArgs).offset() * sizeof(Register);
}
// Access to our fixed callee CallFrame.
......
......@@ -115,7 +115,7 @@ void VariableEventStream::reconstruct(
unsigned numVariables;
if (codeOrigin.inlineCallFrame)
numVariables = baselineCodeBlockForInlineCallFrame(codeOrigin.inlineCallFrame)->m_numCalleeRegisters + VirtualRegister(codeOrigin.inlineCallFrame->stackOffset).toLocal();
numVariables = baselineCodeBlockForInlineCallFrame(codeOrigin.inlineCallFrame)->m_numCalleeRegisters + VirtualRegister(codeOrigin.inlineCallFrame->stackOffset).toLocal() + 1;
else
numVariables = baselineCodeBlock->m_numCalleeRegisters;
......
......@@ -128,7 +128,7 @@ public:
for (InlineCallFrameSet::iterator iter = m_graph.m_inlineCallFrames->begin(); !!iter; ++iter) {
InlineCallFrame* inlineCallFrame = *iter;
CodeBlock* codeBlock = baselineCodeBlockForInlineCallFrame(inlineCallFrame);
unsigned requiredCalleeRegisters = VirtualRegister(inlineCallFrame->stackOffset).toLocal() + codeBlock->m_numCalleeRegisters;
unsigned requiredCalleeRegisters = VirtualRegister(inlineCallFrame->stackOffset).toLocal() + 1 + codeBlock->m_numCalleeRegisters;
if (requiredCalleeRegisters > calleeRegisters)
calleeRegisters = requiredCalleeRegisters;
}
......
......@@ -119,7 +119,7 @@ Register* CallFrame::frameExtentInternal()
{
CodeBlock* codeBlock = this->codeBlock();
ASSERT(codeBlock);
return registers() - codeBlock->m_numCalleeRegisters;
return registers() + virtualRegisterForLocal(codeBlock->m_numCalleeRegisters).offset();
}
} // namespace JSC
......@@ -179,12 +179,12 @@ namespace JSC {
Register* frameExtent()
{
if (!codeBlock())
return registers();
return registers() - 1;
return frameExtentInternal();
}
Register* frameExtentInternal();
#if USE(JSVALUE32_64)
Instruction* currentVPC() const
{
......@@ -224,8 +224,8 @@ 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(); }
static int argumentOffset(int argument) { return (s_firstArgumentOffset + argument); }
static int argumentOffsetIncludingThis(int argument) { return (s_thisArgumentOffset + argument); }
static int argumentOffset(int argument) { return (JSStack::FirstArgument + argument); }
static int argumentOffsetIncludingThis(int argument) { return (JSStack::ThisArgument + argument); }
// In the following (argument() and setArgument()), the 'argument'
// parameter is the index of the arguments of the target function of
......@@ -258,7 +258,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 + JSStack::ThisArgument - 1; }
// FIXME: Remove these.
int hostThisRegister() { return thisArgumentOffset(); }
......@@ -288,8 +288,6 @@ namespace JSC {
private:
static const intptr_t HostCallFrameFlag = 1;
static const int s_thisArgumentOffset = JSStack::CallFrameHeaderSize + 1;
static const int s_firstArgumentOffset = s_thisArgumentOffset + 1;
#ifndef NDEBUG
JSStack* stack();
......@@ -310,10 +308,10 @@ namespace JSC {
int offset = reg - this->registers();
// The offset is defined (based on argumentOffset()) to be:
// offset = s_firstArgumentOffset - argIndex;
// offset = JSStack::FirstArgument - argIndex;
// Hence:
// argIndex = s_firstArgumentOffset - offset;
size_t argIndex = offset - s_firstArgumentOffset;
// argIndex = JSStack::FirstArgument - offset;
size_t argIndex = offset - JSStack::FirstArgument;
return argIndex;
}
......
......@@ -154,7 +154,7 @@ CallFrame* loadVarargs(CallFrame* callFrame, JSStack* stack, JSValue thisValue,
{
if (!arguments) { // f.apply(x, arguments), with arguments unmodified.
unsigned argumentCountIncludingThis = callFrame->argumentCountIncludingThis();
CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + firstFreeRegister - argumentCountIncludingThis - JSStack::CallFrameHeaderSize);
CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + firstFreeRegister - argumentCountIncludingThis - JSStack::CallFrameHeaderSize - 1);
if (argumentCountIncludingThis > Arguments::MaxArguments + 1 || !stack->grow(newCallFrame->registers())) {
callFrame->vm().throwException(callFrame, createStackOverflowError(callFrame));
return 0;
......@@ -168,7 +168,7 @@ CallFrame* loadVarargs(CallFrame* callFrame, JSStack* stack, JSValue thisValue,
}
if (arguments.isUndefinedOrNull()) {
CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + firstFreeRegister - 1 - JSStack::CallFrameHeaderSize);
CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + firstFreeRegister - 1 - JSStack::CallFrameHeaderSize - 1);
if (!stack->grow(newCallFrame->registers())) {
callFrame->vm().throwException(callFrame, createStackOverflowError(callFrame));
return 0;
......@@ -295,7 +295,7 @@ public:
unsigned unusedColumn = 0;
visitor->computeLineAndColumn(line, unusedColumn);
dataLogF("[ReturnVPC] | %10p | %d (line %d)\n", m_it, visitor->bytecodeOffset(), line);
++m_it;
--m_it;
return StackVisitor::Done;
}
......@@ -315,14 +315,14 @@ void Interpreter::dumpRegisters(CallFrame* callFrame)
const Register* it;
const Register* end;
it = callFrame->registers() + JSStack::CallFrameHeaderSize + callFrame->argumentCountIncludingThis();
end = callFrame->registers() + JSStack::CallFrameHeaderSize;
it = callFrame->registers() + JSStack::ThisArgument + callFrame->argumentCount();
end = callFrame->registers() + JSStack::ThisArgument - 1;
while (it > end) {
JSValue v = it->jsValue();
int registerNumber = it - callFrame->registers();
String name = codeBlock->nameForRegister(VirtualRegister(registerNumber));
dataLogF("[r% 3d %14s] | %10p | %-16s 0x%lld \n", registerNumber, name.ascii().data(), it, toCString(v).data(), (long long)JSValue::encode(v));
it++;
--it;
}
dataLogF("-----------------------------------------------------------------------------\n");
......@@ -347,8 +347,6 @@ void Interpreter::dumpRegisters(CallFrame* callFrame)
--it;
dataLogF("-----------------------------------------------------------------------------\n");
int registerCount = 0;
end = it - codeBlock->m_numVars;
if (it != end) {
do {
......@@ -357,18 +355,17 @@ void Interpreter::dumpRegisters(CallFrame* callFrame)
String name = codeBlock->nameForRegister(VirtualRegister(registerNumber));
dataLogF("[r% 3d %14s] | %10p | %-16s 0x%lld \n", registerNumber, name.ascii().data(), it, toCString(v).data(), (long long)JSValue::encode(v));
--it;
--registerCount;
} while (it != end);
}
dataLogF("-----------------------------------------------------------------------------\n");
end = it + codeBlock->m_numCalleeRegisters - codeBlock->m_numVars;
end = it - codeBlock->m_numCalleeRegisters + codeBlock->m_numVars;
if (it != end) {
do {
JSValue v = (*it).jsValue();
dataLogF("[r% 3d] | %10p | %-16s 0x%lld \n", registerCount, it, toCString(v).data(), (long long)JSValue::encode(v));
++it;
++registerCount;
int registerNumber = it - callFrame->registers();
dataLogF("[r% 3d] | %10p | %-16s 0x%lld \n", registerNumber, it, toCString(v).data(), (long long)JSValue::encode(v));
--it;
} while (it != end);
}
dataLogF("-----------------------------------------------------------------------------\n");
......
......@@ -53,13 +53,14 @@ namespace JSC {
public:
enum CallFrameHeaderEntry {
CallFrameHeaderSize = 6,
ArgumentCount = 6,
CallerFrame = 5,
Callee = 4,
ScopeChain = 3,
ReturnPC = 2, // This is either an Instruction* or a pointer into JIT generated code stored as an Instruction*.
CodeBlock = 1,
FirstArgument = 7,
ThisArgument = 6,
ArgumentCount = 5,
CallerFrame = 4,
Callee = 3,
ScopeChain = 2,
ReturnPC = 1, // This is either an Instruction* or a pointer into JIT generated code stored as an Instruction*.
CodeBlock = 0,
};
static const size_t defaultCapacity = 512 * 1024;
......
......@@ -72,7 +72,7 @@ inline CallFrame* JSStack::pushFrame(CallFrame* callerFrame,
Register* newEnd = newCallFrameSlot;
if (!!codeBlock)
newEnd -= codeBlock->m_numCalleeRegisters;
newEnd += virtualRegisterForLocal(codeBlock->m_numCalleeRegisters).offset();
// Ensure that we have the needed stack capacity to push the new frame:
if (!grow(newEnd))
......
......@@ -586,7 +586,7 @@ CompilationResult JIT::privateCompile(JITCompilationEffort effort)
}
#endif
addPtr(TrustedImm32(-m_codeBlock->m_numCalleeRegisters * sizeof(Register)), callFrameRegister, regT1);
addPtr(TrustedImm32(virtualRegisterForLocal(m_codeBlock->m_numCalleeRegisters).offset() * sizeof(Register)), callFrameRegister, regT1);
stackCheck = branchPtr(Above, AbsoluteAddress(m_vm->interpreter->stack().addressOfEnd()), regT1);
}
......
......@@ -79,7 +79,7 @@ void JIT_OPERATION operationStackCheck(ExecState* exec, CodeBlock* codeBlock)
JSStack& stack = vm->interpreter->stack();
if (UNLIKELY(!stack.grow(&exec->registers()[-codeBlock->m_numCalleeRegisters])))
if (UNLIKELY(!stack.grow(&exec->registers()[virtualRegisterForLocal(codeBlock->m_numCalleeRegisters).offset()])))
vm->throwException(callerFrame, createStackOverflowError(callerFrame));
}
......@@ -1717,7 +1717,7 @@ asm (
".globl " SYMBOL_STRING(getHostCallReturnValue) "\n"
HIDE_SYMBOL(getHostCallReturnValue) "\n"
SYMBOL_STRING(getHostCallReturnValue) ":" "\n"
"mov 40(%r13), %r13\n"
"mov 32(%r13), %r13\n"
"mov %r13, %rdi\n"
"jmp " LOCAL_REFERENCE(getHostCallReturnValueWithExecState) "\n"
);
......@@ -1728,7 +1728,7 @@ asm (
".globl " SYMBOL_STRING(getHostCallReturnValue) "\n"
HIDE_SYMBOL(getHostCallReturnValue) "\n"
SYMBOL_STRING(getHostCallReturnValue) ":" "\n"
"mov 40(%edi), %edi\n"
"mov 32(%edi), %edi\n"
"mov %edi, 4(%esp)\n"
"jmp " LOCAL_REFERENCE(getHostCallReturnValueWithExecState) "\n"
);
......@@ -1742,7 +1742,7 @@ HIDE_SYMBOL(getHostCallReturnValue) "\n"
".thumb" "\n"
".thumb_func " THUMB_FUNC_PARAM(getHostCallReturnValue) "\n"
SYMBOL_STRING(getHostCallReturnValue) ":" "\n"
"ldr r5, [r5, #40]" "\n"
"ldr r5, [r5, #32]" "\n"
"mov r0, r5" "\n"
"b " LOCAL_REFERENCE(getHostCallReturnValueWithExecState) "\n"
);
......@@ -1754,7 +1754,7 @@ asm (
HIDE_SYMBOL(getHostCallReturnValue) "\n"
INLINE_ARM_FUNCTION(getHostCallReturnValue)
SYMBOL_STRING(getHostCallReturnValue) ":" "\n"
"ldr r5, [r5, #40]" "\n"
"ldr r5, [r5, #32]" "\n"
"mov r0, r5" "\n"
"b " LOCAL_REFERENCE(getHostCallReturnValueWithExecState) "\n"
);
......@@ -1766,7 +1766,7 @@ asm (
".globl " SYMBOL_STRING(getHostCallReturnValue) "\n"
HIDE_SYMBOL(getHostCallReturnValue) "\n"
SYMBOL_STRING(getHostCallReturnValue) ":" "\n"
"ldur x25, [x25, #-40]" "\n"
"ldur x25, [x25, #-32]" "\n"
"mov x0, x25" "\n"
"b " LOCAL_REFERENCE(getHostCallReturnValueWithExecState) "\n"
);
......@@ -1778,7 +1778,7 @@ asm (
HIDE_SYMBOL(getHostCallReturnValue) "\n"
SYMBOL_STRING(getHostCallReturnValue) ":" "\n"
LOAD_FUNCTION_TO_T9(getHostCallReturnValueWithExecState)
"lw $s0, 40($s0)" "\n"
"lw $s0, 32($s0)" "\n"
"move $a0, $s0" "\n"
"b " LOCAL_REFERENCE(getHostCallReturnValueWithExecState) "\n"
);
......@@ -1789,7 +1789,7 @@ asm (
".globl " SYMBOL_STRING(getHostCallReturnValue) "\n"
HIDE_SYMBOL(getHostCallReturnValue) "\n"
SYMBOL_STRING(getHostCallReturnValue) ":" "\n"
"add #40, r14" "\n"
"add #32, r14" "\n"
"mov.l @r14, r14" "\n"
"mov r14, r4" "\n"
"mov.l 2f, " SH4_SCRATCH_REGISTER "\n"
......@@ -1804,7 +1804,7 @@ extern "C" {
__declspec(naked) EncodedJSValue HOST_CALL_RETURN_VALUE_OPTION getHostCallReturnValue()
{
__asm {
mov edi, [edi + 40];
mov edi, [edi + 32];
mov [esp + 4], edi;
jmp getHostCallReturnValueWithExecState
}
......
......@@ -499,7 +499,7 @@ MacroAssemblerCodeRef arityFixup(VM* vm)
jit.pop(JSInterfaceJIT::regT4);
# endif
jit.neg64(JSInterfaceJIT::regT0);
jit.addPtr(JSInterfaceJIT::TrustedImm32(8), JSInterfaceJIT::callFrameRegister, JSInterfaceJIT::regT3);
jit.move(JSInterfaceJIT::callFrameRegister, JSInterfaceJIT::regT3);
jit.load32(JSInterfaceJIT::Address(JSInterfaceJIT::callFrameRegister, JSStack::ArgumentCount * 8), JSInterfaceJIT::regT2);
jit.add32(JSInterfaceJIT::TrustedImm32(JSStack::CallFrameHeaderSize), JSInterfaceJIT::regT2);
......@@ -531,7 +531,7 @@ MacroAssemblerCodeRef arityFixup(VM* vm)
jit.pop(JSInterfaceJIT::regT4);
# endif
jit.neg32(JSInterfaceJIT::regT0);
jit.addPtr(JSInterfaceJIT::TrustedImm32(8), JSInterfaceJIT::callFrameRegister, JSInterfaceJIT::regT3);
jit.move(JSInterfaceJIT::callFrameRegister, JSInterfaceJIT::regT3);
jit.load32(JSInterfaceJIT::Address(JSInterfaceJIT::callFrameRegister, JSStack::ArgumentCount * 8), JSInterfaceJIT::regT2);
jit.add32(JSInterfaceJIT::TrustedImm32(JSStack::CallFrameHeaderSize), JSInterfaceJIT::regT2);
......
......@@ -71,13 +71,13 @@ void Data::performAssertions(VM& vm)
// Assertions to match LowLevelInterpreter.asm. If you change any of this code, be
// prepared to change LowLevelInterpreter.asm as well!!
ASSERT(JSStack::CallFrameHeaderSize * 8 == 48);
ASSERT(JSStack::ArgumentCount * 8 == 48);
ASSERT(JSStack::CallerFrame * 8 == 40);
ASSERT(JSStack::Callee * 8 == 32);
ASSERT(JSStack::ScopeChain * 8 == 24);
ASSERT(JSStack::ReturnPC * 8 == 16);
ASSERT(JSStack::CodeBlock * 8 == 8);
ASSERT(CallFrame::argumentOffsetIncludingThis(0) == JSStack::CallFrameHeaderSize + 1);
ASSERT(JSStack::ArgumentCount * 8 == 40);
ASSERT(JSStack::CallerFrame * 8 == 32);
ASSERT(JSStack::Callee * 8 == 24);
ASSERT(JSStack::ScopeChain * 8 == 16);
ASSERT(JSStack::ReturnPC * 8 == 8);
ASSERT(JSStack::CodeBlock * 8 == 0);
ASSERT(CallFrame::argumentOffsetIncludingThis(0) == JSStack::ThisArgument);
#if CPU(BIG_ENDIAN)
ASSERT(OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag) == 0);
ASSERT(OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload) == 4);
......
......@@ -427,8 +427,8 @@ LLINT_SLOW_PATH_DECL(stack_check)
dataLogF("Num vars = %u.\n", exec->codeBlock()->m_numVars);
dataLogF("Current end is at %p.\n", exec->vm().interpreter->stack().end());
#endif
ASSERT(!exec->vm().interpreter->stack().containsAddress(&exec->registers()[-exec->codeBlock()->m_numCalleeRegisters]));
if (UNLIKELY(!vm.interpreter->stack().grow(&exec->registers()[-exec->codeBlock()->m_numCalleeRegisters]))) {
ASSERT(!exec->vm().interpreter->stack().containsAddress(&exec->registers()[virtualRegisterForLocal(exec->codeBlock()->m_numCalleeRegisters).offset()]));
if (UNLIKELY(!vm.interpreter->stack().grow(&exec->registers()[virtualRegisterForLocal(exec->codeBlock()->m_numCalleeRegisters).offset()]))) {
exec = exec->callerFrame();
CommonSlowPaths::interpreterThrowInCaller(exec, createStackOverflowError(exec));
pc = returnToThrowForThrownException(exec);
......
......@@ -33,14 +33,14 @@ end
# These declarations must match interpreter/JSStack.h.
const CallFrameHeaderSize = 48
const CallFrameHeaderSlots = 6
const ArgumentCount = 48
const CallerFrame = 40
const Callee = 32
const ScopeChain = 24
const ReturnPC = 16
const CodeBlock = 8
const ArgumentCount = 40
const CallerFrame = 32
const Callee = 24
const ScopeChain = 16
const ReturnPC = 8
const CodeBlock = 0
const ThisArgumentOffset = CallFrameHeaderSize + 8
const ThisArgumentOffset = ArgumentCount + 8
# Some value representation constants.
if JSVALUE64
......@@ -372,6 +372,7 @@ macro functionInitialization(profileArgSkip)
# Check stack height.
loadi CodeBlock::m_numCalleeRegisters[t1], t0
addi 1, t0 # Account that local0 goes at slot -1
loadp CodeBlock::m_vm[t1], t2
loadp VM::interpreter[t2], t2
lshiftp 3, t0
......
......@@ -316,7 +316,6 @@ macro functionArityCheck(doneLabel, slow_path)
// Move frame up "t1" slots
negi t1
move cfr, t3
addp 8, t3
loadi PayloadOffset + ArgumentCount[cfr], t2
addi CallFrameHeaderSlots, t2
.copyLoop:
......@@ -358,9 +357,9 @@ _llint_op_enter:
move 0, t1
negi t2
.opEnterLoop:
addi 1, t2
storei t0, TagOffset[cfr, t2, 8]
storei t1, PayloadOffset[cfr, t2, 8]
addi 1, t2
btinz t2, .opEnterLoop
.opEnterDone:
dispatch(1)
......
......@@ -212,7 +212,6 @@ macro functionArityCheck(doneLabel, slow_path)
// Move frame up "t1" slots
negq t1
move cfr, t3
addp 8, t3
loadi PayloadOffset + ArgumentCount[cfr], t2
addi CallFrameHeaderSlots, t2
.copyLoop:
......@@ -252,8 +251,8 @@ _llint_op_enter:
negi t2
sxi2q t2, t2
.opEnterLoop:
addq 1, t2
storeq t0, [cfr, t2, 8]
addq 1, t2
btqnz t2, .opEnterLoop
.opEnterDone:
dispatch(1)
......
......@@ -53,7 +53,7 @@ ALWAYS_INLINE int arityCheckFor(ExecState* exec, JSStack* stack, CodeSpecializat
int argumentCountIncludingThis = exec->argumentCountIncludingThis();
// This ensures enough space for the worst case scenario of zero arguments passed by the caller.
if (!stack->grow(exec->registers() - newCodeBlock->numParameters() - newCodeBlock->m_numCalleeRegisters))
if (!stack->grow(exec->registers() - newCodeBlock->numParameters() + virtualRegisterForLocal(newCodeBlock->m_numCalleeRegisters).offset()))
return -1;
ASSERT(argumentCountIncludingThis < newCodeBlock->numParameters());
......
......@@ -144,9 +144,7 @@ private:
protected:
// Add one so we don't need to index with -1 to get current frame pointer.
// An index of -1 is an error for some compilers.
Register m_globalCallFrame[JSStack::CallFrameHeaderSize + 1];
Register m_globalCallFrame[JSStack::CallFrameHeaderSize];
WriteBarrier<JSObject> m_globalThis;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment