| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 137 |
| 138 const byte* input_start = | 138 const byte* input_start = |
| 139 StringCharacterPosition(subject_ptr, start_offset); | 139 StringCharacterPosition(subject_ptr, start_offset); |
| 140 int byte_length = char_length << char_size_shift; | 140 int byte_length = char_length << char_size_shift; |
| 141 const byte* input_end = input_start + byte_length; | 141 const byte* input_end = input_start + byte_length; |
| 142 Result res = Execute(*regexp_code, | 142 Result res = Execute(*regexp_code, |
| 143 subject_ptr, | 143 subject_ptr, |
| 144 start_offset, | 144 start_offset, |
| 145 input_start, | 145 input_start, |
| 146 input_end, | 146 input_end, |
| 147 offsets_vector, | 147 offsets_vector); |
| 148 previous_index == 0); | |
| 149 return res; | 148 return res; |
| 150 } | 149 } |
| 151 | 150 |
| 152 | 151 |
| 153 NativeRegExpMacroAssembler::Result NativeRegExpMacroAssembler::Execute( | 152 NativeRegExpMacroAssembler::Result NativeRegExpMacroAssembler::Execute( |
| 154 Code* code, | 153 Code* code, |
| 155 String* input, | 154 String* input, |
| 156 int start_offset, | 155 int start_offset, |
| 157 const byte* input_start, | 156 const byte* input_start, |
| 158 const byte* input_end, | 157 const byte* input_end, |
| 159 int* output, | 158 int* output) { |
| 160 bool at_start) { | |
| 161 typedef int (*matcher)(String*, int, const byte*, | 159 typedef int (*matcher)(String*, int, const byte*, |
| 162 const byte*, int*, int, Address, int); | 160 const byte*, int*, Address, int); |
| 163 matcher matcher_func = FUNCTION_CAST<matcher>(code->entry()); | 161 matcher matcher_func = FUNCTION_CAST<matcher>(code->entry()); |
| 164 | 162 |
| 165 int at_start_val = at_start ? 1 : 0; | |
| 166 | |
| 167 // Ensure that the minimum stack has been allocated. | 163 // Ensure that the minimum stack has been allocated. |
| 168 RegExpStack stack; | 164 RegExpStack stack; |
| 169 Address stack_base = RegExpStack::stack_base(); | 165 Address stack_base = RegExpStack::stack_base(); |
| 170 | 166 |
| 171 int direct_call = 0; | 167 int direct_call = 0; |
| 172 int result = CALL_GENERATED_REGEXP_CODE(matcher_func, | 168 int result = CALL_GENERATED_REGEXP_CODE(matcher_func, |
| 173 input, | 169 input, |
| 174 start_offset, | 170 start_offset, |
| 175 input_start, | 171 input_start, |
| 176 input_end, | 172 input_end, |
| 177 output, | 173 output, |
| 178 at_start_val, | |
| 179 stack_base, | 174 stack_base, |
| 180 direct_call); | 175 direct_call); |
| 181 ASSERT(result <= SUCCESS); | 176 ASSERT(result <= SUCCESS); |
| 182 ASSERT(result >= RETRY); | 177 ASSERT(result >= RETRY); |
| 183 | 178 |
| 184 if (result == EXCEPTION && !Top::has_pending_exception()) { | 179 if (result == EXCEPTION && !Top::has_pending_exception()) { |
| 185 // We detected a stack overflow (on the backtrack stack) in RegExp code, | 180 // We detected a stack overflow (on the backtrack stack) in RegExp code, |
| 186 // but haven't created the exception yet. | 181 // but haven't created the exception yet. |
| 187 Top::StackOverflow(); | 182 Top::StackOverflow(); |
| 188 } | 183 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 if (new_stack_base == NULL) { | 253 if (new_stack_base == NULL) { |
| 259 return NULL; | 254 return NULL; |
| 260 } | 255 } |
| 261 *stack_base = new_stack_base; | 256 *stack_base = new_stack_base; |
| 262 intptr_t stack_content_size = old_stack_base - stack_pointer; | 257 intptr_t stack_content_size = old_stack_base - stack_pointer; |
| 263 return new_stack_base - stack_content_size; | 258 return new_stack_base - stack_content_size; |
| 264 } | 259 } |
| 265 | 260 |
| 266 #endif // V8_NATIVE_REGEXP | 261 #endif // V8_NATIVE_REGEXP |
| 267 } } // namespace v8::internal | 262 } } // namespace v8::internal |
| OLD | NEW |