Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: src/jsregexp.cc

Issue 13620: * Addressed review comments (Closed)
Patch Set: Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/regexp-macro-assembler-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/jsregexp.cc
diff --git a/src/jsregexp.cc b/src/jsregexp.cc
index 3d1930ea9ea2d6b59550099b5dda935deeb2ea22..13c717220deac22f0b8453b5546768859c1ae6e8 100644
--- a/src/jsregexp.cc
+++ b/src/jsregexp.cc
@@ -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);
}
« no previous file with comments | « no previous file | src/regexp-macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698