OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 NativeRegExpMacroAssembler::Result NativeRegExpMacroAssembler::Execute( | 157 NativeRegExpMacroAssembler::Result NativeRegExpMacroAssembler::Execute( |
158 Code* code, | 158 Code* code, |
159 String* input, // This needs to be the unpacked (sliced, cons) string. | 159 String* input, // This needs to be the unpacked (sliced, cons) string. |
160 int start_offset, | 160 int start_offset, |
161 const byte* input_start, | 161 const byte* input_start, |
162 const byte* input_end, | 162 const byte* input_end, |
163 int* output, | 163 int* output, |
164 int output_size, | 164 int output_size, |
165 Isolate* isolate) { | 165 Isolate* isolate) { |
166 ASSERT(isolate == Isolate::Current()); | |
167 // Ensure that the minimum stack has been allocated. | 166 // Ensure that the minimum stack has been allocated. |
168 RegExpStackScope stack_scope(isolate); | 167 RegExpStackScope stack_scope(isolate); |
169 Address stack_base = stack_scope.stack()->stack_base(); | 168 Address stack_base = stack_scope.stack()->stack_base(); |
170 | 169 |
171 int direct_call = 0; | 170 int direct_call = 0; |
172 int result = CALL_GENERATED_REGEXP_CODE(code->entry(), | 171 int result = CALL_GENERATED_REGEXP_CODE(code->entry(), |
173 input, | 172 input, |
174 start_offset, | 173 start_offset, |
175 input_start, | 174 input_start, |
176 input_end, | 175 input_end, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, | 230 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, |
232 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, | 231 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, |
233 }; | 232 }; |
234 | 233 |
235 | 234 |
236 int NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16( | 235 int NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16( |
237 Address byte_offset1, | 236 Address byte_offset1, |
238 Address byte_offset2, | 237 Address byte_offset2, |
239 size_t byte_length, | 238 size_t byte_length, |
240 Isolate* isolate) { | 239 Isolate* isolate) { |
241 ASSERT(isolate == Isolate::Current()); | |
242 unibrow::Mapping<unibrow::Ecma262Canonicalize>* canonicalize = | 240 unibrow::Mapping<unibrow::Ecma262Canonicalize>* canonicalize = |
243 isolate->regexp_macro_assembler_canonicalize(); | 241 isolate->regexp_macro_assembler_canonicalize(); |
244 // This function is not allowed to cause a garbage collection. | 242 // This function is not allowed to cause a garbage collection. |
245 // A GC might move the calling generated code and invalidate the | 243 // A GC might move the calling generated code and invalidate the |
246 // return address on the stack. | 244 // return address on the stack. |
247 ASSERT(byte_length % 2 == 0); | 245 ASSERT(byte_length % 2 == 0); |
248 uc16* substring1 = reinterpret_cast<uc16*>(byte_offset1); | 246 uc16* substring1 = reinterpret_cast<uc16*>(byte_offset1); |
249 uc16* substring2 = reinterpret_cast<uc16*>(byte_offset2); | 247 uc16* substring2 = reinterpret_cast<uc16*>(byte_offset2); |
250 size_t length = byte_length >> 1; | 248 size_t length = byte_length >> 1; |
251 | 249 |
(...skipping 12 matching lines...) Expand all Loading... |
264 } | 262 } |
265 } | 263 } |
266 } | 264 } |
267 return 1; | 265 return 1; |
268 } | 266 } |
269 | 267 |
270 | 268 |
271 Address NativeRegExpMacroAssembler::GrowStack(Address stack_pointer, | 269 Address NativeRegExpMacroAssembler::GrowStack(Address stack_pointer, |
272 Address* stack_base, | 270 Address* stack_base, |
273 Isolate* isolate) { | 271 Isolate* isolate) { |
274 ASSERT(isolate == Isolate::Current()); | |
275 RegExpStack* regexp_stack = isolate->regexp_stack(); | 272 RegExpStack* regexp_stack = isolate->regexp_stack(); |
276 size_t size = regexp_stack->stack_capacity(); | 273 size_t size = regexp_stack->stack_capacity(); |
277 Address old_stack_base = regexp_stack->stack_base(); | 274 Address old_stack_base = regexp_stack->stack_base(); |
278 ASSERT(old_stack_base == *stack_base); | 275 ASSERT(old_stack_base == *stack_base); |
279 ASSERT(stack_pointer <= old_stack_base); | 276 ASSERT(stack_pointer <= old_stack_base); |
280 ASSERT(static_cast<size_t>(old_stack_base - stack_pointer) <= size); | 277 ASSERT(static_cast<size_t>(old_stack_base - stack_pointer) <= size); |
281 Address new_stack_base = regexp_stack->EnsureCapacity(size * 2); | 278 Address new_stack_base = regexp_stack->EnsureCapacity(size * 2); |
282 if (new_stack_base == NULL) { | 279 if (new_stack_base == NULL) { |
283 return NULL; | 280 return NULL; |
284 } | 281 } |
285 *stack_base = new_stack_base; | 282 *stack_base = new_stack_base; |
286 intptr_t stack_content_size = old_stack_base - stack_pointer; | 283 intptr_t stack_content_size = old_stack_base - stack_pointer; |
287 return new_stack_base - stack_content_size; | 284 return new_stack_base - stack_content_size; |
288 } | 285 } |
289 | 286 |
290 #endif // V8_INTERPRETED_REGEXP | 287 #endif // V8_INTERPRETED_REGEXP |
291 | 288 |
292 } } // namespace v8::internal | 289 } } // namespace v8::internal |
OLD | NEW |