Avoid using RecordWrite with the context (esi, rsi, cp) as

one of the arguments since this may clobber the register.
Review URL: http://codereview.chromium.org/556101

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3757 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
kasperl@chromium.org 2010-02-01 13:20:43 +00:00
parent 05e8784136
commit ae4fd1e54f
6 changed files with 21 additions and 3 deletions

View File

@ -581,7 +581,8 @@ void FullCodeGenerator::VisitDeclaration(Declaration* decl) {
int offset = Context::SlotOffset(slot->index());
__ mov(r2, Operand(offset));
// We know that we have written a function, which is not a smi.
__ RecordWrite(cp, r2, result_register());
__ mov(r1, Operand(cp));
__ RecordWrite(r1, r2, result_register());
}
break;

View File

@ -205,6 +205,11 @@ void MacroAssembler::LoadRoot(Register destination,
// tag is shifted away.
void MacroAssembler::RecordWrite(Register object, Register offset,
Register scratch) {
// The compiled code assumes that record write doesn't change the
// context register, so we check that none of the clobbered
// registers are cp.
ASSERT(!object.is(cp) && !offset.is(cp) && !scratch.is(cp));
// This is how much we shift the remembered set bit offset to get the
// offset of the word in the remembered set. We divide by kBitsPerInt (32,
// shift right 5) and then multiply by kIntSize (4, shift left 2).

View File

@ -695,7 +695,8 @@ void FullCodeGenerator::VisitDeclaration(Declaration* decl) {
__ mov(CodeGenerator::ContextOperand(esi, slot->index()),
result_register());
int offset = Context::SlotOffset(slot->index());
__ RecordWrite(esi, offset, result_register(), ecx);
__ mov(ebx, esi);
__ RecordWrite(ebx, offset, result_register(), ecx);
}
break;

View File

@ -147,6 +147,11 @@ void RecordWriteStub::Generate(MacroAssembler* masm) {
// All registers are clobbered by the operation.
void MacroAssembler::RecordWrite(Register object, int offset,
Register value, Register scratch) {
// The compiled code assumes that record write doesn't change the
// context register, so we check that none of the clobbered
// registers are esi.
ASSERT(!object.is(esi) && !value.is(esi) && !scratch.is(esi));
// First, check if a remembered set write is even needed. The tests below
// catch stores of Smis and stores into young gen (which does not have space
// for the remembered set bits.

View File

@ -698,7 +698,8 @@ void FullCodeGenerator::VisitDeclaration(Declaration* decl) {
__ movq(CodeGenerator::ContextOperand(rsi, slot->index()),
result_register());
int offset = Context::SlotOffset(slot->index());
__ RecordWrite(rsi, offset, result_register(), rcx);
__ movq(rbx, rsi);
__ RecordWrite(rbx, offset, result_register(), rcx);
}
break;

View File

@ -178,6 +178,11 @@ void MacroAssembler::RecordWrite(Register object,
int offset,
Register value,
Register smi_index) {
// The compiled code assumes that record write doesn't change the
// context register, so we check that none of the clobbered
// registers are rsi.
ASSERT(!object.is(rsi) && !value.is(rsi) && !smi_index.is(rsi));
// First, check if a remembered set write is even needed. The tests below
// catch stores of Smis and stores into young gen (which does not have space
// for the remembered set bits.