MIPS: Fix PrepareKeyedOperand on MIPS.
authorpalfia@homejinni.com <palfia@homejinni.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 31 Mar 2014 22:50:53 +0000 (22:50 +0000)
committerpalfia@homejinni.com <palfia@homejinni.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 31 Mar 2014 22:50:53 +0000 (22:50 +0000)
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

index 154dbc9..f5b99eb 100644 (file)
@@ -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());