| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 __ jmp(&success); | 340 __ jmp(&success); |
| 341 | 341 |
| 342 __ bind(&fail); | 342 __ bind(&fail); |
| 343 BranchOrBacktrack(al, on_no_match); | 343 BranchOrBacktrack(al, on_no_match); |
| 344 | 344 |
| 345 __ bind(&success); | 345 __ bind(&success); |
| 346 // Compute new value of character position after the matched part. | 346 // Compute new value of character position after the matched part. |
| 347 __ sub(current_input_offset(), r2, end_of_input_address()); | 347 __ sub(current_input_offset(), r2, end_of_input_address()); |
| 348 } else { | 348 } else { |
| 349 ASSERT(mode_ == UC16); | 349 ASSERT(mode_ == UC16); |
| 350 int argument_count = 3; | 350 int argument_count = 4; |
| 351 __ PrepareCallCFunction(argument_count, r2); | 351 __ PrepareCallCFunction(argument_count, r2); |
| 352 | 352 |
| 353 // r0 - offset of start of capture | 353 // r0 - offset of start of capture |
| 354 // r1 - length of capture | 354 // r1 - length of capture |
| 355 | 355 |
| 356 // Put arguments into arguments registers. | 356 // Put arguments into arguments registers. |
| 357 // Parameters are | 357 // Parameters are |
| 358 // r0: Address byte_offset1 - Address captured substring's start. | 358 // r0: Address byte_offset1 - Address captured substring's start. |
| 359 // r1: Address byte_offset2 - Address of current character position. | 359 // r1: Address byte_offset2 - Address of current character position. |
| 360 // r2: size_t byte_length - length of capture in bytes(!) | 360 // r2: size_t byte_length - length of capture in bytes(!) |
| 361 // r3: Isolate* isolate |
| 361 | 362 |
| 362 // Address of start of capture. | 363 // Address of start of capture. |
| 363 __ add(r0, r0, Operand(end_of_input_address())); | 364 __ add(r0, r0, Operand(end_of_input_address())); |
| 364 // Length of capture. | 365 // Length of capture. |
| 365 __ mov(r2, Operand(r1)); | 366 __ mov(r2, Operand(r1)); |
| 366 // Save length in callee-save register for use on return. | 367 // Save length in callee-save register for use on return. |
| 367 __ mov(r4, Operand(r1)); | 368 __ mov(r4, Operand(r1)); |
| 368 // Address of current input position. | 369 // Address of current input position. |
| 369 __ add(r1, current_input_offset(), Operand(end_of_input_address())); | 370 __ add(r1, current_input_offset(), Operand(end_of_input_address())); |
| 371 // Isolate. |
| 372 __ mov(r3, Operand(ExternalReference::isolate_address())); |
| 370 | 373 |
| 371 ExternalReference function = | 374 ExternalReference function = |
| 372 ExternalReference::re_case_insensitive_compare_uc16(masm_->isolate()); | 375 ExternalReference::re_case_insensitive_compare_uc16(masm_->isolate()); |
| 373 __ CallCFunction(function, argument_count); | 376 __ CallCFunction(function, argument_count); |
| 374 | 377 |
| 375 // Check if function returned non-zero for success or zero for failure. | 378 // Check if function returned non-zero for success or zero for failure. |
| 376 __ cmp(r0, Operand(0, RelocInfo::NONE)); | 379 __ cmp(r0, Operand(0, RelocInfo::NONE)); |
| 377 BranchOrBacktrack(eq, on_no_match); | 380 BranchOrBacktrack(eq, on_no_match); |
| 378 // On success, increment position by length of capture. | 381 // On success, increment position by length of capture. |
| 379 __ add(current_input_offset(), current_input_offset(), Operand(r4)); | 382 __ add(current_input_offset(), current_input_offset(), Operand(r4)); |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 SafeReturn(); | 774 SafeReturn(); |
| 772 } | 775 } |
| 773 | 776 |
| 774 // Backtrack stack overflow code. | 777 // Backtrack stack overflow code. |
| 775 if (stack_overflow_label_.is_linked()) { | 778 if (stack_overflow_label_.is_linked()) { |
| 776 SafeCallTarget(&stack_overflow_label_); | 779 SafeCallTarget(&stack_overflow_label_); |
| 777 // Reached if the backtrack-stack limit has been hit. | 780 // Reached if the backtrack-stack limit has been hit. |
| 778 Label grow_failed; | 781 Label grow_failed; |
| 779 | 782 |
| 780 // Call GrowStack(backtrack_stackpointer(), &stack_base) | 783 // Call GrowStack(backtrack_stackpointer(), &stack_base) |
| 781 static const int num_arguments = 2; | 784 static const int num_arguments = 3; |
| 782 __ PrepareCallCFunction(num_arguments, r0); | 785 __ PrepareCallCFunction(num_arguments, r0); |
| 783 __ mov(r0, backtrack_stackpointer()); | 786 __ mov(r0, backtrack_stackpointer()); |
| 784 __ add(r1, frame_pointer(), Operand(kStackHighEnd)); | 787 __ add(r1, frame_pointer(), Operand(kStackHighEnd)); |
| 788 __ mov(r2, Operand(ExternalReference::isolate_address())); |
| 785 ExternalReference grow_stack = | 789 ExternalReference grow_stack = |
| 786 ExternalReference::re_grow_stack(masm_->isolate()); | 790 ExternalReference::re_grow_stack(masm_->isolate()); |
| 787 __ CallCFunction(grow_stack, num_arguments); | 791 __ CallCFunction(grow_stack, num_arguments); |
| 788 // If return NULL, we have failed to grow the stack, and | 792 // If return NULL, we have failed to grow the stack, and |
| 789 // must exit with a stack-overflow exception. | 793 // must exit with a stack-overflow exception. |
| 790 __ cmp(r0, Operand(0, RelocInfo::NONE)); | 794 __ cmp(r0, Operand(0, RelocInfo::NONE)); |
| 791 __ b(eq, &exit_with_exception); | 795 __ b(eq, &exit_with_exception); |
| 792 // Otherwise use return value as new stack pointer. | 796 // Otherwise use return value as new stack pointer. |
| 793 __ mov(backtrack_stackpointer(), r0); | 797 __ mov(backtrack_stackpointer(), r0); |
| 794 // Restore saved registers and continue. | 798 // Restore saved registers and continue. |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1274 __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex)); | 1278 __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex)); |
| 1275 } | 1279 } |
| 1276 | 1280 |
| 1277 #undef __ | 1281 #undef __ |
| 1278 | 1282 |
| 1279 #endif // V8_INTERPRETED_REGEXP | 1283 #endif // V8_INTERPRETED_REGEXP |
| 1280 | 1284 |
| 1281 }} // namespace v8::internal | 1285 }} // namespace v8::internal |
| 1282 | 1286 |
| 1283 #endif // V8_TARGET_ARCH_ARM | 1287 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |