Minor presentation changes
authorlrn@chromium.org <lrn@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 8 Dec 2008 13:33:24 +0000 (13:33 +0000)
committerlrn@chromium.org <lrn@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 8 Dec 2008 13:33:24 +0000 (13:33 +0000)
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@938 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/jsregexp.cc
src/regexp-macro-assembler-ia32.cc

index 3d1930ea9ea2d6b59550099b5dda935deeb2ea22..13c717220deac22f0b8453b5546768859c1ae6e8 100644 (file)
@@ -312,8 +312,7 @@ Handle<Object> RegExpImpl::Exec(Handle<JSRegExp> regexp,
         return result;
       }
       // We couldn't handle the regexp using Irregexp, so fall back
-      // on JSCRE. We rejoice at the though of the day when this is
-      // no longer needed.
+      // on JSCRE.
       // Reset the JSRegExp to use JSCRE.
       JscrePrepare(regexp,
                    Handle<String>(regexp->Pattern()),
@@ -343,8 +342,7 @@ Handle<Object> RegExpImpl::ExecGlobal(Handle<JSRegExp> regexp,
         return result;
       }
       // We couldn't handle the regexp using Irregexp, so fall back
-      // on JSCRE. We rejoice at the though of the day when this is
-      // no longer needed.
+      // on JSCRE.
       // Reset the JSRegExp to use JSCRE.
       JscrePrepare(regexp,
                    Handle<String>(regexp->Pattern()),
@@ -911,7 +909,7 @@ Handle<Object> RegExpImpl::IrregexpExecOnce(Handle<FixedArray> irregexp,
       // String is now either Sequential or External
       StringShape flatshape(*subject);
       bool is_ascii = flatshape.IsAsciiRepresentation();
-      int char_size = is_ascii ? sizeof(char) : sizeof(uc16);  // NOLINT
+      int char_size_shift = is_ascii ? 0 : 1;
 
       if (flatshape.IsExternal()) {
         const byte* address;
@@ -925,19 +923,20 @@ Handle<Object> RegExpImpl::IrregexpExecOnce(Handle<FixedArray> irregexp,
         rc = RegExpMacroAssemblerIA32::Execute(
             *code,
             &address,
-            start_offset * char_size,
-            end_offset * char_size,
+            start_offset << char_size_shift,
+            end_offset << char_size_shift,
             offsets_vector,
             previous_index == 0);
       } else {  // Sequential string
-        int byte_offset =
-            is_ascii ? SeqAsciiString::kHeaderSize - kHeapObjectTag:
-                       SeqTwoByteString::kHeaderSize - kHeapObjectTag;
+        Address char_address =
+            is_ascii ? SeqAsciiString::cast(*subject)->GetCharsAddress()
+                     : SeqTwoByteString::cast(*subject)->GetCharsAddress();
+        int byte_offset = char_address - reinterpret_cast<Address>(*subject);
         rc = RegExpMacroAssemblerIA32::Execute(
             *code,
             subject.location(),
-            byte_offset + start_offset * char_size,
-            byte_offset + end_offset * char_size,
+            byte_offset + (start_offset << char_size_shift),
+            byte_offset + (end_offset << char_size_shift),
             offsets_vector,
             previous_index == 0);
       }
index 21993b7e7627c5e8cde3c3c68c4e9c1eb41ae0aa..be2990ea961f53f8ea948565167e948f18d12431 100644 (file)
@@ -684,8 +684,9 @@ int RegExpMacroAssemblerIA32::CaseInsensitiveCompareUC16(uc16** buffer,
                                                          int byte_offset1,
                                                          int byte_offset2,
                                                          size_t byte_length) {
-  // This function MUST NOT cause a garbage collection. A GC might move
-  // the calling generated code and invalidate the stacked return address.
+  // This function is not allowed to cause a garbage collection.
+  // A GC might move the calling generated code and invalidate the
+  // return address on the stack.
   ASSERT(byte_length % 2 == 0);
   Address buffer_address = reinterpret_cast<Address>(*buffer);
   uc16* substring1 = reinterpret_cast<uc16*>(buffer_address + byte_offset1);