Index: src/codegen-ia32.cc |
=================================================================== |
--- src/codegen-ia32.cc (revision 282) |
+++ src/codegen-ia32.cc (working copy) |
@@ -975,6 +975,7 @@ |
ASSERT(var()->mode() != Variable::DYNAMIC); |
Label exit; |
+ bool skipped_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); |
+ skipped_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 did not jump over the assignment, we do not need to bind the |
+ // exit label. Doing so can defeat peephole optimization. |
+ if (skipped_write) masm->bind(&exit); |
} |
} |