OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 return RETRY; | 1298 return RETRY; |
1299 } | 1299 } |
1300 | 1300 |
1301 // Prepare for possible GC. | 1301 // Prepare for possible GC. |
1302 HandleScope handles(isolate); | 1302 HandleScope handles(isolate); |
1303 Handle<Code> code_handle(re_code); | 1303 Handle<Code> code_handle(re_code); |
1304 | 1304 |
1305 Handle<String> subject(frame_entry<String*>(re_frame, kInputString)); | 1305 Handle<String> subject(frame_entry<String*>(re_frame, kInputString)); |
1306 | 1306 |
1307 // Current string. | 1307 // Current string. |
1308 bool is_ascii = subject->IsAsciiRepresentationUnderneath(); | 1308 bool is_ascii = subject->IsOneByteRepresentationUnderneath(); |
1309 | 1309 |
1310 ASSERT(re_code->instruction_start() <= *return_address); | 1310 ASSERT(re_code->instruction_start() <= *return_address); |
1311 ASSERT(*return_address <= | 1311 ASSERT(*return_address <= |
1312 re_code->instruction_start() + re_code->instruction_size()); | 1312 re_code->instruction_start() + re_code->instruction_size()); |
1313 | 1313 |
1314 MaybeObject* result = Execution::HandleStackGuardInterrupt(isolate); | 1314 MaybeObject* result = Execution::HandleStackGuardInterrupt(isolate); |
1315 | 1315 |
1316 if (*code_handle != re_code) { // Return address no longer valid | 1316 if (*code_handle != re_code) { // Return address no longer valid |
1317 intptr_t delta = code_handle->address() - re_code->address(); | 1317 intptr_t delta = code_handle->address() - re_code->address(); |
1318 // Overwrite the return address on the stack. | 1318 // Overwrite the return address on the stack. |
(...skipping 10 matching lines...) Expand all Loading... |
1329 // Extract the underlying string and the slice offset. | 1329 // Extract the underlying string and the slice offset. |
1330 if (StringShape(*subject_tmp).IsCons()) { | 1330 if (StringShape(*subject_tmp).IsCons()) { |
1331 subject_tmp = Handle<String>(ConsString::cast(*subject_tmp)->first()); | 1331 subject_tmp = Handle<String>(ConsString::cast(*subject_tmp)->first()); |
1332 } else if (StringShape(*subject_tmp).IsSliced()) { | 1332 } else if (StringShape(*subject_tmp).IsSliced()) { |
1333 SlicedString* slice = SlicedString::cast(*subject_tmp); | 1333 SlicedString* slice = SlicedString::cast(*subject_tmp); |
1334 subject_tmp = Handle<String>(slice->parent()); | 1334 subject_tmp = Handle<String>(slice->parent()); |
1335 slice_offset = slice->offset(); | 1335 slice_offset = slice->offset(); |
1336 } | 1336 } |
1337 | 1337 |
1338 // String might have changed. | 1338 // String might have changed. |
1339 if (subject_tmp->IsAsciiRepresentation() != is_ascii) { | 1339 if (subject_tmp->IsOneByteRepresentation() != is_ascii) { |
1340 // If we changed between an ASCII and an UC16 string, the specialized | 1340 // If we changed between an ASCII and an UC16 string, the specialized |
1341 // code cannot be used, and we need to restart regexp matching from | 1341 // code cannot be used, and we need to restart regexp matching from |
1342 // scratch (including, potentially, compiling a new version of the code). | 1342 // scratch (including, potentially, compiling a new version of the code). |
1343 return RETRY; | 1343 return RETRY; |
1344 } | 1344 } |
1345 | 1345 |
1346 // Otherwise, the content of the string might have moved. It must still | 1346 // Otherwise, the content of the string might have moved. It must still |
1347 // be a sequential or external string with the same content. | 1347 // be a sequential or external string with the same content. |
1348 // Update the start and end pointers in the stack frame to the current | 1348 // Update the start and end pointers in the stack frame to the current |
1349 // location (whether it has actually moved or not). | 1349 // location (whether it has actually moved or not). |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 } | 1535 } |
1536 } | 1536 } |
1537 | 1537 |
1538 #undef __ | 1538 #undef __ |
1539 | 1539 |
1540 #endif // V8_INTERPRETED_REGEXP | 1540 #endif // V8_INTERPRETED_REGEXP |
1541 | 1541 |
1542 }} // namespace v8::internal | 1542 }} // namespace v8::internal |
1543 | 1543 |
1544 #endif // V8_TARGET_ARCH_X64 | 1544 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |