Commit ae4fd1e5 authored by kasperl@chromium.org's avatar kasperl@chromium.org

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
parent 05e87841
...@@ -581,7 +581,8 @@ void FullCodeGenerator::VisitDeclaration(Declaration* decl) { ...@@ -581,7 +581,8 @@ void FullCodeGenerator::VisitDeclaration(Declaration* decl) {
int offset = Context::SlotOffset(slot->index()); int offset = Context::SlotOffset(slot->index());
__ mov(r2, Operand(offset)); __ mov(r2, Operand(offset));
// We know that we have written a function, which is not a smi. // 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; break;
......
...@@ -205,6 +205,11 @@ void MacroAssembler::LoadRoot(Register destination, ...@@ -205,6 +205,11 @@ void MacroAssembler::LoadRoot(Register destination,
// tag is shifted away. // tag is shifted away.
void MacroAssembler::RecordWrite(Register object, Register offset, void MacroAssembler::RecordWrite(Register object, Register offset,
Register scratch) { 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 // 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, // 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). // shift right 5) and then multiply by kIntSize (4, shift left 2).
......
...@@ -695,7 +695,8 @@ void FullCodeGenerator::VisitDeclaration(Declaration* decl) { ...@@ -695,7 +695,8 @@ void FullCodeGenerator::VisitDeclaration(Declaration* decl) {
__ mov(CodeGenerator::ContextOperand(esi, slot->index()), __ mov(CodeGenerator::ContextOperand(esi, slot->index()),
result_register()); result_register());
int offset = Context::SlotOffset(slot->index()); int offset = Context::SlotOffset(slot->index());
__ RecordWrite(esi, offset, result_register(), ecx); __ mov(ebx, esi);
__ RecordWrite(ebx, offset, result_register(), ecx);
} }
break; break;
......
...@@ -147,6 +147,11 @@ void RecordWriteStub::Generate(MacroAssembler* masm) { ...@@ -147,6 +147,11 @@ void RecordWriteStub::Generate(MacroAssembler* masm) {
// All registers are clobbered by the operation. // All registers are clobbered by the operation.
void MacroAssembler::RecordWrite(Register object, int offset, void MacroAssembler::RecordWrite(Register object, int offset,
Register value, Register scratch) { 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 // 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 // catch stores of Smis and stores into young gen (which does not have space
// for the remembered set bits. // for the remembered set bits.
......
...@@ -698,7 +698,8 @@ void FullCodeGenerator::VisitDeclaration(Declaration* decl) { ...@@ -698,7 +698,8 @@ void FullCodeGenerator::VisitDeclaration(Declaration* decl) {
__ movq(CodeGenerator::ContextOperand(rsi, slot->index()), __ movq(CodeGenerator::ContextOperand(rsi, slot->index()),
result_register()); result_register());
int offset = Context::SlotOffset(slot->index()); int offset = Context::SlotOffset(slot->index());
__ RecordWrite(rsi, offset, result_register(), rcx); __ movq(rbx, rsi);
__ RecordWrite(rbx, offset, result_register(), rcx);
} }
break; break;
......
...@@ -178,6 +178,11 @@ void MacroAssembler::RecordWrite(Register object, ...@@ -178,6 +178,11 @@ void MacroAssembler::RecordWrite(Register object,
int offset, int offset,
Register value, Register value,
Register smi_index) { 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 // 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 // catch stores of Smis and stores into young gen (which does not have space
// for the remembered set bits. // for the remembered set bits.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment