Revision: 4177
Author: [email protected]
Date: Thu Mar 18 03:01:53 2010
Log: 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
http://code.google.com/p/v8/source/detail?r=4177

Modified:
 /branches/bleeding_edge/src/ia32/codegen-ia32.cc

=======================================
--- /branches/bleeding_edge/src/ia32/codegen-ia32.cc Thu Mar 18 02:08:24 2010 +++ /branches/bleeding_edge/src/ia32/codegen-ia32.cc Thu Mar 18 03:01:53 2010
@@ -6884,8 +6884,8 @@
       ASSERT(old_value.is_valid());
       __ mov(old_value.reg(), new_value.reg());

-      // The old value that is return for postfix operations has the
-      // same type as the input value we got from the frame.
+      // The return value for postfix operations is the
+      // same as the input, and has the same number info.
       old_value.set_number_info(new_value.number_info());
     }

@@ -6952,8 +6952,13 @@
     }
     deferred->BindExit();

-    // The result of ++ or -- is always a number.
-    new_value.set_number_info(NumberInfo::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());
+    }

     // Postfix: store the old value in the allocated slot under the
     // reference.

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to