Fix performace regression due to missed peephole optimization
opportunity. Review URL: http://codereview.chromium.org/2002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@286 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
3764f52a4e
commit
4afbecf50e
@ -948,6 +948,7 @@ void Slot::GenerateStoreCode(MacroAssembler* masm,
|
||||
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 @@ void Slot::GenerateStoreCode(MacroAssembler* masm,
|
||||
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 @@ void Slot::GenerateStoreCode(MacroAssembler* masm,
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -975,6 +975,7 @@ void Slot::GenerateStoreCode(MacroAssembler* masm,
|
||||
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 @@ void Slot::GenerateStoreCode(MacroAssembler* masm,
|
||||
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 @@ void Slot::GenerateStoreCode(MacroAssembler* masm,
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user