From a403144159a495c602a219eaad54b159e5d20936 Mon Sep 17 00:00:00 2001 From: "palfia@homejinni.com" Date: Mon, 31 Mar 2014 22:50:53 +0000 Subject: [PATCH] MIPS: Fix PrepareKeyedOperand on MIPS. Port r20363 (235f866c) Original commit message: When additional_offset is specified, the 'key' operand can be negative and still pass the bounds check. Therefore, when converting key from Smi, arithmetic and not logical shift must be used. BUG= R=plind44@gmail.com Review URL: https://codereview.chromium.org/219923005 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20370 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/mips/lithium-codegen-mips.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index 154dbc9..f5b99eb 100644 --- a/src/mips/lithium-codegen-mips.cc +++ b/src/mips/lithium-codegen-mips.cc @@ -3259,7 +3259,8 @@ MemOperand LCodeGen::PrepareKeyedOperand(Register key, __ Addu(scratch0(), scratch0(), Operand(base_offset)); } else { ASSERT_EQ(-1, shift_size); - __ srl(scratch0(), key, 1); + // Key can be negative, so using sra here. + __ sra(scratch0(), key, 1); __ Addu(scratch0(), scratch0(), Operand(base_offset)); } __ Addu(scratch0(), base, scratch0()); -- 2.7.4