Use RegisterSize to count the pushq size and the argument slot size from JS to C++

R=verwaest@chromium.org

Review URL: https://codereview.chromium.org/213413010

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20317 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
haitao.feng@intel.com 2014-03-28 00:35:23 +00:00
parent c2bbd9f9e2
commit 9ff02c5d42
3 changed files with 33 additions and 31 deletions

View File

@ -56,11 +56,12 @@ class EntryFrameConstants : public AllStatic {
static const int kXMMRegistersBlockSize =
kXMMRegisterSize * kCalleeSaveXMMRegisters;
static const int kCallerFPOffset =
-10 * kPointerSize - kXMMRegistersBlockSize;
-3 * kPointerSize + -7 * kRegisterSize - kXMMRegistersBlockSize;
#else
static const int kCallerFPOffset = -8 * kPointerSize;
// We have 3 Push and 5 pushq in the JSEntryStub::GenerateBody.
static const int kCallerFPOffset = -3 * kPointerSize + -5 * kRegisterSize;
#endif
static const int kArgvOffset = 6 * kPointerSize;
static const int kArgvOffset = 6 * kPointerSize;
};

View File

@ -692,12 +692,12 @@ Handle<HeapObject> RegExpMacroAssemblerX64::GetCode(Handle<String> source) {
#else
// GCC passes arguments in rdi, rsi, rdx, rcx, r8, r9 (and then on stack).
// Push register parameters on stack for reference.
ASSERT_EQ(kInputString, -1 * kPointerSize);
ASSERT_EQ(kStartIndex, -2 * kPointerSize);
ASSERT_EQ(kInputStart, -3 * kPointerSize);
ASSERT_EQ(kInputEnd, -4 * kPointerSize);
ASSERT_EQ(kRegisterOutput, -5 * kPointerSize);
ASSERT_EQ(kNumOutputRegisters, -6 * kPointerSize);
ASSERT_EQ(kInputString, -1 * kRegisterSize);
ASSERT_EQ(kStartIndex, -2 * kRegisterSize);
ASSERT_EQ(kInputStart, -3 * kRegisterSize);
ASSERT_EQ(kInputEnd, -4 * kRegisterSize);
ASSERT_EQ(kRegisterOutput, -5 * kRegisterSize);
ASSERT_EQ(kNumOutputRegisters, -6 * kRegisterSize);
__ pushq(rdi);
__ pushq(rsi);
__ pushq(rdx);

View File

@ -135,8 +135,8 @@ class RegExpMacroAssemblerX64: public NativeRegExpMacroAssembler {
// Offsets from rbp of function parameters and stored registers.
static const int kFramePointer = 0;
// Above the frame pointer - function parameters and return address.
static const int kReturn_eip = kFramePointer + kPointerSize;
static const int kFrameAlign = kReturn_eip + kPointerSize;
static const int kReturn_eip = kFramePointer + kRegisterSize;
static const int kFrameAlign = kReturn_eip + kRegisterSize;
#ifdef _WIN64
// Parameters (first four passed as registers, but with room on stack).
@ -145,49 +145,50 @@ class RegExpMacroAssemblerX64: public NativeRegExpMacroAssembler {
// use this space to store the register passed parameters.
static const int kInputString = kFrameAlign;
// StartIndex is passed as 32 bit int.
static const int kStartIndex = kInputString + kPointerSize;
static const int kInputStart = kStartIndex + kPointerSize;
static const int kInputEnd = kInputStart + kPointerSize;
static const int kRegisterOutput = kInputEnd + kPointerSize;
static const int kStartIndex = kInputString + kRegisterSize;
static const int kInputStart = kStartIndex + kRegisterSize;
static const int kInputEnd = kInputStart + kRegisterSize;
static const int kRegisterOutput = kInputEnd + kRegisterSize;
// For the case of global regular expression, we have room to store at least
// one set of capture results. For the case of non-global regexp, we ignore
// this value. NumOutputRegisters is passed as 32-bit value. The upper
// 32 bit of this 64-bit stack slot may contain garbage.
static const int kNumOutputRegisters = kRegisterOutput + kPointerSize;
static const int kStackHighEnd = kNumOutputRegisters + kPointerSize;
static const int kNumOutputRegisters = kRegisterOutput + kRegisterSize;
static const int kStackHighEnd = kNumOutputRegisters + kRegisterSize;
// DirectCall is passed as 32 bit int (values 0 or 1).
static const int kDirectCall = kStackHighEnd + kPointerSize;
static const int kIsolate = kDirectCall + kPointerSize;
static const int kDirectCall = kStackHighEnd + kRegisterSize;
static const int kIsolate = kDirectCall + kRegisterSize;
#else
// In AMD64 ABI Calling Convention, the first six integer parameters
// are passed as registers, and caller must allocate space on the stack
// if it wants them stored. We push the parameters after the frame pointer.
static const int kInputString = kFramePointer - kPointerSize;
static const int kStartIndex = kInputString - kPointerSize;
static const int kInputStart = kStartIndex - kPointerSize;
static const int kInputEnd = kInputStart - kPointerSize;
static const int kRegisterOutput = kInputEnd - kPointerSize;
static const int kInputString = kFramePointer - kRegisterSize;
static const int kStartIndex = kInputString - kRegisterSize;
static const int kInputStart = kStartIndex - kRegisterSize;
static const int kInputEnd = kInputStart - kRegisterSize;
static const int kRegisterOutput = kInputEnd - kRegisterSize;
// For the case of global regular expression, we have room to store at least
// one set of capture results. For the case of non-global regexp, we ignore
// this value.
static const int kNumOutputRegisters = kRegisterOutput - kPointerSize;
static const int kNumOutputRegisters = kRegisterOutput - kRegisterSize;
static const int kStackHighEnd = kFrameAlign;
static const int kDirectCall = kStackHighEnd + kPointerSize;
static const int kIsolate = kDirectCall + kPointerSize;
static const int kDirectCall = kStackHighEnd + kRegisterSize;
static const int kIsolate = kDirectCall + kRegisterSize;
#endif
#ifdef _WIN64
// Microsoft calling convention has three callee-saved registers
// (that we are using). We push these after the frame pointer.
static const int kBackup_rsi = kFramePointer - kPointerSize;
static const int kBackup_rdi = kBackup_rsi - kPointerSize;
static const int kBackup_rbx = kBackup_rdi - kPointerSize;
static const int kBackup_rsi = kFramePointer - kRegisterSize;
static const int kBackup_rdi = kBackup_rsi - kRegisterSize;
static const int kBackup_rbx = kBackup_rdi - kRegisterSize;
static const int kLastCalleeSaveRegister = kBackup_rbx;
#else
// AMD64 Calling Convention has only one callee-save register that
// we use. We push this after the frame pointer (and after the
// parameters).
static const int kBackup_rbx = kNumOutputRegisters - kPointerSize;
static const int kBackup_rbx = kNumOutputRegisters - kRegisterSize;
static const int kLastCalleeSaveRegister = kBackup_rbx;
#endif