Commit 29d28e7c authored by whessev8's avatar whessev8

Optimizes an assembly-language conversion from int to Smi in codegen.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1137 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 18c2d3ef
...@@ -1127,14 +1127,14 @@ void CodeGenerator::SmiOperation(Token::Value op, ...@@ -1127,14 +1127,14 @@ void CodeGenerator::SmiOperation(Token::Value op,
__ j(not_zero, deferred->enter(), not_taken); __ j(not_zero, deferred->enter(), not_taken);
__ sar(ebx, kSmiTagSize); __ sar(ebx, kSmiTagSize);
__ shl(ebx, shift_value); __ shl(ebx, shift_value);
// This is the Smi check for the shifted result. // Convert the int to a Smi, and check that it is in
// After signed subtraction of 0xc0000000, the valid // the range of valid Smis.
// Smis are positive. ASSERT(kSmiTagSize == times_2); // Adjust code if not true.
__ cmp(ebx, 0xc0000000); ASSERT(kSmiTag == 0); // Adjust code if not true.
__ j(sign, deferred->enter(), not_taken); __ add(ebx, Operand(ebx));
// tag result and store it in TOS (eax) __ j(overflow, deferred->enter(), not_taken);
ASSERT(kSmiTagSize == times_2); // adjust code if not the case __ mov(eax, Operand(ebx));
__ lea(eax, Operand(ebx, ebx, times_1, kSmiTag));
__ bind(deferred->exit()); __ bind(deferred->exit());
frame_->Push(eax); frame_->Push(eax);
} }
......
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