| Index: src/regexp/regexp-macro-assembler.cc
|
| diff --git a/src/regexp/regexp-macro-assembler.cc b/src/regexp/regexp-macro-assembler.cc
|
| index 681acc13255fb42ffa735471b126ab2fb8d34c1a..63de1726fe5573d5fa1b29f2d3a505bfbb432952 100644
|
| --- a/src/regexp/regexp-macro-assembler.cc
|
| +++ b/src/regexp/regexp-macro-assembler.cc
|
| @@ -165,9 +165,12 @@ int NativeRegExpMacroAssembler::CheckStackGuardState(
|
| int return_value = 0;
|
| // Prepare for possible GC.
|
| HandleScope handles(isolate);
|
| + intptr_t return_address_offset =
|
| + *return_address - re_code->instruction_start();
|
| Handle<Code> code_handle(re_code);
|
| Handle<String> subject_handle(*subject);
|
| bool is_one_byte = subject_handle->IsOneByteRepresentationUnderneath();
|
| + intptr_t byte_length = *input_end - *input_start;
|
|
|
| StackLimitCheck check(isolate);
|
| bool js_has_overflowed = check.JsHasOverflowed();
|
| @@ -189,11 +192,8 @@ int NativeRegExpMacroAssembler::CheckStackGuardState(
|
|
|
| DisallowHeapAllocation no_gc;
|
|
|
| - if (*code_handle != re_code) { // Return address no longer valid
|
| - intptr_t delta = code_handle->address() - re_code->address();
|
| - // Overwrite the return address on the stack.
|
| - *return_address += delta;
|
| - }
|
| + // Fix up the return address (it might be no longer valid after GC).
|
| + *return_address = code_handle->instruction_start() + return_address_offset;
|
|
|
| // If we continue, we need to update the subject string addresses.
|
| if (return_value == 0) {
|
| @@ -205,7 +205,6 @@ int NativeRegExpMacroAssembler::CheckStackGuardState(
|
| return_value = RETRY;
|
| } else {
|
| *subject = *subject_handle;
|
| - intptr_t byte_length = *input_end - *input_start;
|
| *input_start = StringCharacterPosition(*subject, start_index);
|
| *input_end = *input_start + byte_length;
|
| }
|
|
|