From: plind44@gmail.com Date: Tue, 27 May 2014 13:37:33 +0000 (+0000) Subject: MIPS: Avoid HeapObject check in HStoreNamedField. X-Git-Tag: upstream/4.7.83~8945 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=052c36a3ca32aa2bd50006731cd892fa8c8220ac;p=platform%2Fupstream%2Fv8.git 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 . git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21525 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index f1deb3870..69e36f8c8 100644 --- a/src/mips/lithium-codegen-mips.cc +++ b/src/mips/lithium-codegen-mips.cc @@ -4056,23 +4056,12 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { return; } - SmiCheck check_needed = - instr->hydrogen()->value()->IsHeapObject() - ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; + __ AssertNotSmi(object); - ASSERT(!(representation.IsSmi() && - instr->value()->IsConstantOperand() && - !IsSmi(LConstantOperand::cast(instr->value())))); - if (representation.IsHeapObject()) { - 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(!representation.IsSmi() || + !instr->value()->IsConstantOperand() || + IsSmi(LConstantOperand::cast(instr->value()))); + if (representation.IsDouble()) { ASSERT(access.IsInobject()); ASSERT(!instr->hydrogen()->has_transition()); ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); @@ -4114,7 +4103,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { GetRAState(), kSaveFPRegs, EMIT_REMEMBERED_SET, - check_needed); + instr->hydrogen()->SmiCheckForWriteBarrier()); } } else { __ lw(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset)); @@ -4130,7 +4119,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { GetRAState(), kSaveFPRegs, EMIT_REMEMBERED_SET, - check_needed); + instr->hydrogen()->SmiCheckForWriteBarrier()); } } } diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc index 562c88d34..30fe8c4c8 100644 --- a/src/mips/lithium-mips.cc +++ b/src/mips/lithium-mips.cc @@ -2267,13 +2267,7 @@ LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { // We need a temporary register for write barrier of the map field. LOperand* temp = needs_write_barrier_for_map ? TempRegister() : NULL; - LInstruction* result = new(zone()) LStoreNamedField(obj, val, temp); - if (!instr->access().IsExternalMemory() && - instr->field_representation().IsHeapObject() && - !instr->value()->type().IsHeapObject()) { - result = AssignEnvironment(result); - } - return result; + return new(zone()) LStoreNamedField(obj, val, temp); } diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc index 02d798cae..d2fa8dec6 100644 --- a/src/mips/macro-assembler-mips.cc +++ b/src/mips/macro-assembler-mips.cc @@ -56,6 +56,11 @@ void MacroAssembler::Store(Register src, } else if (r.IsInteger16() || r.IsUInteger16()) { sh(src, dst); } else { + if (r.IsHeapObject()) { + AssertNotSmi(src); + } else if (r.IsSmi()) { + AssertSmi(src); + } sw(src, dst); } }