Fix DoubleStackSlot-to-DoubleStackSlot moves on ia32. Unify platform-independent code.

BUG=173907

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13617 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
jkummerow@chromium.org 2013-02-07 13:15:41 +00:00
parent a2f0a01371
commit b1d7878c7f
6 changed files with 20 additions and 59 deletions

View File

@ -568,30 +568,13 @@ MemOperand LCodeGen::ToMemOperand(LOperand* op) const {
ASSERT(!op->IsRegister());
ASSERT(!op->IsDoubleRegister());
ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot());
int index = op->index();
if (index >= 0) {
// Local or spill slot. Skip the frame pointer, function, and
// context in the fixed part of the frame.
return MemOperand(fp, -(index + 3) * kPointerSize);
} else {
// Incoming parameter. Skip the return address.
return MemOperand(fp, -(index - 1) * kPointerSize);
}
return MemOperand(fp, StackSlotOffset(op->index()));
}
MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const {
ASSERT(op->IsDoubleStackSlot());
int index = op->index();
if (index >= 0) {
// Local or spill slot. Skip the frame pointer, function, context,
// and the first word of the double in the fixed part of the frame.
return MemOperand(fp, -(index + 3) * kPointerSize + kPointerSize);
} else {
// Incoming parameter. Skip the return address and the first word of
// the double.
return MemOperand(fp, -(index - 1) * kPointerSize + kPointerSize);
}
return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize);
}

View File

@ -549,23 +549,13 @@ Operand LCodeGen::ToOperand(LOperand* op) const {
if (op->IsRegister()) return Operand(ToRegister(op));
if (op->IsDoubleRegister()) return Operand(ToDoubleRegister(op));
ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot());
int index = op->index();
if (index >= 0) {
// Local or spill slot. Skip the frame pointer, function, and
// context in the fixed part of the frame.
return Operand(ebp, -(index + 3) * kPointerSize);
} else {
// Incoming parameter. Skip the return address.
return Operand(ebp, -(index - 1) * kPointerSize);
}
return Operand(ebp, StackSlotOffset(op->index()));
}
Operand LCodeGen::HighOperand(LOperand* op) {
ASSERT(op->IsDoubleStackSlot());
int index = op->index();
int offset = (index >= 0) ? index + 3 : index - 1;
return Operand(ebp, -offset * kPointerSize);
return Operand(ebp, StackSlotOffset(op->index()) + kPointerSize);
}

View File

@ -257,6 +257,18 @@ int ElementsKindToShiftSize(ElementsKind elements_kind) {
}
int StackSlotOffset(int index) {
if (index >= 0) {
// Local or spill slot. Skip the frame pointer, function, and
// context in the fixed part of the frame.
return -(index + 3) * kPointerSize;
} else {
// Incoming parameter. Skip the return address.
return -(index - 1) * kPointerSize;
}
}
LChunk::LChunk(CompilationInfo* info, HGraph* graph)
: spill_slot_count_(0),
info_(info),

View File

@ -709,6 +709,7 @@ class LChunk: public ZoneObject {
int ElementsKindToShiftSize(ElementsKind elements_kind);
int StackSlotOffset(int index);
enum NumberUntagDMode {
NUMBER_CANDIDATE_IS_SMI,

View File

@ -528,30 +528,13 @@ MemOperand LCodeGen::ToMemOperand(LOperand* op) const {
ASSERT(!op->IsRegister());
ASSERT(!op->IsDoubleRegister());
ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot());
int index = op->index();
if (index >= 0) {
// Local or spill slot. Skip the frame pointer, function, and
// context in the fixed part of the frame.
return MemOperand(fp, -(index + 3) * kPointerSize);
} else {
// Incoming parameter. Skip the return address.
return MemOperand(fp, -(index - 1) * kPointerSize);
}
return MemOperand(fp, StackSlotOffset(op->index()));
}
MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const {
ASSERT(op->IsDoubleStackSlot());
int index = op->index();
if (index >= 0) {
// Local or spill slot. Skip the frame pointer, function, context,
// and the first word of the double in the fixed part of the frame.
return MemOperand(fp, -(index + 3) * kPointerSize + kPointerSize);
} else {
// Incoming parameter. Skip the return address and the first word of
// the double.
return MemOperand(fp, -(index - 1) * kPointerSize + kPointerSize);
}
return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize);
}

View File

@ -464,15 +464,7 @@ Operand LCodeGen::ToOperand(LOperand* op) const {
// Does not handle registers. In X64 assembler, plain registers are not
// representable as an Operand.
ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot());
int index = op->index();
if (index >= 0) {
// Local or spill slot. Skip the frame pointer, function, and
// context in the fixed part of the frame.
return Operand(rbp, -(index + 3) * kPointerSize);
} else {
// Incoming parameter. Skip the return address.
return Operand(rbp, -(index - 1) * kPointerSize);
}
return Operand(rbp, StackSlotOffset(op->index()));
}