Put back the asserts in RememberedSetHelper, but correct this time.

Fix some incorrect comments.
Review URL: http://codereview.chromium.org/7977005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9344 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
erik.corry@gmail.com 2011-09-20 13:32:27 +00:00
parent 867bb733af
commit c8fe713986
12 changed files with 127 additions and 49 deletions

View File

@ -6893,8 +6893,11 @@ void RecordWriteStub::Generate(MacroAssembler* masm) {
__ b(&skip_to_incremental_compacting); __ b(&skip_to_incremental_compacting);
if (remembered_set_action_ == EMIT_REMEMBERED_SET) { if (remembered_set_action_ == EMIT_REMEMBERED_SET) {
__ RememberedSetHelper( __ RememberedSetHelper(object_,
address_, value_, save_fp_regs_mode_, MacroAssembler::kReturnAtEnd); address_,
value_,
save_fp_regs_mode_,
MacroAssembler::kReturnAtEnd);
} }
__ Ret(); __ Ret();
@ -6920,7 +6923,7 @@ void RecordWriteStub::GenerateIncremental(MacroAssembler* masm, Mode mode) {
Label dont_need_remembered_set; Label dont_need_remembered_set;
__ ldr(regs_.scratch0(), MemOperand(regs_.address(), 0)); __ ldr(regs_.scratch0(), MemOperand(regs_.address(), 0));
__ JumpIfNotInNewSpace(regs_.scratch0(), __ JumpIfNotInNewSpace(regs_.scratch0(), // Value.
regs_.scratch0(), regs_.scratch0(),
&dont_need_remembered_set); &dont_need_remembered_set);
@ -6936,8 +6939,11 @@ void RecordWriteStub::GenerateIncremental(MacroAssembler* masm, Mode mode) {
masm, kUpdateRememberedSetOnNoNeedToInformIncrementalMarker, mode); masm, kUpdateRememberedSetOnNoNeedToInformIncrementalMarker, mode);
InformIncrementalMarker(masm, mode); InformIncrementalMarker(masm, mode);
regs_.Restore(masm); regs_.Restore(masm);
__ RememberedSetHelper( __ RememberedSetHelper(object_,
address_, value_, save_fp_regs_mode_, MacroAssembler::kReturnAtEnd); address_,
value_,
save_fp_regs_mode_,
MacroAssembler::kReturnAtEnd);
__ bind(&dont_need_remembered_set); __ bind(&dont_need_remembered_set);
} }
@ -6999,8 +7005,11 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
regs_.Restore(masm); regs_.Restore(masm);
if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) { if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) {
__ RememberedSetHelper( __ RememberedSetHelper(object_,
address_, value_, save_fp_regs_mode_, MacroAssembler::kReturnAtEnd); address_,
value_,
save_fp_regs_mode_,
MacroAssembler::kReturnAtEnd);
} else { } else {
__ Ret(); __ Ret();
} }
@ -7040,8 +7049,11 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
regs_.Restore(masm); regs_.Restore(masm);
if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) { if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) {
__ RememberedSetHelper( __ RememberedSetHelper(object_,
address_, value_, save_fp_regs_mode_, MacroAssembler::kReturnAtEnd); address_,
value_,
save_fp_regs_mode_,
MacroAssembler::kReturnAtEnd);
} else { } else {
__ Ret(); __ Ret();
} }

View File

@ -3174,10 +3174,16 @@ void FullCodeGenerator::EmitSwapElements(ZoneList<Expression*>* args) {
// pauses in the middle of scanning a single object. Therefore the // pauses in the middle of scanning a single object. Therefore the
// incremental marker is not disturbed, so we don't need to call the // incremental marker is not disturbed, so we don't need to call the
// RecordWrite stub that notifies the incremental marker. // RecordWrite stub that notifies the incremental marker.
__ RememberedSetHelper( __ RememberedSetHelper(elements,
index1, scratch2, kDontSaveFPRegs, MacroAssembler::kFallThroughAtEnd); index1,
__ RememberedSetHelper( scratch2,
index2, scratch2, kDontSaveFPRegs, MacroAssembler::kFallThroughAtEnd); kDontSaveFPRegs,
MacroAssembler::kFallThroughAtEnd);
__ RememberedSetHelper(elements,
index2,
scratch2,
kDontSaveFPRegs,
MacroAssembler::kFallThroughAtEnd);
__ bind(&no_remembered_set); __ bind(&no_remembered_set);
// We are done. Drop elements from the stack, and return undefined. // We are done. Drop elements from the stack, and return undefined.

View File

@ -523,11 +523,18 @@ void MacroAssembler::RecordWrite(Register object,
} }
void MacroAssembler::RememberedSetHelper(Register address, void MacroAssembler::RememberedSetHelper(Register object, // For debug tests.
Register address,
Register scratch, Register scratch,
SaveFPRegsMode fp_mode, SaveFPRegsMode fp_mode,
RememberedSetFinalAction and_then) { RememberedSetFinalAction and_then) {
Label done; Label done;
if (FLAG_debug_code) {
Label ok;
JumpIfNotInNewSpace(object, scratch, &ok);
stop("Remembered set pointer is in new space");
bind(&ok);
}
// Load store buffer top. // Load store buffer top.
ExternalReference store_buffer = ExternalReference store_buffer =
ExternalReference::store_buffer_top(isolate()); ExternalReference::store_buffer_top(isolate());

View File

@ -181,7 +181,8 @@ class MacroAssembler: public Assembler {
// Record in the remembered set the fact that we have a pointer to new space // Record in the remembered set the fact that we have a pointer to new space
// at the address pointed to by the addr register. Only works if addr is not // at the address pointed to by the addr register. Only works if addr is not
// in new space. // in new space.
void RememberedSetHelper(Register addr, void RememberedSetHelper(Register object, // Used for debug code.
Register addr,
Register scratch, Register scratch,
SaveFPRegsMode save_fp, SaveFPRegsMode save_fp,
RememberedSetFinalAction and_then); RememberedSetFinalAction and_then);
@ -193,7 +194,7 @@ class MacroAssembler: public Assembler {
Label* condition_met); Label* condition_met);
// Check if object is in new space. Jumps if the object is not in new space. // Check if object is in new space. Jumps if the object is not in new space.
// The register scratch can be object itself, but it will be clobbered. // The register scratch can be object itself, but scratch will be clobbered.
void JumpIfNotInNewSpace(Register object, void JumpIfNotInNewSpace(Register object,
Register scratch, Register scratch,
Label* branch) { Label* branch) {

View File

@ -6662,8 +6662,11 @@ void RecordWriteStub::Generate(MacroAssembler* masm) {
__ jmp(&skip_to_incremental_compacting, Label::kFar); __ jmp(&skip_to_incremental_compacting, Label::kFar);
if (remembered_set_action_ == EMIT_REMEMBERED_SET) { if (remembered_set_action_ == EMIT_REMEMBERED_SET) {
__ RememberedSetHelper( __ RememberedSetHelper(object_,
address_, value_, save_fp_regs_mode_, MacroAssembler::kReturnAtEnd); address_,
value_,
save_fp_regs_mode_,
MacroAssembler::kReturnAtEnd);
} else { } else {
__ ret(0); __ ret(0);
} }
@ -6688,7 +6691,7 @@ void RecordWriteStub::GenerateIncremental(MacroAssembler* masm, Mode mode) {
Label dont_need_remembered_set; Label dont_need_remembered_set;
__ mov(regs_.scratch0(), Operand(regs_.address(), 0)); __ mov(regs_.scratch0(), Operand(regs_.address(), 0));
__ JumpIfNotInNewSpace(regs_.scratch0(), __ JumpIfNotInNewSpace(regs_.scratch0(), // Value.
regs_.scratch0(), regs_.scratch0(),
&dont_need_remembered_set); &dont_need_remembered_set);
@ -6706,8 +6709,11 @@ void RecordWriteStub::GenerateIncremental(MacroAssembler* masm, Mode mode) {
mode); mode);
InformIncrementalMarker(masm, mode); InformIncrementalMarker(masm, mode);
regs_.Restore(masm); regs_.Restore(masm);
__ RememberedSetHelper( __ RememberedSetHelper(object_,
address_, value_, save_fp_regs_mode_, MacroAssembler::kReturnAtEnd); address_,
value_,
save_fp_regs_mode_,
MacroAssembler::kReturnAtEnd);
__ bind(&dont_need_remembered_set); __ bind(&dont_need_remembered_set);
} }
@ -6770,8 +6776,11 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
regs_.Restore(masm); regs_.Restore(masm);
if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) { if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) {
__ RememberedSetHelper( __ RememberedSetHelper(object_,
address_, value_, save_fp_regs_mode_, MacroAssembler::kReturnAtEnd); address_,
value_,
save_fp_regs_mode_,
MacroAssembler::kReturnAtEnd);
} else { } else {
__ ret(0); __ ret(0);
} }
@ -6815,8 +6824,11 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
regs_.Restore(masm); regs_.Restore(masm);
if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) { if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) {
__ RememberedSetHelper( __ RememberedSetHelper(object_,
address_, value_, save_fp_regs_mode_, MacroAssembler::kReturnAtEnd); address_,
value_,
save_fp_regs_mode_,
MacroAssembler::kReturnAtEnd);
} else { } else {
__ ret(0); __ ret(0);
} }

View File

@ -3168,10 +3168,16 @@ void FullCodeGenerator::EmitSwapElements(ZoneList<Expression*>* args) {
// pauses in the middle of scanning a single object. Therefore the // pauses in the middle of scanning a single object. Therefore the
// incremental marker is not disturbed, so we don't need to call the // incremental marker is not disturbed, so we don't need to call the
// RecordWrite stub that notifies the incremental marker. // RecordWrite stub that notifies the incremental marker.
__ RememberedSetHelper( __ RememberedSetHelper(elements,
index_1, temp, kDontSaveFPRegs, MacroAssembler::kFallThroughAtEnd); index_1,
__ RememberedSetHelper( temp,
index_2, temp, kDontSaveFPRegs, MacroAssembler::kFallThroughAtEnd); kDontSaveFPRegs,
MacroAssembler::kFallThroughAtEnd);
__ RememberedSetHelper(elements,
index_2,
temp,
kDontSaveFPRegs,
MacroAssembler::kFallThroughAtEnd);
__ bind(&no_remembered_set); __ bind(&no_remembered_set);

View File

@ -79,11 +79,18 @@ void MacroAssembler::InNewSpace(
void MacroAssembler::RememberedSetHelper( void MacroAssembler::RememberedSetHelper(
Register object, // Only used for debug checks.
Register addr, Register addr,
Register scratch, Register scratch,
SaveFPRegsMode save_fp, SaveFPRegsMode save_fp,
MacroAssembler::RememberedSetFinalAction and_then) { MacroAssembler::RememberedSetFinalAction and_then) {
Label done; Label done;
if (FLAG_debug_code) {
Label ok;
JumpIfNotInNewSpace(object, scratch, &ok, Label::kNear);
int3();
bind(&ok);
}
// Load store buffer top. // Load store buffer top.
ExternalReference store_buffer = ExternalReference store_buffer =
ExternalReference::store_buffer_top(isolate()); ExternalReference::store_buffer_top(isolate());

View File

@ -77,7 +77,8 @@ class MacroAssembler: public Assembler {
// Record in the remembered set the fact that we have a pointer to new space // Record in the remembered set the fact that we have a pointer to new space
// at the address pointed to by the addr register. Only works if addr is not // at the address pointed to by the addr register. Only works if addr is not
// in new space. // in new space.
void RememberedSetHelper(Register addr, void RememberedSetHelper(Register object, // Used for debug code.
Register addr,
Register scratch, Register scratch,
SaveFPRegsMode save_fp, SaveFPRegsMode save_fp,
RememberedSetFinalAction and_then); RememberedSetFinalAction and_then);
@ -90,7 +91,7 @@ class MacroAssembler: public Assembler {
Label::Distance condition_met_distance = Label::kFar); Label::Distance condition_met_distance = Label::kFar);
// Check if object is in new space. Jumps if the object is not in new space. // Check if object is in new space. Jumps if the object is not in new space.
// The register scratch can be object itself, but it will be clobbered. // The register scratch can be object itself, but scratch will be clobbered.
void JumpIfNotInNewSpace(Register object, void JumpIfNotInNewSpace(Register object,
Register scratch, Register scratch,
Label* branch, Label* branch,
@ -182,7 +183,7 @@ class MacroAssembler: public Assembler {
// For page containing |object| mark region covering |address| // For page containing |object| mark region covering |address|
// dirty. |object| is the object being stored into, |value| is the // dirty. |object| is the object being stored into, |value| is the
// object being stored. All registers are clobbered by the // object being stored. The address and value registers are clobbered by the
// operation. RecordWrite filters out smis so it does not update the // operation. RecordWrite filters out smis so it does not update the
// write barrier if the value is a smi. // write barrier if the value is a smi.
void RecordWrite( void RecordWrite(

View File

@ -5633,8 +5633,11 @@ void RecordWriteStub::Generate(MacroAssembler* masm) {
__ jmp(&skip_to_incremental_compacting, Label::kFar); __ jmp(&skip_to_incremental_compacting, Label::kFar);
if (remembered_set_action_ == EMIT_REMEMBERED_SET) { if (remembered_set_action_ == EMIT_REMEMBERED_SET) {
__ RememberedSetHelper( __ RememberedSetHelper(object_,
address_, value_, save_fp_regs_mode_, MacroAssembler::kReturnAtEnd); address_,
value_,
save_fp_regs_mode_,
MacroAssembler::kReturnAtEnd);
} else { } else {
__ ret(0); __ ret(0);
} }
@ -5675,8 +5678,11 @@ void RecordWriteStub::GenerateIncremental(MacroAssembler* masm, Mode mode) {
masm, kUpdateRememberedSetOnNoNeedToInformIncrementalMarker, mode); masm, kUpdateRememberedSetOnNoNeedToInformIncrementalMarker, mode);
InformIncrementalMarker(masm, mode); InformIncrementalMarker(masm, mode);
regs_.Restore(masm); regs_.Restore(masm);
__ RememberedSetHelper( __ RememberedSetHelper(object_,
address_, value_, save_fp_regs_mode_, MacroAssembler::kReturnAtEnd); address_,
value_,
save_fp_regs_mode_,
MacroAssembler::kReturnAtEnd);
__ bind(&dont_need_remembered_set); __ bind(&dont_need_remembered_set);
} }
@ -5752,8 +5758,11 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
regs_.Restore(masm); regs_.Restore(masm);
if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) { if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) {
__ RememberedSetHelper( __ RememberedSetHelper(object_,
address_, value_, save_fp_regs_mode_, MacroAssembler::kReturnAtEnd); address_,
value_,
save_fp_regs_mode_,
MacroAssembler::kReturnAtEnd);
} else { } else {
__ ret(0); __ ret(0);
} }
@ -5794,8 +5803,11 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
regs_.Restore(masm); regs_.Restore(masm);
if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) { if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) {
__ RememberedSetHelper( __ RememberedSetHelper(object_,
address_, value_, save_fp_regs_mode_, MacroAssembler::kReturnAtEnd); address_,
value_,
save_fp_regs_mode_,
MacroAssembler::kReturnAtEnd);
} else { } else {
__ ret(0); __ ret(0);
} }

View File

@ -3036,10 +3036,16 @@ void FullCodeGenerator::EmitSwapElements(ZoneList<Expression*>* args) {
// pauses in the middle of scanning a single object. Therefore the // pauses in the middle of scanning a single object. Therefore the
// incremental marker is not disturbed, so we don't need to call the // incremental marker is not disturbed, so we don't need to call the
// RecordWrite stub that notifies the incremental marker. // RecordWrite stub that notifies the incremental marker.
__ RememberedSetHelper( __ RememberedSetHelper(elements,
index_1, temp, kDontSaveFPRegs, MacroAssembler::kFallThroughAtEnd); index_1,
__ RememberedSetHelper( temp,
index_2, temp, kDontSaveFPRegs, MacroAssembler::kFallThroughAtEnd); kDontSaveFPRegs,
MacroAssembler::kFallThroughAtEnd);
__ RememberedSetHelper(elements,
index_2,
temp,
kDontSaveFPRegs,
MacroAssembler::kFallThroughAtEnd);
__ bind(&no_remembered_set); __ bind(&no_remembered_set);

View File

@ -197,10 +197,17 @@ void MacroAssembler::CompareRoot(const Operand& with,
} }
void MacroAssembler::RememberedSetHelper(Register addr, void MacroAssembler::RememberedSetHelper(Register object, // For debug tests.
Register addr,
Register scratch, Register scratch,
SaveFPRegsMode save_fp, SaveFPRegsMode save_fp,
RememberedSetFinalAction and_then) { RememberedSetFinalAction and_then) {
if (FLAG_debug_code) {
Label ok;
JumpIfNotInNewSpace(object, scratch, &ok, Label::kNear);
int3();
bind(&ok);
}
// Load store buffer top. // Load store buffer top.
LoadRoot(scratch, Heap::kStoreBufferTopRootIndex); LoadRoot(scratch, Heap::kStoreBufferTopRootIndex);
// Store pointer to buffer. // Store pointer to buffer.

View File

@ -165,7 +165,8 @@ class MacroAssembler: public Assembler {
// Record in the remembered set the fact that we have a pointer to new space // Record in the remembered set the fact that we have a pointer to new space
// at the address pointed to by the addr register. Only works if addr is not // at the address pointed to by the addr register. Only works if addr is not
// in new space. // in new space.
void RememberedSetHelper(Register addr, void RememberedSetHelper(Register object, // Used for debug code.
Register addr,
Register scratch, Register scratch,
SaveFPRegsMode save_fp, SaveFPRegsMode save_fp,
RememberedSetFinalAction and_then); RememberedSetFinalAction and_then);
@ -178,7 +179,7 @@ class MacroAssembler: public Assembler {
Label::Distance condition_met_distance = Label::kFar); Label::Distance condition_met_distance = Label::kFar);
// Check if object is in new space. Jumps if the object is not in new space. // Check if object is in new space. Jumps if the object is not in new space.
// The register scratch can be object itself, but it will be clobbered. // The register scratch can be object itself, but scratch will be clobbered.
void JumpIfNotInNewSpace(Register object, void JumpIfNotInNewSpace(Register object,
Register scratch, Register scratch,
Label* branch, Label* branch,
@ -267,9 +268,9 @@ class MacroAssembler: public Assembler {
RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET, RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET,
SmiCheck smi_check = INLINE_SMI_CHECK); SmiCheck smi_check = INLINE_SMI_CHECK);
// For page containing |object| mark region covering [address] // For page containing |object| mark region covering |address|
// dirty. |object| is the object being stored into, |value| is the // dirty. |object| is the object being stored into, |value| is the
// object being stored. All registers are clobbered by the // object being stored. The address and value registers are clobbered by the
// operation. RecordWrite filters out smis so it does not update // operation. RecordWrite filters out smis so it does not update
// the write barrier if the value is a smi. // the write barrier if the value is a smi.
void RecordWrite( void RecordWrite(