Author: [EMAIL PROTECTED]
Date: Thu Sep 11 08:16:08 2008
New Revision: 286

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

Log:
Fix performace regression due to missed peephole optimization
opportunity.
Review URL: http://codereview.chromium.org/2002

Modified: branches/bleeding_edge/src/codegen-arm.cc
==============================================================================
--- branches/bleeding_edge/src/codegen-arm.cc   (original)
+++ branches/bleeding_edge/src/codegen-arm.cc   Thu Sep 11 08:16:08 2008
@@ -948,6 +948,7 @@
      ASSERT(var()->mode() != Variable::DYNAMIC);

      Label exit;
+    bool may_skip_write = false;
      if (init_state == CONST_INIT) {
        ASSERT(var()->mode() == Variable::CONST);
        // Only the first const initialization must be executed (the slot
@@ -957,6 +958,7 @@
        masm->ldr(r2, ArmCodeGenerator::SlotOperand(masm, scope, this, r2));
        masm->cmp(r2, Operand(Factory::the_hole_value()));
        masm->b(ne, &exit);
+      may_skip_write = true;
      }

      // We must execute the store.
@@ -981,7 +983,9 @@
        masm->mov(r3, Operand(offset));
        masm->RecordWrite(r2, r3, r1);
      }
-    masm->bind(&exit);
+    // If we definitely did not jump over the assignment, we do not need to
+    // bind the exit label.  Doing so can defeat peephole optimization.
+    if (may_skip_write) masm->bind(&exit);
    }
  }


Modified: branches/bleeding_edge/src/codegen-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/codegen-ia32.cc  (original)
+++ branches/bleeding_edge/src/codegen-ia32.cc  Thu Sep 11 08:16:08 2008
@@ -975,6 +975,7 @@
      ASSERT(var()->mode() != Variable::DYNAMIC);

      Label exit;
+    bool may_skip_write = false;
      if (init_state == CONST_INIT) {
        ASSERT(var()->mode() == Variable::CONST);
        // Only the first const initialization must be executed (the slot
@@ -984,6 +985,7 @@
        masm->mov(eax, Ia32CodeGenerator::SlotOperand(masm, scope, this,  
ecx));
        masm->cmp(eax, Factory::the_hole_value());
        masm->j(not_equal, &exit);
+      may_skip_write = true;
      }

      // We must execute the store.
@@ -1003,7 +1005,9 @@
        int offset = FixedArray::kHeaderSize + index() * kPointerSize;
        masm->RecordWrite(ecx, offset, eax, ebx);
      }
-    masm->bind(&exit);
+    // If we definitely did not jump over the assignment, we do not need to
+    // bind the exit label.  Doing so can defeat peephole optimization.
+    if (may_skip_write) masm->bind(&exit);
    }
  }


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

Reply via email to