Revision: 9697
Author:   [email protected]
Date:     Wed Oct 19 04:01:02 2011
Log: RegExpMacroAssembler::CheckStackGuardState should update input string pointer when it is moved or changed by GC.

If input string was cons-string it might undergo short-circuiting during GC. This does not change input start if underlying seq-string (first element of cons-string) does not move but this makes input-string pointer on the native regexp's frame invalid.

[email protected]

Review URL: http://codereview.chromium.org/8343001
http://code.google.com/p/v8/source/detail?r=9697

Modified:
 /branches/bleeding_edge/src/arm/regexp-macro-assembler-arm.cc
 /branches/bleeding_edge/src/ia32/regexp-macro-assembler-ia32.cc
 /branches/bleeding_edge/src/x64/regexp-macro-assembler-x64.cc

=======================================
--- /branches/bleeding_edge/src/arm/regexp-macro-assembler-arm.cc Thu Sep 15 04:30:45 2011 +++ /branches/bleeding_edge/src/arm/regexp-macro-assembler-arm.cc Wed Oct 19 04:01:02 2011
@@ -1111,6 +1111,11 @@
     frame_entry<const String*>(re_frame, kInputString) = *subject;
     frame_entry<const byte*>(re_frame, kInputStart) = new_address;
frame_entry<const byte*>(re_frame, kInputEnd) = new_address + byte_length; + } else if (frame_entry<const String*>(re_frame, kInputString) != *subject) {
+    // Subject string might have been a ConsString that underwent
+    // short-circuiting during GC. That will not change start_address but
+    // will change pointer inside the subject handle.
+    frame_entry<const String*>(re_frame, kInputString) = *subject;
   }

   return 0;
=======================================
--- /branches/bleeding_edge/src/ia32/regexp-macro-assembler-ia32.cc Mon Oct 3 04:44:39 2011 +++ /branches/bleeding_edge/src/ia32/regexp-macro-assembler-ia32.cc Wed Oct 19 04:01:02 2011
@@ -1141,6 +1141,11 @@
     frame_entry<const String*>(re_frame, kInputString) = *subject;
     frame_entry<const byte*>(re_frame, kInputStart) = new_address;
frame_entry<const byte*>(re_frame, kInputEnd) = new_address + byte_length; + } else if (frame_entry<const String*>(re_frame, kInputString) != *subject) {
+    // Subject string might have been a ConsString that underwent
+    // short-circuiting during GC. That will not change start_address but
+    // will change pointer inside the subject handle.
+    frame_entry<const String*>(re_frame, kInputString) = *subject;
   }

   return 0;
=======================================
--- /branches/bleeding_edge/src/x64/regexp-macro-assembler-x64.cc Mon Oct 3 03:31:01 2011 +++ /branches/bleeding_edge/src/x64/regexp-macro-assembler-x64.cc Wed Oct 19 04:01:02 2011
@@ -1248,6 +1248,11 @@
     frame_entry<const String*>(re_frame, kInputString) = *subject;
     frame_entry<const byte*>(re_frame, kInputStart) = new_address;
frame_entry<const byte*>(re_frame, kInputEnd) = new_address + byte_length; + } else if (frame_entry<const String*>(re_frame, kInputString) != *subject) {
+    // Subject string might have been a ConsString that underwent
+    // short-circuiting during GC. That will not change start_address but
+    // will change pointer inside the subject handle.
+    frame_entry<const String*>(re_frame, kInputString) = *subject;
   }

   return 0;

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

Reply via email to