| OLD | NEW |
| 1 // Copyright 2008-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2008-2009 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 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 | 965 |
| 966 // No allocations before calling the regexp, but we can't use | 966 // No allocations before calling the regexp, but we can't use |
| 967 // AssertNoAllocation, since regexps might be preempted, and another thread | 967 // AssertNoAllocation, since regexps might be preempted, and another thread |
| 968 // might do allocation anyway. | 968 // might do allocation anyway. |
| 969 | 969 |
| 970 String* subject_ptr = *subject; | 970 String* subject_ptr = *subject; |
| 971 // Character offsets into string. | 971 // Character offsets into string. |
| 972 int start_offset = previous_index; | 972 int start_offset = previous_index; |
| 973 int end_offset = subject_ptr->length(); | 973 int end_offset = subject_ptr->length(); |
| 974 | 974 |
| 975 bool is_ascii = StringShape(*subject).IsAsciiRepresentation(); |
| 976 |
| 975 if (StringShape(subject_ptr).IsCons()) { | 977 if (StringShape(subject_ptr).IsCons()) { |
| 976 subject_ptr = ConsString::cast(subject_ptr)->first(); | 978 subject_ptr = ConsString::cast(subject_ptr)->first(); |
| 977 } else if (StringShape(subject_ptr).IsSliced()) { | 979 } else if (StringShape(subject_ptr).IsSliced()) { |
| 978 SlicedString* slice = SlicedString::cast(subject_ptr); | 980 SlicedString* slice = SlicedString::cast(subject_ptr); |
| 979 start_offset += slice->start(); | 981 start_offset += slice->start(); |
| 980 end_offset += slice->start(); | 982 end_offset += slice->start(); |
| 981 subject_ptr = slice->buffer(); | 983 subject_ptr = slice->buffer(); |
| 982 } | 984 } |
| 983 | 985 // Ensure that an underlying string has the same ascii-ness. |
| 986 ASSERT(StringShape(subject_ptr).IsAsciiRepresentation() == is_ascii); |
| 987 ASSERT(subject_ptr->IsExternalString() || subject_ptr->IsSeqString()); |
| 984 // String is now either Sequential or External | 988 // String is now either Sequential or External |
| 985 bool is_ascii = StringShape(*subject).IsAsciiRepresentation(); | |
| 986 int char_size_shift = is_ascii ? 0 : 1; | 989 int char_size_shift = is_ascii ? 0 : 1; |
| 987 int char_length = end_offset - start_offset; | 990 int char_length = end_offset - start_offset; |
| 988 | 991 |
| 989 const byte* input_start = | 992 const byte* input_start = |
| 990 StringCharacterPosition(subject_ptr, start_offset); | 993 StringCharacterPosition(subject_ptr, start_offset); |
| 991 int byte_length = char_length << char_size_shift; | 994 int byte_length = char_length << char_size_shift; |
| 992 const byte* input_end = input_start + byte_length; | 995 const byte* input_end = input_start + byte_length; |
| 993 RegExpMacroAssemblerIA32::Result res = Execute(*regexp_code, | 996 RegExpMacroAssemblerIA32::Result res = Execute(*regexp_code, |
| 994 subject_ptr, | 997 subject_ptr, |
| 995 start_offset, | 998 start_offset, |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1376 | 1379 |
| 1377 | 1380 |
| 1378 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg, | 1381 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg, |
| 1379 ArraySlice* buffer) { | 1382 ArraySlice* buffer) { |
| 1380 __ mov(reg, buffer->array()); | 1383 __ mov(reg, buffer->array()); |
| 1381 __ add(Operand(reg), Immediate(buffer->base_offset())); | 1384 __ add(Operand(reg), Immediate(buffer->base_offset())); |
| 1382 } | 1385 } |
| 1383 | 1386 |
| 1384 #undef __ | 1387 #undef __ |
| 1385 }} // namespace v8::internal | 1388 }} // namespace v8::internal |
| OLD | NEW |