Reviewers: William Hesse,

Description:
Mere r4172 to trunk. The new version is 2.1.6.1.


Please review this at http://codereview.chromium.org/1108001

SVN Base: http://v8.googlecode.com/svn/trunk/

Affected files:
  M     src/ia32/codegen-ia32.cc
  M     src/rewriter.cc
  M     src/version.cc
  M     test/mjsunit/compiler/loopcount.js


Index: test/mjsunit/compiler/loopcount.js
===================================================================
--- test/mjsunit/compiler/loopcount.js  (revision 4174)
+++ test/mjsunit/compiler/loopcount.js  (working copy)
@@ -53,3 +53,6 @@
   return i;
 }
 assertEquals(-0x40000001, f5());
+
+function f6() { var x = 0x3fffffff; x++; return x+1; }
+assertEquals(0x40000001, f6());
Index: src/ia32/codegen-ia32.cc
===================================================================
--- src/ia32/codegen-ia32.cc    (revision 4174)
+++ src/ia32/codegen-ia32.cc    (working copy)
@@ -3763,6 +3763,21 @@
     }
   }

+  // The update expression resets the type of the loop variable. So we
+  // set it to smi before compiling the test expression.
+  if (node->is_fast_smi_loop()) {
+    // Set number type of the loop variable to smi.
+    Slot* slot = node->loop_variable()->slot();
+    ASSERT(slot->type() == Slot::LOCAL);
+    frame_->SetTypeForLocalAt(slot->index(), NumberInfo::Smi());
+    if (FLAG_debug_code) {
+      frame_->PushLocalAt(slot->index());
+      Result var = frame_->Pop();
+      var.ToRegister();
+      __ AbortIfNotSmi(var.reg(), "Loop variable not a smi.");
+    }
+  }
+
   // Based on the condition analysis, compile the backward jump as
   // necessary.
   switch (info) {
@@ -6867,7 +6882,12 @@
       old_value = allocator_->Allocate();
       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.
+      old_value.set_number_info(new_value.number_info());
     }
+
     // Ensure the new value is writable.
     frame_->Spill(new_value.reg());

@@ -6931,6 +6951,8 @@
     }
     deferred->BindExit();

+    // The result of ++ or -- is always a number.
+    new_value.set_number_info(NumberInfo::Number());

     // Postfix: store the old value in the allocated slot under the
     // reference.
Index: src/rewriter.cc
===================================================================
--- src/rewriter.cc     (revision 4174)
+++ src/rewriter.cc     (working copy)
@@ -247,7 +247,9 @@
     }

     if (FLAG_safe_int32_compiler) {
-      if (var->IsStackAllocated() && !var->is_arguments()) {
+      if (var->IsStackAllocated() &&
+          !var->is_arguments() &&
+          var->mode() != Variable::CONST) {
         node->set_side_effect_free(true);
       }
     }
Index: src/version.cc
===================================================================
--- src/version.cc      (revision 4174)
+++ src/version.cc      (working copy)
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     2
 #define MINOR_VERSION     1
 #define BUILD_NUMBER      6
-#define PATCH_LEVEL       0
+#define PATCH_LEVEL       1
 #define CANDIDATE_VERSION false

 // Define SONAME to have the SCons build the put a specific SONAME into the


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

Reply via email to