| 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 362     // Address of start of capture. | 362     // Address of start of capture. | 
| 363     __ add(r0, r0, Operand(end_of_input_address())); | 363     __ add(r0, r0, Operand(end_of_input_address())); | 
| 364     // Length of capture. | 364     // Length of capture. | 
| 365     __ mov(r2, Operand(r1)); | 365     __ mov(r2, Operand(r1)); | 
| 366     // Save length in callee-save register for use on return. | 366     // Save length in callee-save register for use on return. | 
| 367     __ mov(r4, Operand(r1)); | 367     __ mov(r4, Operand(r1)); | 
| 368     // Address of current input position. | 368     // Address of current input position. | 
| 369     __ add(r1, current_input_offset(), Operand(end_of_input_address())); | 369     __ add(r1, current_input_offset(), Operand(end_of_input_address())); | 
| 370 | 370 | 
| 371     ExternalReference function = | 371     ExternalReference function = | 
| 372         ExternalReference::re_case_insensitive_compare_uc16(); | 372         ExternalReference::re_case_insensitive_compare_uc16(masm_->isolate()); | 
| 373     __ CallCFunction(function, argument_count); | 373     __ CallCFunction(function, argument_count); | 
| 374 | 374 | 
| 375     // Check if function returned non-zero for success or zero for failure. | 375     // Check if function returned non-zero for success or zero for failure. | 
| 376     __ cmp(r0, Operand(0, RelocInfo::NONE)); | 376     __ cmp(r0, Operand(0, RelocInfo::NONE)); | 
| 377     BranchOrBacktrack(eq, on_no_match); | 377     BranchOrBacktrack(eq, on_no_match); | 
| 378     // On success, increment position by length of capture. | 378     // On success, increment position by length of capture. | 
| 379     __ add(current_input_offset(), current_input_offset(), Operand(r4)); | 379     __ add(current_input_offset(), current_input_offset(), Operand(r4)); | 
| 380   } | 380   } | 
| 381 | 381 | 
| 382   __ bind(&fallthrough); | 382   __ bind(&fallthrough); | 
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 620   // Set frame pointer in space for it if this is not a direct call | 620   // Set frame pointer in space for it if this is not a direct call | 
| 621   // from generated code. | 621   // from generated code. | 
| 622   __ add(frame_pointer(), sp, Operand(4 * kPointerSize)); | 622   __ add(frame_pointer(), sp, Operand(4 * kPointerSize)); | 
| 623   __ push(r0);  // Make room for "position - 1" constant (value is irrelevant). | 623   __ push(r0);  // Make room for "position - 1" constant (value is irrelevant). | 
| 624   __ push(r0);  // Make room for "at start" constant (value is irrelevant). | 624   __ push(r0);  // Make room for "at start" constant (value is irrelevant). | 
| 625   // Check if we have space on the stack for registers. | 625   // Check if we have space on the stack for registers. | 
| 626   Label stack_limit_hit; | 626   Label stack_limit_hit; | 
| 627   Label stack_ok; | 627   Label stack_ok; | 
| 628 | 628 | 
| 629   ExternalReference stack_limit = | 629   ExternalReference stack_limit = | 
| 630       ExternalReference::address_of_stack_limit(); | 630       ExternalReference::address_of_stack_limit(masm_->isolate()); | 
| 631   __ mov(r0, Operand(stack_limit)); | 631   __ mov(r0, Operand(stack_limit)); | 
| 632   __ ldr(r0, MemOperand(r0)); | 632   __ ldr(r0, MemOperand(r0)); | 
| 633   __ sub(r0, sp, r0, SetCC); | 633   __ sub(r0, sp, r0, SetCC); | 
| 634   // Handle it if the stack pointer is already below the stack limit. | 634   // Handle it if the stack pointer is already below the stack limit. | 
| 635   __ b(ls, &stack_limit_hit); | 635   __ b(ls, &stack_limit_hit); | 
| 636   // Check if there is room for the variable number of registers above | 636   // Check if there is room for the variable number of registers above | 
| 637   // the stack limit. | 637   // the stack limit. | 
| 638   __ cmp(r0, Operand(num_registers_ * kPointerSize)); | 638   __ cmp(r0, Operand(num_registers_ * kPointerSize)); | 
| 639   __ b(hs, &stack_ok); | 639   __ b(hs, &stack_ok); | 
| 640   // Exit with OutOfMemory exception. There is not enough space on the stack | 640   // Exit with OutOfMemory exception. There is not enough space on the stack | 
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 776     SafeCallTarget(&stack_overflow_label_); | 776     SafeCallTarget(&stack_overflow_label_); | 
| 777     // Reached if the backtrack-stack limit has been hit. | 777     // Reached if the backtrack-stack limit has been hit. | 
| 778     Label grow_failed; | 778     Label grow_failed; | 
| 779 | 779 | 
| 780     // Call GrowStack(backtrack_stackpointer(), &stack_base) | 780     // Call GrowStack(backtrack_stackpointer(), &stack_base) | 
| 781     static const int num_arguments = 2; | 781     static const int num_arguments = 2; | 
| 782     __ PrepareCallCFunction(num_arguments, r0); | 782     __ PrepareCallCFunction(num_arguments, r0); | 
| 783     __ mov(r0, backtrack_stackpointer()); | 783     __ mov(r0, backtrack_stackpointer()); | 
| 784     __ add(r1, frame_pointer(), Operand(kStackHighEnd)); | 784     __ add(r1, frame_pointer(), Operand(kStackHighEnd)); | 
| 785     ExternalReference grow_stack = | 785     ExternalReference grow_stack = | 
| 786       ExternalReference::re_grow_stack(); | 786         ExternalReference::re_grow_stack(masm_->isolate()); | 
| 787     __ CallCFunction(grow_stack, num_arguments); | 787     __ CallCFunction(grow_stack, num_arguments); | 
| 788     // If return NULL, we have failed to grow the stack, and | 788     // If return NULL, we have failed to grow the stack, and | 
| 789     // must exit with a stack-overflow exception. | 789     // must exit with a stack-overflow exception. | 
| 790     __ cmp(r0, Operand(0, RelocInfo::NONE)); | 790     __ cmp(r0, Operand(0, RelocInfo::NONE)); | 
| 791     __ b(eq, &exit_with_exception); | 791     __ b(eq, &exit_with_exception); | 
| 792     // Otherwise use return value as new stack pointer. | 792     // Otherwise use return value as new stack pointer. | 
| 793     __ mov(backtrack_stackpointer(), r0); | 793     __ mov(backtrack_stackpointer(), r0); | 
| 794     // Restore saved registers and continue. | 794     // Restore saved registers and continue. | 
| 795     SafeReturn(); | 795     SafeReturn(); | 
| 796   } | 796   } | 
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 992 | 992 | 
| 993 void RegExpMacroAssemblerARM::CallCheckStackGuardState(Register scratch) { | 993 void RegExpMacroAssemblerARM::CallCheckStackGuardState(Register scratch) { | 
| 994   static const int num_arguments = 3; | 994   static const int num_arguments = 3; | 
| 995   __ PrepareCallCFunction(num_arguments, scratch); | 995   __ PrepareCallCFunction(num_arguments, scratch); | 
| 996   // RegExp code frame pointer. | 996   // RegExp code frame pointer. | 
| 997   __ mov(r2, frame_pointer()); | 997   __ mov(r2, frame_pointer()); | 
| 998   // Code* of self. | 998   // Code* of self. | 
| 999   __ mov(r1, Operand(masm_->CodeObject())); | 999   __ mov(r1, Operand(masm_->CodeObject())); | 
| 1000   // r0 becomes return address pointer. | 1000   // r0 becomes return address pointer. | 
| 1001   ExternalReference stack_guard_check = | 1001   ExternalReference stack_guard_check = | 
| 1002       ExternalReference::re_check_stack_guard_state(); | 1002       ExternalReference::re_check_stack_guard_state(masm_->isolate()); | 
| 1003   CallCFunctionUsingStub(stack_guard_check, num_arguments); | 1003   CallCFunctionUsingStub(stack_guard_check, num_arguments); | 
| 1004 } | 1004 } | 
| 1005 | 1005 | 
| 1006 | 1006 | 
| 1007 // Helper function for reading a value out of a stack frame. | 1007 // Helper function for reading a value out of a stack frame. | 
| 1008 template <typename T> | 1008 template <typename T> | 
| 1009 static T& frame_entry(Address re_frame, int frame_offset) { | 1009 static T& frame_entry(Address re_frame, int frame_offset) { | 
| 1010   return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset)); | 1010   return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset)); | 
| 1011 } | 1011 } | 
| 1012 | 1012 | 
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1154 void RegExpMacroAssemblerARM::Pop(Register target) { | 1154 void RegExpMacroAssemblerARM::Pop(Register target) { | 
| 1155   ASSERT(!target.is(backtrack_stackpointer())); | 1155   ASSERT(!target.is(backtrack_stackpointer())); | 
| 1156   __ ldr(target, | 1156   __ ldr(target, | 
| 1157          MemOperand(backtrack_stackpointer(), kPointerSize, PostIndex)); | 1157          MemOperand(backtrack_stackpointer(), kPointerSize, PostIndex)); | 
| 1158 } | 1158 } | 
| 1159 | 1159 | 
| 1160 | 1160 | 
| 1161 void RegExpMacroAssemblerARM::CheckPreemption() { | 1161 void RegExpMacroAssemblerARM::CheckPreemption() { | 
| 1162   // Check for preemption. | 1162   // Check for preemption. | 
| 1163   ExternalReference stack_limit = | 1163   ExternalReference stack_limit = | 
| 1164       ExternalReference::address_of_stack_limit(); | 1164       ExternalReference::address_of_stack_limit(masm_->isolate()); | 
| 1165   __ mov(r0, Operand(stack_limit)); | 1165   __ mov(r0, Operand(stack_limit)); | 
| 1166   __ ldr(r0, MemOperand(r0)); | 1166   __ ldr(r0, MemOperand(r0)); | 
| 1167   __ cmp(sp, r0); | 1167   __ cmp(sp, r0); | 
| 1168   SafeCall(&check_preempt_label_, ls); | 1168   SafeCall(&check_preempt_label_, ls); | 
| 1169 } | 1169 } | 
| 1170 | 1170 | 
| 1171 | 1171 | 
| 1172 void RegExpMacroAssemblerARM::CheckStackLimit() { | 1172 void RegExpMacroAssemblerARM::CheckStackLimit() { | 
| 1173   ExternalReference stack_limit = | 1173   ExternalReference stack_limit = | 
| 1174       ExternalReference::address_of_regexp_stack_limit(); | 1174       ExternalReference::address_of_regexp_stack_limit(masm_->isolate()); | 
| 1175   __ mov(r0, Operand(stack_limit)); | 1175   __ mov(r0, Operand(stack_limit)); | 
| 1176   __ ldr(r0, MemOperand(r0)); | 1176   __ ldr(r0, MemOperand(r0)); | 
| 1177   __ cmp(backtrack_stackpointer(), Operand(r0)); | 1177   __ cmp(backtrack_stackpointer(), Operand(r0)); | 
| 1178   SafeCall(&stack_overflow_label_, ls); | 1178   SafeCall(&stack_overflow_label_, ls); | 
| 1179 } | 1179 } | 
| 1180 | 1180 | 
| 1181 | 1181 | 
| 1182 void RegExpMacroAssemblerARM::EmitBacktrackConstantPool() { | 1182 void RegExpMacroAssemblerARM::EmitBacktrackConstantPool() { | 
| 1183   __ CheckConstPool(false, false); | 1183   __ CheckConstPool(false, false); | 
| 1184   __ BlockConstPoolBefore( | 1184   __ BlockConstPoolBefore( | 
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1274   __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex)); | 1274   __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex)); | 
| 1275 } | 1275 } | 
| 1276 | 1276 | 
| 1277 #undef __ | 1277 #undef __ | 
| 1278 | 1278 | 
| 1279 #endif  // V8_INTERPRETED_REGEXP | 1279 #endif  // V8_INTERPRETED_REGEXP | 
| 1280 | 1280 | 
| 1281 }}  // namespace v8::internal | 1281 }}  // namespace v8::internal | 
| 1282 | 1282 | 
| 1283 #endif  // V8_TARGET_ARCH_ARM | 1283 #endif  // V8_TARGET_ARCH_ARM | 
| OLD | NEW | 
|---|