Update Integer32ToSmiField, SmiToInteger32, and SmiComprare to support 31-bit SMI for x32 port
R=verwaest@chromium.org Review URL: https://codereview.chromium.org/222133003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20635 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
22ca5b97e4
commit
cee232e6a8
@ -357,6 +357,10 @@ inline Condition ReverseCondition(Condition cc) {
|
||||
class Immediate BASE_EMBEDDED {
|
||||
public:
|
||||
explicit Immediate(int32_t value) : value_(value) {}
|
||||
explicit Immediate(Smi* value) {
|
||||
ASSERT(SmiValuesAre31Bits()); // Only available for 31-bit SMI.
|
||||
value_ = static_cast<int32_t>(reinterpret_cast<intptr_t>(value));
|
||||
}
|
||||
|
||||
private:
|
||||
int32_t value_;
|
||||
|
@ -1108,8 +1108,15 @@ void MacroAssembler::Integer32ToSmiField(const Operand& dst, Register src) {
|
||||
Abort(kInteger32ToSmiFieldWritingToNonSmiLocation);
|
||||
bind(&ok);
|
||||
}
|
||||
ASSERT(kSmiShift % kBitsPerByte == 0);
|
||||
movl(Operand(dst, kSmiShift / kBitsPerByte), src);
|
||||
|
||||
if (SmiValuesAre32Bits()) {
|
||||
ASSERT(kSmiShift % kBitsPerByte == 0);
|
||||
movl(Operand(dst, kSmiShift / kBitsPerByte), src);
|
||||
} else {
|
||||
ASSERT(SmiValuesAre31Bits());
|
||||
Integer32ToSmi(kScratchRegister, src);
|
||||
movp(dst, kScratchRegister);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1130,12 +1137,24 @@ void MacroAssembler::SmiToInteger32(Register dst, Register src) {
|
||||
if (!dst.is(src)) {
|
||||
movp(dst, src);
|
||||
}
|
||||
shrq(dst, Immediate(kSmiShift));
|
||||
|
||||
if (SmiValuesAre32Bits()) {
|
||||
shrp(dst, Immediate(kSmiShift));
|
||||
} else {
|
||||
ASSERT(SmiValuesAre31Bits());
|
||||
sarl(dst, Immediate(kSmiShift));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::SmiToInteger32(Register dst, const Operand& src) {
|
||||
movl(dst, Operand(src, kSmiShift / kBitsPerByte));
|
||||
if (SmiValuesAre32Bits()) {
|
||||
movl(dst, Operand(src, kSmiShift / kBitsPerByte));
|
||||
} else {
|
||||
ASSERT(SmiValuesAre31Bits());
|
||||
movl(dst, src);
|
||||
sarl(dst, Immediate(kSmiShift));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1144,12 +1163,22 @@ void MacroAssembler::SmiToInteger64(Register dst, Register src) {
|
||||
if (!dst.is(src)) {
|
||||
movp(dst, src);
|
||||
}
|
||||
sarq(dst, Immediate(kSmiShift));
|
||||
sarp(dst, Immediate(kSmiShift));
|
||||
if (kPointerSize == kInt32Size) {
|
||||
// Sign extend to 64-bit.
|
||||
movsxlq(dst, dst);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::SmiToInteger64(Register dst, const Operand& src) {
|
||||
movsxlq(dst, Operand(src, kSmiShift / kBitsPerByte));
|
||||
if (SmiValuesAre32Bits()) {
|
||||
movsxlq(dst, Operand(src, kSmiShift / kBitsPerByte));
|
||||
} else {
|
||||
ASSERT(SmiValuesAre31Bits());
|
||||
movp(dst, src);
|
||||
SmiToInteger64(dst, dst);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1199,7 +1228,12 @@ void MacroAssembler::SmiCompare(const Operand& dst, Register src) {
|
||||
|
||||
void MacroAssembler::SmiCompare(const Operand& dst, Smi* src) {
|
||||
AssertSmi(dst);
|
||||
cmpl(Operand(dst, kSmiShift / kBitsPerByte), Immediate(src->value()));
|
||||
if (SmiValuesAre32Bits()) {
|
||||
cmpl(Operand(dst, kSmiShift / kBitsPerByte), Immediate(src->value()));
|
||||
} else {
|
||||
ASSERT(SmiValuesAre31Bits());
|
||||
cmpl(dst, Immediate(src));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1212,7 +1246,13 @@ void MacroAssembler::Cmp(const Operand& dst, Smi* src) {
|
||||
|
||||
|
||||
void MacroAssembler::SmiCompareInteger32(const Operand& dst, Register src) {
|
||||
cmpl(Operand(dst, kSmiShift / kBitsPerByte), src);
|
||||
if (SmiValuesAre32Bits()) {
|
||||
cmpl(Operand(dst, kSmiShift / kBitsPerByte), src);
|
||||
} else {
|
||||
ASSERT(SmiValuesAre31Bits());
|
||||
SmiToInteger32(kScratchRegister, dst);
|
||||
cmpl(kScratchRegister, src);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -657,10 +657,10 @@ class MacroAssembler: public Assembler {
|
||||
Register src,
|
||||
int shift_value);
|
||||
void SmiShiftLogicalRightConstant(Register dst,
|
||||
Register src,
|
||||
int shift_value,
|
||||
Label* on_not_smi_result,
|
||||
Label::Distance near_jump = Label::kFar);
|
||||
Register src,
|
||||
int shift_value,
|
||||
Label* on_not_smi_result,
|
||||
Label::Distance near_jump = Label::kFar);
|
||||
void SmiShiftArithmeticRightConstant(Register dst,
|
||||
Register src,
|
||||
int shift_value);
|
||||
|
Loading…
Reference in New Issue
Block a user