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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 189 |
190 if (result == EXCEPTION && !Top::has_pending_exception()) { | 190 if (result == EXCEPTION && !Top::has_pending_exception()) { |
191 // We detected a stack overflow (on the backtrack stack) in RegExp code, | 191 // We detected a stack overflow (on the backtrack stack) in RegExp code, |
192 // but haven't created the exception yet. | 192 // but haven't created the exception yet. |
193 Top::StackOverflow(); | 193 Top::StackOverflow(); |
194 } | 194 } |
195 return static_cast<Result>(result); | 195 return static_cast<Result>(result); |
196 } | 196 } |
197 | 197 |
198 | 198 |
199 static unibrow::Mapping<unibrow::Ecma262Canonicalize> canonicalize; | |
200 | 199 |
201 int NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16( | 200 int NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16( |
202 Address byte_offset1, | 201 Address byte_offset1, |
203 Address byte_offset2, | 202 Address byte_offset2, |
204 size_t byte_length) { | 203 size_t byte_length) { |
205 // This function is not allowed to cause a garbage collection. | 204 // This function is not allowed to cause a garbage collection. |
206 // A GC might move the calling generated code and invalidate the | 205 // A GC might move the calling generated code and invalidate the |
207 // return address on the stack. | 206 // return address on the stack. |
208 ASSERT(byte_length % 2 == 0); | 207 ASSERT(byte_length % 2 == 0); |
209 uc16* substring1 = reinterpret_cast<uc16*>(byte_offset1); | 208 uc16* substring1 = reinterpret_cast<uc16*>(byte_offset1); |
210 uc16* substring2 = reinterpret_cast<uc16*>(byte_offset2); | 209 uc16* substring2 = reinterpret_cast<uc16*>(byte_offset2); |
211 size_t length = byte_length >> 1; | 210 size_t length = byte_length >> 1; |
| 211 unibrow::Mapping<unibrow::Ecma262Canonicalize>& canonicalize = |
| 212 v8_context()->reg_exp_stack_data_.canonicalize_; |
212 | 213 |
213 for (size_t i = 0; i < length; i++) { | 214 for (size_t i = 0; i < length; i++) { |
214 unibrow::uchar c1 = substring1[i]; | 215 unibrow::uchar c1 = substring1[i]; |
215 unibrow::uchar c2 = substring2[i]; | 216 unibrow::uchar c2 = substring2[i]; |
216 if (c1 != c2) { | 217 if (c1 != c2) { |
217 unibrow::uchar s1[1] = { c1 }; | 218 unibrow::uchar s1[1] = { c1 }; |
218 canonicalize.get(c1, '\0', s1); | 219 canonicalize.get(c1, '\0', s1); |
219 if (s1[0] != c2) { | 220 if (s1[0] != c2) { |
220 unibrow::uchar s2[1] = { c2 }; | 221 unibrow::uchar s2[1] = { c2 }; |
221 canonicalize.get(c2, '\0', s2); | 222 canonicalize.get(c2, '\0', s2); |
(...skipping 18 matching lines...) Expand all Loading... |
240 if (new_stack_base == NULL) { | 241 if (new_stack_base == NULL) { |
241 return NULL; | 242 return NULL; |
242 } | 243 } |
243 *stack_base = new_stack_base; | 244 *stack_base = new_stack_base; |
244 intptr_t stack_content_size = old_stack_base - stack_pointer; | 245 intptr_t stack_content_size = old_stack_base - stack_pointer; |
245 return new_stack_base - stack_content_size; | 246 return new_stack_base - stack_content_size; |
246 } | 247 } |
247 | 248 |
248 #endif // V8_NATIVE_REGEXP | 249 #endif // V8_NATIVE_REGEXP |
249 } } // namespace v8::internal | 250 } } // namespace v8::internal |
OLD | NEW |