From: palfia@homejinni.com Date: Mon, 2 Dec 2013 21:16:21 +0000 (+0000) Subject: MIPS: Fix HInnerAllocatedObject to use an HValue for the offset. X-Git-Tag: upstream/4.7.83~11453 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=68e0ca2e08bdf231dc8e28a97dca09b010e98f5a;p=platform%2Fupstream%2Fv8.git MIPS: Fix HInnerAllocatedObject to use an HValue for the offset. Port r18181 (2b41b833) BUG= R=plind44@gmail.com Review URL: https://codereview.chromium.org/99763003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18212 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index 8bfce05..8809869 100644 --- a/src/mips/lithium-codegen-mips.cc +++ b/src/mips/lithium-codegen-mips.cc @@ -4102,7 +4102,13 @@ void LCodeGen::DoStoreCodeEntry(LStoreCodeEntry* instr) { void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { Register result = ToRegister(instr->result()); Register base = ToRegister(instr->base_object()); - __ Addu(result, base, Operand(instr->offset())); + if (instr->offset()->IsConstantOperand()) { + LConstantOperand* offset = LConstantOperand::cast(instr->offset()); + __ Addu(result, base, Operand(ToInteger32(offset))); + } else { + Register offset = ToRegister(instr->offset()); + __ Addu(result, base, offset); + } } diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc index a7760d1..4f0f23f 100644 --- a/src/mips/lithium-mips.cc +++ b/src/mips/lithium-mips.cc @@ -277,7 +277,8 @@ void LStoreCodeEntry::PrintDataTo(StringStream* stream) { void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { stream->Add(" = "); base_object()->PrintTo(stream); - stream->Add(" + %d", offset()); + stream->Add(" + "); + offset()->PrintTo(stream); } @@ -1119,11 +1120,11 @@ LInstruction* LChunkBuilder::DoStoreCodeEntry( LInstruction* LChunkBuilder::DoInnerAllocatedObject( - HInnerAllocatedObject* inner_object) { - LOperand* base_object = UseRegisterAtStart(inner_object->base_object()); - LInnerAllocatedObject* result = - new(zone()) LInnerAllocatedObject(base_object); - return DefineAsRegister(result); + HInnerAllocatedObject* instr) { + LOperand* base_object = UseRegisterAtStart(instr->base_object()); + LOperand* offset = UseRegisterOrConstantAtStart(instr->offset()); + return DefineAsRegister( + new(zone()) LInnerAllocatedObject(base_object, offset)); } diff --git a/src/mips/lithium-mips.h b/src/mips/lithium-mips.h index 2996c78..dbb78ea 100644 --- a/src/mips/lithium-mips.h +++ b/src/mips/lithium-mips.h @@ -1778,19 +1778,19 @@ class LStoreCodeEntry V8_FINAL: public LTemplateInstruction<0, 1, 1> { }; -class LInnerAllocatedObject V8_FINAL: public LTemplateInstruction<1, 1, 0> { +class LInnerAllocatedObject V8_FINAL: public LTemplateInstruction<1, 2, 0> { public: - explicit LInnerAllocatedObject(LOperand* base_object) { + LInnerAllocatedObject(LOperand* base_object, LOperand* offset) { inputs_[0] = base_object; + inputs_[1] = offset; } - LOperand* base_object() { return inputs_[0]; } - int offset() { return hydrogen()->offset(); } + LOperand* base_object() const { return inputs_[0]; } + LOperand* offset() const { return inputs_[1]; } virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; - DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject, "sub-allocated-object") - DECLARE_HYDROGEN_ACCESSOR(InnerAllocatedObject) + DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject, "inner-allocated-object") };