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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // The string has been flattened, so if it is a cons string it contains the | 126 // The string has been flattened, so if it is a cons string it contains the |
127 // full string in the first part. | 127 // full string in the first part. |
128 if (StringShape(subject_ptr).IsCons()) { | 128 if (StringShape(subject_ptr).IsCons()) { |
129 ASSERT_EQ(0, ConsString::cast(subject_ptr)->second()->length()); | 129 ASSERT_EQ(0, ConsString::cast(subject_ptr)->second()->length()); |
130 subject_ptr = ConsString::cast(subject_ptr)->first(); | 130 subject_ptr = ConsString::cast(subject_ptr)->first(); |
131 } else if (StringShape(subject_ptr).IsSliced()) { | 131 } else if (StringShape(subject_ptr).IsSliced()) { |
132 SlicedString* slice = SlicedString::cast(subject_ptr); | 132 SlicedString* slice = SlicedString::cast(subject_ptr); |
133 subject_ptr = slice->parent(); | 133 subject_ptr = slice->parent(); |
134 slice_offset = slice->offset(); | 134 slice_offset = slice->offset(); |
135 } | 135 } |
136 // Ensure that an underlying string has the same ascii-ness. | 136 // Ensure that an underlying string has the same ASCII-ness. |
137 bool is_ascii = subject_ptr->IsAsciiRepresentation(); | 137 bool is_ascii = subject_ptr->IsAsciiRepresentation(); |
138 ASSERT(subject_ptr->IsExternalString() || subject_ptr->IsSeqString()); | 138 ASSERT(subject_ptr->IsExternalString() || subject_ptr->IsSeqString()); |
139 // String is now either Sequential or External | 139 // String is now either Sequential or External |
140 int char_size_shift = is_ascii ? 0 : 1; | 140 int char_size_shift = is_ascii ? 0 : 1; |
141 | 141 |
142 const byte* input_start = | 142 const byte* input_start = |
143 StringCharacterPosition(subject_ptr, start_offset + slice_offset); | 143 StringCharacterPosition(subject_ptr, start_offset + slice_offset); |
144 int byte_length = char_length << char_size_shift; | 144 int byte_length = char_length << char_size_shift; |
145 const byte* input_end = input_start + byte_length; | 145 const byte* input_end = input_start + byte_length; |
146 Result res = Execute(*regexp_code, | 146 Result res = Execute(*regexp_code, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 return NULL; | 262 return NULL; |
263 } | 263 } |
264 *stack_base = new_stack_base; | 264 *stack_base = new_stack_base; |
265 intptr_t stack_content_size = old_stack_base - stack_pointer; | 265 intptr_t stack_content_size = old_stack_base - stack_pointer; |
266 return new_stack_base - stack_content_size; | 266 return new_stack_base - stack_content_size; |
267 } | 267 } |
268 | 268 |
269 #endif // V8_INTERPRETED_REGEXP | 269 #endif // V8_INTERPRETED_REGEXP |
270 | 270 |
271 } } // namespace v8::internal | 271 } } // namespace v8::internal |
OLD | NEW |