Commit a962247b authored by jkummerow's avatar jkummerow Committed by Commit bot

[regexp] Fix StringCharacterPosition for ThinStrings

BUG=chromium:683515

Review-Url: https://codereview.chromium.org/2654433003
Cr-Commit-Position: refs/heads/master@{#42605}
parent 55821003
...@@ -133,7 +133,8 @@ const byte* NativeRegExpMacroAssembler::StringCharacterPosition( ...@@ -133,7 +133,8 @@ const byte* NativeRegExpMacroAssembler::StringCharacterPosition(
} else if (subject->IsSlicedString()) { } else if (subject->IsSlicedString()) {
start_index += SlicedString::cast(subject)->offset(); start_index += SlicedString::cast(subject)->offset();
subject = SlicedString::cast(subject)->parent(); subject = SlicedString::cast(subject)->parent();
} else if (subject->IsThinString()) { }
if (subject->IsThinString()) {
subject = ThinString::cast(subject)->actual(); subject = ThinString::cast(subject)->actual();
} }
DCHECK(start_index >= 0); DCHECK(start_index >= 0);
...@@ -148,6 +149,7 @@ const byte* NativeRegExpMacroAssembler::StringCharacterPosition( ...@@ -148,6 +149,7 @@ const byte* NativeRegExpMacroAssembler::StringCharacterPosition(
return reinterpret_cast<const byte*>( return reinterpret_cast<const byte*>(
ExternalOneByteString::cast(subject)->GetChars() + start_index); ExternalOneByteString::cast(subject)->GetChars() + start_index);
} else { } else {
DCHECK(subject->IsExternalTwoByteString());
return reinterpret_cast<const byte*>( return reinterpret_cast<const byte*>(
ExternalTwoByteString::cast(subject)->GetChars() + start_index); ExternalTwoByteString::cast(subject)->GetChars() + start_index);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment