MIPS: Avoid HeapObject check in HStoreNamedField.

Port r21509 (78a54b0)

Original commit message:
This way an HStoreNamedField instruction can never deoptimize
itself, which is another important step towards a working
store elimination.

BUG=
R=plind44@gmail.com

Review URL: https://codereview.chromium.org/297143007

Patch from Balazs Kilvady <kilvadyb@homejinni.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21525 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
plind44@gmail.com 2014-05-27 13:37:33 +00:00
parent 95a9c7e565
commit 052c36a3ca
3 changed files with 13 additions and 25 deletions

View File

@ -4056,23 +4056,12 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
return; return;
} }
SmiCheck check_needed = __ AssertNotSmi(object);
instr->hydrogen()->value()->IsHeapObject()
? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
ASSERT(!(representation.IsSmi() && ASSERT(!representation.IsSmi() ||
instr->value()->IsConstantOperand() && !instr->value()->IsConstantOperand() ||
!IsSmi(LConstantOperand::cast(instr->value())))); IsSmi(LConstantOperand::cast(instr->value())));
if (representation.IsHeapObject()) { if (representation.IsDouble()) {
Register value = ToRegister(instr->value());
if (!instr->hydrogen()->value()->type().IsHeapObject()) {
__ SmiTst(value, scratch);
DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg));
// We know now that value is not a smi, so we can omit the check below.
check_needed = OMIT_SMI_CHECK;
}
} else if (representation.IsDouble()) {
ASSERT(access.IsInobject()); ASSERT(access.IsInobject());
ASSERT(!instr->hydrogen()->has_transition()); ASSERT(!instr->hydrogen()->has_transition());
ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
@ -4114,7 +4103,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
GetRAState(), GetRAState(),
kSaveFPRegs, kSaveFPRegs,
EMIT_REMEMBERED_SET, EMIT_REMEMBERED_SET,
check_needed); instr->hydrogen()->SmiCheckForWriteBarrier());
} }
} else { } else {
__ lw(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset)); __ lw(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset));
@ -4130,7 +4119,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
GetRAState(), GetRAState(),
kSaveFPRegs, kSaveFPRegs,
EMIT_REMEMBERED_SET, EMIT_REMEMBERED_SET,
check_needed); instr->hydrogen()->SmiCheckForWriteBarrier());
} }
} }
} }

View File

@ -2267,13 +2267,7 @@ LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
// We need a temporary register for write barrier of the map field. // We need a temporary register for write barrier of the map field.
LOperand* temp = needs_write_barrier_for_map ? TempRegister() : NULL; LOperand* temp = needs_write_barrier_for_map ? TempRegister() : NULL;
LInstruction* result = new(zone()) LStoreNamedField(obj, val, temp); return new(zone()) LStoreNamedField(obj, val, temp);
if (!instr->access().IsExternalMemory() &&
instr->field_representation().IsHeapObject() &&
!instr->value()->type().IsHeapObject()) {
result = AssignEnvironment(result);
}
return result;
} }

View File

@ -56,6 +56,11 @@ void MacroAssembler::Store(Register src,
} else if (r.IsInteger16() || r.IsUInteger16()) { } else if (r.IsInteger16() || r.IsUInteger16()) {
sh(src, dst); sh(src, dst);
} else { } else {
if (r.IsHeapObject()) {
AssertNotSmi(src);
} else if (r.IsSmi()) {
AssertSmi(src);
}
sw(src, dst); sw(src, dst);
} }
} }