| Index: src/x64/regexp-macro-assembler-x64.cc
|
| diff --git a/src/x64/regexp-macro-assembler-x64.cc b/src/x64/regexp-macro-assembler-x64.cc
|
| index 395466e7774a82489c216aec0c64c68fea37d412..6d351d23dd8d60c5727c8b6e33dbb4ff2297195c 100644
|
| --- a/src/x64/regexp-macro-assembler-x64.cc
|
| +++ b/src/x64/regexp-macro-assembler-x64.cc
|
| @@ -1174,8 +1174,21 @@ int RegExpMacroAssemblerX64::CheckStackGuardState(Address* return_address,
|
| Handle<Code> code_handle(re_code);
|
|
|
| Handle<String> subject(frame_entry<String*>(re_frame, kInputString));
|
| + String* subject_ptr = *subject;
|
| + int slice_offset = 0;
|
| +
|
| +
|
| + // Extract the underlying string and the slice offset.
|
| + if (StringShape(subject_ptr).IsCons()) {
|
| + subject_ptr = ConsString::cast(subject_ptr)->first();
|
| + } else if (StringShape(subject_ptr).IsSliced()) {
|
| + SlicedString* slice = SlicedString::cast(subject_ptr);
|
| + subject_ptr = slice->parent();
|
| + slice_offset = slice->offset();
|
| + }
|
| +
|
| // Current string.
|
| - bool is_ascii = subject->IsAsciiRepresentation();
|
| + bool is_ascii = subject_ptr->IsAsciiRepresentation();
|
|
|
| ASSERT(re_code->instruction_start() <= *return_address);
|
| ASSERT(*return_address <=
|
| @@ -1194,7 +1207,7 @@ int RegExpMacroAssemblerX64::CheckStackGuardState(Address* return_address,
|
| }
|
|
|
| // String might have changed.
|
| - if (subject->IsAsciiRepresentation() != is_ascii) {
|
| + if (subject_ptr->IsAsciiRepresentation() != is_ascii) {
|
| // If we changed between an ASCII and an UC16 string, the specialized
|
| // code cannot be used, and we need to restart regexp matching from
|
| // scratch (including, potentially, compiling a new version of the code).
|
| @@ -1205,8 +1218,8 @@ int RegExpMacroAssemblerX64::CheckStackGuardState(Address* return_address,
|
| // be a sequential or external string with the same content.
|
| // Update the start and end pointers in the stack frame to the current
|
| // location (whether it has actually moved or not).
|
| - ASSERT(StringShape(*subject).IsSequential() ||
|
| - StringShape(*subject).IsExternal());
|
| + ASSERT(StringShape(subject_ptr).IsSequential() ||
|
| + StringShape(subject_ptr).IsExternal());
|
|
|
| // The original start address of the characters to match.
|
| const byte* start_address = frame_entry<const byte*>(re_frame, kInputStart);
|
| @@ -1214,7 +1227,8 @@ int RegExpMacroAssemblerX64::CheckStackGuardState(Address* return_address,
|
| // Find the current start address of the same character at the current string
|
| // position.
|
| int start_index = frame_entry<int>(re_frame, kStartIndex);
|
| - const byte* new_address = StringCharacterPosition(*subject, start_index);
|
| + const byte* new_address = StringCharacterPosition(subject_ptr,
|
| + start_index + slice_offset);
|
|
|
| if (start_address != new_address) {
|
| // If there is a difference, update the object pointer and start and end
|
|
|