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 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 return RETRY; | 1190 return RETRY; |
1191 } | 1191 } |
1192 | 1192 |
1193 // Prepare for possible GC. | 1193 // Prepare for possible GC. |
1194 HandleScope handles(isolate); | 1194 HandleScope handles(isolate); |
1195 Handle<Code> code_handle(re_code); | 1195 Handle<Code> code_handle(re_code); |
1196 | 1196 |
1197 Handle<String> subject(frame_entry<String*>(re_frame, kInputString)); | 1197 Handle<String> subject(frame_entry<String*>(re_frame, kInputString)); |
1198 | 1198 |
1199 // Current string. | 1199 // Current string. |
1200 bool is_ascii = subject->IsAsciiRepresentationUnderneath(); | 1200 bool is_ascii = subject->IsOneByteRepresentationUnderneath(); |
1201 | 1201 |
1202 ASSERT(re_code->instruction_start() <= *return_address); | 1202 ASSERT(re_code->instruction_start() <= *return_address); |
1203 ASSERT(*return_address <= | 1203 ASSERT(*return_address <= |
1204 re_code->instruction_start() + re_code->instruction_size()); | 1204 re_code->instruction_start() + re_code->instruction_size()); |
1205 | 1205 |
1206 MaybeObject* result = Execution::HandleStackGuardInterrupt(isolate); | 1206 MaybeObject* result = Execution::HandleStackGuardInterrupt(isolate); |
1207 | 1207 |
1208 if (*code_handle != re_code) { // Return address no longer valid | 1208 if (*code_handle != re_code) { // Return address no longer valid |
1209 int delta = code_handle->address() - re_code->address(); | 1209 int delta = code_handle->address() - re_code->address(); |
1210 // Overwrite the return address on the stack. | 1210 // Overwrite the return address on the stack. |
(...skipping 10 matching lines...) Expand all Loading... |
1221 // Extract the underlying string and the slice offset. | 1221 // Extract the underlying string and the slice offset. |
1222 if (StringShape(*subject_tmp).IsCons()) { | 1222 if (StringShape(*subject_tmp).IsCons()) { |
1223 subject_tmp = Handle<String>(ConsString::cast(*subject_tmp)->first()); | 1223 subject_tmp = Handle<String>(ConsString::cast(*subject_tmp)->first()); |
1224 } else if (StringShape(*subject_tmp).IsSliced()) { | 1224 } else if (StringShape(*subject_tmp).IsSliced()) { |
1225 SlicedString* slice = SlicedString::cast(*subject_tmp); | 1225 SlicedString* slice = SlicedString::cast(*subject_tmp); |
1226 subject_tmp = Handle<String>(slice->parent()); | 1226 subject_tmp = Handle<String>(slice->parent()); |
1227 slice_offset = slice->offset(); | 1227 slice_offset = slice->offset(); |
1228 } | 1228 } |
1229 | 1229 |
1230 // String might have changed. | 1230 // String might have changed. |
1231 if (subject_tmp->IsAsciiRepresentation() != is_ascii) { | 1231 if (subject_tmp->IsOneByteRepresentation() != is_ascii) { |
1232 // If we changed between an ASCII and an UC16 string, the specialized | 1232 // If we changed between an ASCII and an UC16 string, the specialized |
1233 // code cannot be used, and we need to restart regexp matching from | 1233 // code cannot be used, and we need to restart regexp matching from |
1234 // scratch (including, potentially, compiling a new version of the code). | 1234 // scratch (including, potentially, compiling a new version of the code). |
1235 return RETRY; | 1235 return RETRY; |
1236 } | 1236 } |
1237 | 1237 |
1238 // Otherwise, the content of the string might have moved. It must still | 1238 // Otherwise, the content of the string might have moved. It must still |
1239 // be a sequential or external string with the same content. | 1239 // be a sequential or external string with the same content. |
1240 // Update the start and end pointers in the stack frame to the current | 1240 // Update the start and end pointers in the stack frame to the current |
1241 // location (whether it has actually moved or not). | 1241 // location (whether it has actually moved or not). |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1399 } | 1399 } |
1400 | 1400 |
1401 | 1401 |
1402 #undef __ | 1402 #undef __ |
1403 | 1403 |
1404 #endif // V8_INTERPRETED_REGEXP | 1404 #endif // V8_INTERPRETED_REGEXP |
1405 | 1405 |
1406 }} // namespace v8::internal | 1406 }} // namespace v8::internal |
1407 | 1407 |
1408 #endif // V8_TARGET_ARCH_IA32 | 1408 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |