Update number info for count operations.

If the input of a ++ or -- operation is a smi, the
result is an Integer32. Otherwise it is a number.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4177 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 494ba3a4
...@@ -6884,8 +6884,8 @@ void CodeGenerator::VisitCountOperation(CountOperation* node) { ...@@ -6884,8 +6884,8 @@ void CodeGenerator::VisitCountOperation(CountOperation* node) {
ASSERT(old_value.is_valid()); ASSERT(old_value.is_valid());
__ mov(old_value.reg(), new_value.reg()); __ mov(old_value.reg(), new_value.reg());
// The old value that is return for postfix operations has the // The return value for postfix operations is the
// same type as the input value we got from the frame. // same as the input, and has the same number info.
old_value.set_number_info(new_value.number_info()); old_value.set_number_info(new_value.number_info());
} }
...@@ -6952,8 +6952,13 @@ void CodeGenerator::VisitCountOperation(CountOperation* node) { ...@@ -6952,8 +6952,13 @@ void CodeGenerator::VisitCountOperation(CountOperation* node) {
} }
deferred->BindExit(); deferred->BindExit();
// The result of ++ or -- is always a number. // The result of ++ or -- is an Integer32 if the
// input is a smi. Otherwise it is a number.
if (new_value.is_smi()) {
new_value.set_number_info(NumberInfo::Integer32());
} else {
new_value.set_number_info(NumberInfo::Number()); new_value.set_number_info(NumberInfo::Number());
}
// Postfix: store the old value in the allocated slot under the // Postfix: store the old value in the allocated slot under the
// reference. // reference.
......
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