OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 String* subject_ptr = *subject; | 118 String* subject_ptr = *subject; |
119 // Character offsets into string. | 119 // Character offsets into string. |
120 int start_offset = previous_index; | 120 int start_offset = previous_index; |
121 int end_offset = subject_ptr->length(); | 121 int end_offset = subject_ptr->length(); |
122 | 122 |
123 bool is_ascii = subject->IsAsciiRepresentation(); | 123 bool is_ascii = subject->IsAsciiRepresentation(); |
124 | 124 |
125 if (StringShape(subject_ptr).IsCons()) { | 125 if (StringShape(subject_ptr).IsCons()) { |
126 subject_ptr = ConsString::cast(subject_ptr)->first(); | 126 subject_ptr = ConsString::cast(subject_ptr)->first(); |
127 } else if (StringShape(subject_ptr).IsSliced()) { | |
128 SlicedString* slice = SlicedString::cast(subject_ptr); | |
129 start_offset += slice->start(); | |
130 end_offset += slice->start(); | |
131 subject_ptr = slice->buffer(); | |
132 } | 127 } |
133 // Ensure that an underlying string has the same ascii-ness. | 128 // Ensure that an underlying string has the same ascii-ness. |
134 ASSERT(subject_ptr->IsAsciiRepresentation() == is_ascii); | 129 ASSERT(subject_ptr->IsAsciiRepresentation() == is_ascii); |
135 ASSERT(subject_ptr->IsExternalString() || subject_ptr->IsSeqString()); | 130 ASSERT(subject_ptr->IsExternalString() || subject_ptr->IsSeqString()); |
136 // String is now either Sequential or External | 131 // String is now either Sequential or External |
137 int char_size_shift = is_ascii ? 0 : 1; | 132 int char_size_shift = is_ascii ? 0 : 1; |
138 int char_length = end_offset - start_offset; | 133 int char_length = end_offset - start_offset; |
139 | 134 |
140 const byte* input_start = | 135 const byte* input_start = |
141 StringCharacterPosition(subject_ptr, start_offset); | 136 StringCharacterPosition(subject_ptr, start_offset); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 if (new_stack_base == NULL) { | 240 if (new_stack_base == NULL) { |
246 return NULL; | 241 return NULL; |
247 } | 242 } |
248 *stack_base = new_stack_base; | 243 *stack_base = new_stack_base; |
249 intptr_t stack_content_size = old_stack_base - stack_pointer; | 244 intptr_t stack_content_size = old_stack_base - stack_pointer; |
250 return new_stack_base - stack_content_size; | 245 return new_stack_base - stack_content_size; |
251 } | 246 } |
252 | 247 |
253 #endif // V8_NATIVE_REGEXP | 248 #endif // V8_NATIVE_REGEXP |
254 } } // namespace v8::internal | 249 } } // namespace v8::internal |
OLD | NEW |