Commit 6e405733 authored by haitao.feng@intel.com's avatar haitao.feng@intel.com

Update CheckBothSmi, CheckInteger32ValidSmiValue,...

Update CheckBothSmi, CheckInteger32ValidSmiValue, CheckUInteger32ValidSmiValue, SmiAddConstant, SmiNot, AddSmiField and Test to support x32 port.

R=verwaest@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20862 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c8c95120
...@@ -1330,8 +1330,15 @@ Condition MacroAssembler::CheckBothSmi(Register first, Register second) { ...@@ -1330,8 +1330,15 @@ Condition MacroAssembler::CheckBothSmi(Register first, Register second) {
return CheckSmi(first); return CheckSmi(first);
} }
STATIC_ASSERT(kSmiTag == 0 && kHeapObjectTag == 1 && kHeapObjectTagMask == 3); STATIC_ASSERT(kSmiTag == 0 && kHeapObjectTag == 1 && kHeapObjectTagMask == 3);
leal(kScratchRegister, Operand(first, second, times_1, 0)); if (SmiValuesAre32Bits()) {
testb(kScratchRegister, Immediate(0x03)); leal(kScratchRegister, Operand(first, second, times_1, 0));
testb(kScratchRegister, Immediate(0x03));
} else {
ASSERT(SmiValuesAre31Bits());
movl(kScratchRegister, first);
orl(kScratchRegister, second);
testb(kScratchRegister, Immediate(kSmiTagMask));
}
return zero; return zero;
} }
...@@ -1377,16 +1384,28 @@ Condition MacroAssembler::CheckIsMinSmi(Register src) { ...@@ -1377,16 +1384,28 @@ Condition MacroAssembler::CheckIsMinSmi(Register src) {
Condition MacroAssembler::CheckInteger32ValidSmiValue(Register src) { Condition MacroAssembler::CheckInteger32ValidSmiValue(Register src) {
// A 32-bit integer value can always be converted to a smi. if (SmiValuesAre32Bits()) {
return always; // A 32-bit integer value can always be converted to a smi.
return always;
} else {
ASSERT(SmiValuesAre31Bits());
cmpl(src, Immediate(0xc0000000));
return positive;
}
} }
Condition MacroAssembler::CheckUInteger32ValidSmiValue(Register src) { Condition MacroAssembler::CheckUInteger32ValidSmiValue(Register src) {
// An unsigned 32-bit integer value is valid as long as the high bit if (SmiValuesAre32Bits()) {
// is not set. // An unsigned 32-bit integer value is valid as long as the high bit
testl(src, src); // is not set.
return positive; testl(src, src);
return positive;
} else {
ASSERT(SmiValuesAre31Bits());
testl(src, Immediate(0xc0000000));
return zero;
}
} }
...@@ -1529,7 +1548,13 @@ void MacroAssembler::SmiAddConstant(Register dst, Register src, Smi* constant) { ...@@ -1529,7 +1548,13 @@ void MacroAssembler::SmiAddConstant(Register dst, Register src, Smi* constant) {
void MacroAssembler::SmiAddConstant(const Operand& dst, Smi* constant) { void MacroAssembler::SmiAddConstant(const Operand& dst, Smi* constant) {
if (constant->value() != 0) { if (constant->value() != 0) {
addl(Operand(dst, kSmiShift / kBitsPerByte), Immediate(constant->value())); if (SmiValuesAre32Bits()) {
addl(Operand(dst, kSmiShift / kBitsPerByte),
Immediate(constant->value()));
} else {
ASSERT(SmiValuesAre31Bits());
addp(dst, Immediate(constant));
}
} }
} }
...@@ -1987,8 +2012,14 @@ void MacroAssembler::SmiMod(Register dst, ...@@ -1987,8 +2012,14 @@ void MacroAssembler::SmiMod(Register dst,
void MacroAssembler::SmiNot(Register dst, Register src) { void MacroAssembler::SmiNot(Register dst, Register src) {
ASSERT(!dst.is(kScratchRegister)); ASSERT(!dst.is(kScratchRegister));
ASSERT(!src.is(kScratchRegister)); ASSERT(!src.is(kScratchRegister));
// Set tag and padding bits before negating, so that they are zero afterwards. if (SmiValuesAre32Bits()) {
movl(kScratchRegister, Immediate(~0)); // Set tag and padding bits before negating, so that they are zero
// afterwards.
movl(kScratchRegister, Immediate(~0));
} else {
ASSERT(SmiValuesAre31Bits());
movl(kScratchRegister, Immediate(1));
}
if (dst.is(src)) { if (dst.is(src)) {
xorp(dst, kScratchRegister); xorp(dst, kScratchRegister);
} else { } else {
...@@ -2262,8 +2293,14 @@ SmiIndex MacroAssembler::SmiToNegativeIndex(Register dst, ...@@ -2262,8 +2293,14 @@ SmiIndex MacroAssembler::SmiToNegativeIndex(Register dst,
void MacroAssembler::AddSmiField(Register dst, const Operand& src) { void MacroAssembler::AddSmiField(Register dst, const Operand& src) {
ASSERT_EQ(0, kSmiShift % kBitsPerByte); if (SmiValuesAre32Bits()) {
addl(dst, Operand(src, kSmiShift / kBitsPerByte)); ASSERT_EQ(0, kSmiShift % kBitsPerByte);
addl(dst, Operand(src, kSmiShift / kBitsPerByte));
} else {
ASSERT(SmiValuesAre31Bits());
SmiToInteger32(kScratchRegister, src);
addl(dst, kScratchRegister);
}
} }
...@@ -2305,7 +2342,12 @@ void MacroAssembler::PopRegisterAsTwoSmis(Register dst, Register scratch) { ...@@ -2305,7 +2342,12 @@ void MacroAssembler::PopRegisterAsTwoSmis(Register dst, Register scratch) {
void MacroAssembler::Test(const Operand& src, Smi* source) { void MacroAssembler::Test(const Operand& src, Smi* source) {
testl(Operand(src, kIntSize), Immediate(source->value())); if (SmiValuesAre32Bits()) {
testl(Operand(src, kIntSize), Immediate(source->value()));
} else {
ASSERT(SmiValuesAre31Bits());
testl(src, Immediate(source));
}
} }
......
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