| 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 | 373 |
| 374 // Address of start of capture. | 374 // Address of start of capture. |
| 375 __ add(r0, r0, Operand(end_of_input_address())); | 375 __ add(r0, r0, Operand(end_of_input_address())); |
| 376 // Length of capture. | 376 // Length of capture. |
| 377 __ mov(r2, Operand(r1)); | 377 __ mov(r2, Operand(r1)); |
| 378 // Save length in callee-save register for use on return. | 378 // Save length in callee-save register for use on return. |
| 379 __ mov(r4, Operand(r1)); | 379 __ mov(r4, Operand(r1)); |
| 380 // Address of current input position. | 380 // Address of current input position. |
| 381 __ add(r1, current_input_offset(), Operand(end_of_input_address())); | 381 __ add(r1, current_input_offset(), Operand(end_of_input_address())); |
| 382 // Isolate. | 382 // Isolate. |
| 383 __ mov(r3, Operand(ExternalReference::isolate_address())); | 383 __ mov(r3, Operand(ExternalReference::isolate_address(isolate()))); |
| 384 | 384 |
| 385 { | 385 { |
| 386 AllowExternalCallThatCantCauseGC scope(masm_); | 386 AllowExternalCallThatCantCauseGC scope(masm_); |
| 387 ExternalReference function = | 387 ExternalReference function = |
| 388 ExternalReference::re_case_insensitive_compare_uc16(masm_->isolate()); | 388 ExternalReference::re_case_insensitive_compare_uc16(isolate()); |
| 389 __ CallCFunction(function, argument_count); | 389 __ CallCFunction(function, argument_count); |
| 390 } | 390 } |
| 391 | 391 |
| 392 // Check if function returned non-zero for success or zero for failure. | 392 // Check if function returned non-zero for success or zero for failure. |
| 393 __ cmp(r0, Operand::Zero()); | 393 __ cmp(r0, Operand::Zero()); |
| 394 BranchOrBacktrack(eq, on_no_match); | 394 BranchOrBacktrack(eq, on_no_match); |
| 395 // On success, increment position by length of capture. | 395 // On success, increment position by length of capture. |
| 396 __ add(current_input_offset(), current_input_offset(), Operand(r4)); | 396 __ add(current_input_offset(), current_input_offset(), Operand(r4)); |
| 397 } | 397 } |
| 398 | 398 |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 // from generated code. | 675 // from generated code. |
| 676 __ add(frame_pointer(), sp, Operand(4 * kPointerSize)); | 676 __ add(frame_pointer(), sp, Operand(4 * kPointerSize)); |
| 677 __ mov(r0, Operand::Zero()); | 677 __ mov(r0, Operand::Zero()); |
| 678 __ push(r0); // Make room for success counter and initialize it to 0. | 678 __ push(r0); // Make room for success counter and initialize it to 0. |
| 679 __ push(r0); // Make room for "position - 1" constant (value is irrelevant). | 679 __ push(r0); // Make room for "position - 1" constant (value is irrelevant). |
| 680 // Check if we have space on the stack for registers. | 680 // Check if we have space on the stack for registers. |
| 681 Label stack_limit_hit; | 681 Label stack_limit_hit; |
| 682 Label stack_ok; | 682 Label stack_ok; |
| 683 | 683 |
| 684 ExternalReference stack_limit = | 684 ExternalReference stack_limit = |
| 685 ExternalReference::address_of_stack_limit(masm_->isolate()); | 685 ExternalReference::address_of_stack_limit(isolate()); |
| 686 __ mov(r0, Operand(stack_limit)); | 686 __ mov(r0, Operand(stack_limit)); |
| 687 __ ldr(r0, MemOperand(r0)); | 687 __ ldr(r0, MemOperand(r0)); |
| 688 __ sub(r0, sp, r0, SetCC); | 688 __ sub(r0, sp, r0, SetCC); |
| 689 // Handle it if the stack pointer is already below the stack limit. | 689 // Handle it if the stack pointer is already below the stack limit. |
| 690 __ b(ls, &stack_limit_hit); | 690 __ b(ls, &stack_limit_hit); |
| 691 // Check if there is room for the variable number of registers above | 691 // Check if there is room for the variable number of registers above |
| 692 // the stack limit. | 692 // the stack limit. |
| 693 __ cmp(r0, Operand(num_registers_ * kPointerSize)); | 693 __ cmp(r0, Operand(num_registers_ * kPointerSize)); |
| 694 __ b(hs, &stack_ok); | 694 __ b(hs, &stack_ok); |
| 695 // Exit with OutOfMemory exception. There is not enough space on the stack | 695 // Exit with OutOfMemory exception. There is not enough space on the stack |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 if (stack_overflow_label_.is_linked()) { | 886 if (stack_overflow_label_.is_linked()) { |
| 887 SafeCallTarget(&stack_overflow_label_); | 887 SafeCallTarget(&stack_overflow_label_); |
| 888 // Reached if the backtrack-stack limit has been hit. | 888 // Reached if the backtrack-stack limit has been hit. |
| 889 Label grow_failed; | 889 Label grow_failed; |
| 890 | 890 |
| 891 // Call GrowStack(backtrack_stackpointer(), &stack_base) | 891 // Call GrowStack(backtrack_stackpointer(), &stack_base) |
| 892 static const int num_arguments = 3; | 892 static const int num_arguments = 3; |
| 893 __ PrepareCallCFunction(num_arguments, r0); | 893 __ PrepareCallCFunction(num_arguments, r0); |
| 894 __ mov(r0, backtrack_stackpointer()); | 894 __ mov(r0, backtrack_stackpointer()); |
| 895 __ add(r1, frame_pointer(), Operand(kStackHighEnd)); | 895 __ add(r1, frame_pointer(), Operand(kStackHighEnd)); |
| 896 __ mov(r2, Operand(ExternalReference::isolate_address())); | 896 __ mov(r2, Operand(ExternalReference::isolate_address(isolate()))); |
| 897 ExternalReference grow_stack = | 897 ExternalReference grow_stack = |
| 898 ExternalReference::re_grow_stack(masm_->isolate()); | 898 ExternalReference::re_grow_stack(isolate()); |
| 899 __ CallCFunction(grow_stack, num_arguments); | 899 __ CallCFunction(grow_stack, num_arguments); |
| 900 // If return NULL, we have failed to grow the stack, and | 900 // If return NULL, we have failed to grow the stack, and |
| 901 // must exit with a stack-overflow exception. | 901 // must exit with a stack-overflow exception. |
| 902 __ cmp(r0, Operand::Zero()); | 902 __ cmp(r0, Operand::Zero()); |
| 903 __ b(eq, &exit_with_exception); | 903 __ b(eq, &exit_with_exception); |
| 904 // Otherwise use return value as new stack pointer. | 904 // Otherwise use return value as new stack pointer. |
| 905 __ mov(backtrack_stackpointer(), r0); | 905 __ mov(backtrack_stackpointer(), r0); |
| 906 // Restore saved registers and continue. | 906 // Restore saved registers and continue. |
| 907 SafeReturn(); | 907 SafeReturn(); |
| 908 } | 908 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 | 1104 |
| 1105 void RegExpMacroAssemblerARM::CallCheckStackGuardState(Register scratch) { | 1105 void RegExpMacroAssemblerARM::CallCheckStackGuardState(Register scratch) { |
| 1106 static const int num_arguments = 3; | 1106 static const int num_arguments = 3; |
| 1107 __ PrepareCallCFunction(num_arguments, scratch); | 1107 __ PrepareCallCFunction(num_arguments, scratch); |
| 1108 // RegExp code frame pointer. | 1108 // RegExp code frame pointer. |
| 1109 __ mov(r2, frame_pointer()); | 1109 __ mov(r2, frame_pointer()); |
| 1110 // Code* of self. | 1110 // Code* of self. |
| 1111 __ mov(r1, Operand(masm_->CodeObject())); | 1111 __ mov(r1, Operand(masm_->CodeObject())); |
| 1112 // r0 becomes return address pointer. | 1112 // r0 becomes return address pointer. |
| 1113 ExternalReference stack_guard_check = | 1113 ExternalReference stack_guard_check = |
| 1114 ExternalReference::re_check_stack_guard_state(masm_->isolate()); | 1114 ExternalReference::re_check_stack_guard_state(isolate()); |
| 1115 CallCFunctionUsingStub(stack_guard_check, num_arguments); | 1115 CallCFunctionUsingStub(stack_guard_check, num_arguments); |
| 1116 } | 1116 } |
| 1117 | 1117 |
| 1118 | 1118 |
| 1119 // Helper function for reading a value out of a stack frame. | 1119 // Helper function for reading a value out of a stack frame. |
| 1120 template <typename T> | 1120 template <typename T> |
| 1121 static T& frame_entry(Address re_frame, int frame_offset) { | 1121 static T& frame_entry(Address re_frame, int frame_offset) { |
| 1122 return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset)); | 1122 return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset)); |
| 1123 } | 1123 } |
| 1124 | 1124 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 void RegExpMacroAssemblerARM::Pop(Register target) { | 1285 void RegExpMacroAssemblerARM::Pop(Register target) { |
| 1286 ASSERT(!target.is(backtrack_stackpointer())); | 1286 ASSERT(!target.is(backtrack_stackpointer())); |
| 1287 __ ldr(target, | 1287 __ ldr(target, |
| 1288 MemOperand(backtrack_stackpointer(), kPointerSize, PostIndex)); | 1288 MemOperand(backtrack_stackpointer(), kPointerSize, PostIndex)); |
| 1289 } | 1289 } |
| 1290 | 1290 |
| 1291 | 1291 |
| 1292 void RegExpMacroAssemblerARM::CheckPreemption() { | 1292 void RegExpMacroAssemblerARM::CheckPreemption() { |
| 1293 // Check for preemption. | 1293 // Check for preemption. |
| 1294 ExternalReference stack_limit = | 1294 ExternalReference stack_limit = |
| 1295 ExternalReference::address_of_stack_limit(masm_->isolate()); | 1295 ExternalReference::address_of_stack_limit(isolate()); |
| 1296 __ mov(r0, Operand(stack_limit)); | 1296 __ mov(r0, Operand(stack_limit)); |
| 1297 __ ldr(r0, MemOperand(r0)); | 1297 __ ldr(r0, MemOperand(r0)); |
| 1298 __ cmp(sp, r0); | 1298 __ cmp(sp, r0); |
| 1299 SafeCall(&check_preempt_label_, ls); | 1299 SafeCall(&check_preempt_label_, ls); |
| 1300 } | 1300 } |
| 1301 | 1301 |
| 1302 | 1302 |
| 1303 void RegExpMacroAssemblerARM::CheckStackLimit() { | 1303 void RegExpMacroAssemblerARM::CheckStackLimit() { |
| 1304 ExternalReference stack_limit = | 1304 ExternalReference stack_limit = |
| 1305 ExternalReference::address_of_regexp_stack_limit(masm_->isolate()); | 1305 ExternalReference::address_of_regexp_stack_limit(isolate()); |
| 1306 __ mov(r0, Operand(stack_limit)); | 1306 __ mov(r0, Operand(stack_limit)); |
| 1307 __ ldr(r0, MemOperand(r0)); | 1307 __ ldr(r0, MemOperand(r0)); |
| 1308 __ cmp(backtrack_stackpointer(), Operand(r0)); | 1308 __ cmp(backtrack_stackpointer(), Operand(r0)); |
| 1309 SafeCall(&stack_overflow_label_, ls); | 1309 SafeCall(&stack_overflow_label_, ls); |
| 1310 } | 1310 } |
| 1311 | 1311 |
| 1312 | 1312 |
| 1313 void RegExpMacroAssemblerARM::EmitBacktrackConstantPool() { | 1313 void RegExpMacroAssemblerARM::EmitBacktrackConstantPool() { |
| 1314 __ CheckConstPool(false, false); | 1314 __ CheckConstPool(false, false); |
| 1315 Assembler::BlockConstPoolScope block_const_pool(masm_); | 1315 Assembler::BlockConstPoolScope block_const_pool(masm_); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1410 __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex)); | 1410 __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex)); |
| 1411 } | 1411 } |
| 1412 | 1412 |
| 1413 #undef __ | 1413 #undef __ |
| 1414 | 1414 |
| 1415 #endif // V8_INTERPRETED_REGEXP | 1415 #endif // V8_INTERPRETED_REGEXP |
| 1416 | 1416 |
| 1417 }} // namespace v8::internal | 1417 }} // namespace v8::internal |
| 1418 | 1418 |
| 1419 #endif // V8_TARGET_ARCH_ARM | 1419 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |