Reviewers: Yang, danno, Paul Lind,

Description:
MIPS: Change generated code for substring not to bail out to runtime system.

Port r10012 (09c6bcba81).

Original commit message:
There is no need to bail out to runtime system when creating sliced strings of
external strings since the string content is unimportant.

BUG=
TEST=


Please review this at http://codereview.chromium.org/8585041/

Affected files:
  M src/mips/code-stubs-mips.cc


Index: src/mips/code-stubs-mips.cc
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
index 423a2e9eaf0be92f9a8da169c2156f3a2b850e8d..dd1af02cdad20036b410df2e4b23536c9f531fcd 100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -6026,15 +6026,13 @@ void SubStringStub::Generate(MacroAssembler* masm) {
     // a3: from index (untagged smi)
     // t2 (a.k.a. to): to (smi)
     // t3 (a.k.a. from): from offset (smi)
-    Label allocate_slice, sliced_string, seq_string;
-    STATIC_ASSERT(kSeqStringTag == 0);
-    __ And(t4, a1, Operand(kStringRepresentationMask));
-    __ Branch(&seq_string, eq, t4, Operand(zero_reg));
+    Label allocate_slice, sliced_string, seq_or_external_string;
+ // If the string is not indirect, it can only be sequential or external. STATIC_ASSERT(kIsIndirectStringMask == (kSlicedStringTag & kConsStringTag));
     STATIC_ASSERT(kIsIndirectStringMask != 0);
     __ And(t4, a1, Operand(kIsIndirectStringMask));
     // External string.  Jump to runtime.
-    __ Branch(&sub_string_runtime, eq, t4, Operand(zero_reg));
+    __ Branch(&seq_or_external_string, eq, t4, Operand(zero_reg));

     __ And(t4, a1, Operand(kSlicedNotConsMask));
     __ Branch(&sliced_string, ne, t4, Operand(zero_reg));
@@ -6052,8 +6050,8 @@ void SubStringStub::Generate(MacroAssembler* masm) {
     __ lw(t1, FieldMemOperand(v0, SlicedString::kParentOffset));
     __ jmp(&allocate_slice);

-    __ bind(&seq_string);
-    // Sequential string.  Just move string to the right register.
+    __ bind(&seq_or_external_string);
+ // Sequential or external string. Just move string to the correct register.
     __ mov(t1, v0);

     __ bind(&allocate_slice);


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

Reply via email to