Revision: 10678
Author:   [email protected]
Date:     Mon Feb 13 00:17:32 2012
Log:      MIPS: Fixed several bugs in SubStringStub::Generate.

A combination of bugs caused this function to almost always jump to runtime
which is why most tests passed.

BUG=
TEST=sputnik/S15.5.4.13_A2_T6

Review URL: https://chromiumcodereview.appspot.com/9382005
Patch from Daniel Kalmar <[email protected]>.
http://code.google.com/p/v8/source/detail?r=10678

Modified:
 /branches/bleeding_edge/src/mips/code-stubs-mips.cc

=======================================
--- /branches/bleeding_edge/src/mips/code-stubs-mips.cc Fri Feb 10 00:47:35 2012 +++ /branches/bleeding_edge/src/mips/code-stubs-mips.cc Mon Feb 13 00:17:32 2012
@@ -6061,25 +6061,23 @@

   // Utilize delay slots. SmiUntag doesn't emit a jump, everything else is
   // safe in this case.
-  __ UntagAndJumpIfSmi(a2, a2, &runtime);
-  __ UntagAndJumpIfSmi(a3, a3, &runtime);
-
+  __ UntagAndJumpIfNotSmi(a2, a2, &runtime);
+  __ UntagAndJumpIfNotSmi(a3, a3, &runtime);
   // Both a2 and a3 are untagged integers.

   __ Branch(&runtime, lt, a3, Operand(zero_reg));  // From < 0.

-  __ subu(a2, t5, a3);
-  __ Branch(&runtime, gt, a3, Operand(t5));  // Fail if from > to.
+  __ Branch(&runtime, gt, a3, Operand(a2));  // Fail if from > to.
+  __ Subu(a2, a2, a3);

   // Make sure first argument is a string.
   __ lw(v0, MemOperand(sp, kStringOffset));
-  __ Branch(&runtime, eq, v0, Operand(kSmiTagMask));
-
+  __ JumpIfSmi(v0, &runtime);
   __ lw(a1, FieldMemOperand(v0, HeapObject::kMapOffset));
   __ lbu(a1, FieldMemOperand(a1, Map::kInstanceTypeOffset));
-  __ And(t4, v0, Operand(kIsNotStringMask));
-
-  __ Branch(&runtime, ne, t4, Operand(zero_reg));
+  __ And(t0, a1, Operand(kIsNotStringMask));
+
+  __ Branch(&runtime, ne, t0, Operand(zero_reg));

   // Short-cut for the case of trivial substring.
   Label return_v0;

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to