Commit a82bd050 authored by whesse@chromium.org's avatar whesse@chromium.org

X64: Remove compound smi+overflow test using cmov.

Review URL: http://codereview.chromium.org/165525

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2694 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ab041ee4
...@@ -3084,33 +3084,16 @@ void CodeGenerator::VisitCountOperation(CountOperation* node) { ...@@ -3084,33 +3084,16 @@ void CodeGenerator::VisitCountOperation(CountOperation* node) {
is_increment); is_increment);
} }
// If we have a free register, combine the smi and overflow checks.
Result tmp = allocator_->AllocateWithoutSpilling();
ASSERT(kSmiTagMask == 1 && kSmiTag == 0);
if (tmp.is_valid()) {
__ movl(tmp.reg(), Immediate(kSmiTagMask));
}
// Try incrementing or decrementing the smi.
__ movq(kScratchRegister, new_value.reg()); __ movq(kScratchRegister, new_value.reg());
if (is_increment) { if (is_increment) {
__ addl(kScratchRegister, Immediate(Smi::FromInt(1))); __ addl(kScratchRegister, Immediate(Smi::FromInt(1)));
} else { } else {
__ subl(kScratchRegister, Immediate(Smi::FromInt(1))); __ subl(kScratchRegister, Immediate(Smi::FromInt(1)));
} }
// Smi test.
// Go to the deferred case if the result overflows or is non-smi. deferred->Branch(overflow);
if (tmp.is_valid()){ __ testl(kScratchRegister, Immediate(kSmiTagMask));
__ cmovl(overflow, kScratchRegister, tmp.reg()); deferred->Branch(not_zero);
__ testl(kScratchRegister, tmp.reg());
tmp.Unuse();
deferred->Branch(not_zero);
} else {
deferred->Branch(overflow);
__ testl(kScratchRegister, Immediate(kSmiTagMask));
deferred->Branch(not_zero);
}
__ movq(new_value.reg(), kScratchRegister); __ movq(new_value.reg(), kScratchRegister);
deferred->BindExit(); deferred->BindExit();
......
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