Revision: 11767
Author:   [email protected]
Date:     Mon Jun 11 23:13:14 2012
Log:      Port r11704 to MIPS.

BUG=2174
TEST=regexp-global.js

Review URL: https://chromiumcodereview.appspot.com/10538080
http://code.google.com/p/v8/source/detail?r=11767

Modified:
 /branches/bleeding_edge/src/mips/regexp-macro-assembler-mips.cc

=======================================
--- /branches/bleeding_edge/src/mips/regexp-macro-assembler-mips.cc Wed Jun 6 00:50:22 2012 +++ /branches/bleeding_edge/src/mips/regexp-macro-assembler-mips.cc Mon Jun 11 23:13:14 2012
@@ -781,7 +781,7 @@
         for (int i = 0; i < num_saved_registers_; i += 2) {
           __ lw(a2, register_location(i));
           __ lw(a3, register_location(i + 1));
-          if (global()) {
+          if (i == 0 && global_with_zero_length_check()) {
             // Keep capture start in a4 for the zero-length check later.
             __ mov(t7, a2);
           }
@@ -823,17 +823,21 @@

// Prepare a0 to initialize registers with its value in the next run.
         __ lw(a0, MemOperand(frame_pointer(), kInputStartMinusOne));
-        // Special case for zero-length matches.
-        // t7: capture start index
-        // Not a zero-length match, restart.
-        __ Branch(
- &load_char_start_regexp, ne, current_input_offset(), Operand(t7));
-        // Offset from the end is zero if we already reached the end.
- __ Branch(&exit_label_, eq, current_input_offset(), Operand(zero_reg));
-        // Advance current position after a zero-length match.
-        __ Addu(current_input_offset(),
-                current_input_offset(),
-                Operand((mode_ == UC16) ? 2 : 1));
+
+        if (global_with_zero_length_check()) {
+          // Special case for zero-length matches.
+          // t7: capture start index
+          // Not a zero-length match, restart.
+          __ Branch(
+ &load_char_start_regexp, ne, current_input_offset(), Operand(t7));
+          // Offset from the end is zero if we already reached the end.
+ __ Branch(&exit_label_, eq, current_input_offset(), Operand(zero_reg));
+          // Advance current position after a zero-length match.
+          __ Addu(current_input_offset(),
+                  current_input_offset(),
+                  Operand((mode_ == UC16) ? 2 : 1));
+        }
+
         __ Branch(&load_char_start_regexp);
       } else {
         __ li(v0, Operand(SUCCESS));

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

Reply via email to