| OLD | NEW |
| 1 // Copyright 2008-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2008-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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 | 341 |
| 342 __ cmp(eax, Operand(ecx)); | 342 __ cmp(eax, Operand(ecx)); |
| 343 __ j(not_equal, &fail); | 343 __ j(not_equal, &fail); |
| 344 | 344 |
| 345 __ bind(&loop_increment); | 345 __ bind(&loop_increment); |
| 346 // Increment pointers into match and capture strings. | 346 // Increment pointers into match and capture strings. |
| 347 __ add(Operand(edx), Immediate(1)); | 347 __ add(Operand(edx), Immediate(1)); |
| 348 __ add(Operand(edi), Immediate(1)); | 348 __ add(Operand(edi), Immediate(1)); |
| 349 // Compare to end of match, and loop if not done. | 349 // Compare to end of match, and loop if not done. |
| 350 __ cmp(edi, Operand(ebx)); | 350 __ cmp(edi, Operand(ebx)); |
| 351 __ j(below, &loop, taken); | 351 __ j(below, &loop, Label::kFar, taken); |
| 352 __ jmp(&success); | 352 __ jmp(&success); |
| 353 | 353 |
| 354 __ bind(&fail); | 354 __ bind(&fail); |
| 355 // Restore original values before failing. | 355 // Restore original values before failing. |
| 356 __ pop(backtrack_stackpointer()); | 356 __ pop(backtrack_stackpointer()); |
| 357 __ pop(edi); | 357 __ pop(edi); |
| 358 BranchOrBacktrack(no_condition, on_no_match); | 358 BranchOrBacktrack(no_condition, on_no_match); |
| 359 | 359 |
| 360 __ bind(&success); | 360 __ bind(&success); |
| 361 // Restore original value before continuing. | 361 // Restore original value before continuing. |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 | 680 |
| 681 // Check if we have space on the stack for registers. | 681 // Check if we have space on the stack for registers. |
| 682 Label stack_limit_hit; | 682 Label stack_limit_hit; |
| 683 Label stack_ok; | 683 Label stack_ok; |
| 684 | 684 |
| 685 ExternalReference stack_limit = | 685 ExternalReference stack_limit = |
| 686 ExternalReference::address_of_stack_limit(masm_->isolate()); | 686 ExternalReference::address_of_stack_limit(masm_->isolate()); |
| 687 __ mov(ecx, esp); | 687 __ mov(ecx, esp); |
| 688 __ sub(ecx, Operand::StaticVariable(stack_limit)); | 688 __ sub(ecx, Operand::StaticVariable(stack_limit)); |
| 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 __ j(below_equal, &stack_limit_hit, not_taken); | 690 __ j(below_equal, &stack_limit_hit, Label::kFar, not_taken); |
| 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(ecx, num_registers_ * kPointerSize); | 693 __ cmp(ecx, num_registers_ * kPointerSize); |
| 694 __ j(above_equal, &stack_ok, taken); | 694 __ j(above_equal, &stack_ok, Label::kFar, taken); |
| 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 |
| 696 // for our working registers. | 696 // for our working registers. |
| 697 __ mov(eax, EXCEPTION); | 697 __ mov(eax, EXCEPTION); |
| 698 __ jmp(&exit_label_); | 698 __ jmp(&exit_label_); |
| 699 | 699 |
| 700 __ bind(&stack_limit_hit); | 700 __ bind(&stack_limit_hit); |
| 701 CallCheckStackGuardState(ebx); | 701 CallCheckStackGuardState(ebx); |
| 702 __ or_(eax, Operand(eax)); | 702 __ or_(eax, Operand(eax)); |
| 703 // If returned value is non-zero, we exit with the returned value as result. | 703 // If returned value is non-zero, we exit with the returned value as result. |
| 704 __ j(not_zero, &exit_label_); | 704 __ j(not_zero, &exit_label_); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 __ mov(edi, register_location(reg)); | 964 __ mov(edi, register_location(reg)); |
| 965 } | 965 } |
| 966 | 966 |
| 967 | 967 |
| 968 void RegExpMacroAssemblerIA32::ReadStackPointerFromRegister(int reg) { | 968 void RegExpMacroAssemblerIA32::ReadStackPointerFromRegister(int reg) { |
| 969 __ mov(backtrack_stackpointer(), register_location(reg)); | 969 __ mov(backtrack_stackpointer(), register_location(reg)); |
| 970 __ add(backtrack_stackpointer(), Operand(ebp, kStackHighEnd)); | 970 __ add(backtrack_stackpointer(), Operand(ebp, kStackHighEnd)); |
| 971 } | 971 } |
| 972 | 972 |
| 973 void RegExpMacroAssemblerIA32::SetCurrentPositionFromEnd(int by) { | 973 void RegExpMacroAssemblerIA32::SetCurrentPositionFromEnd(int by) { |
| 974 NearLabel after_position; | 974 Label after_position; |
| 975 __ cmp(edi, -by * char_size()); | 975 __ cmp(edi, -by * char_size()); |
| 976 __ j(greater_equal, &after_position); | 976 __ j(greater_equal, &after_position, Label::kNear); |
| 977 __ mov(edi, -by * char_size()); | 977 __ mov(edi, -by * char_size()); |
| 978 // On RegExp code entry (where this operation is used), the character before | 978 // On RegExp code entry (where this operation is used), the character before |
| 979 // the current position is expected to be already loaded. | 979 // the current position is expected to be already loaded. |
| 980 // We have advanced the position, so it's safe to read backwards. | 980 // We have advanced the position, so it's safe to read backwards. |
| 981 LoadCurrentCharacterUnchecked(-1, 1); | 981 LoadCurrentCharacterUnchecked(-1, 1); |
| 982 __ bind(&after_position); | 982 __ bind(&after_position); |
| 983 } | 983 } |
| 984 | 984 |
| 985 void RegExpMacroAssemblerIA32::SetRegister(int register_index, int to) { | 985 void RegExpMacroAssemblerIA32::SetRegister(int register_index, int to) { |
| 986 ASSERT(register_index >= num_saved_registers_); // Reserved for positions! | 986 ASSERT(register_index >= num_saved_registers_); // Reserved for positions! |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 Hint hint) { | 1146 Hint hint) { |
| 1147 if (condition < 0) { // No condition | 1147 if (condition < 0) { // No condition |
| 1148 if (to == NULL) { | 1148 if (to == NULL) { |
| 1149 Backtrack(); | 1149 Backtrack(); |
| 1150 return; | 1150 return; |
| 1151 } | 1151 } |
| 1152 __ jmp(to); | 1152 __ jmp(to); |
| 1153 return; | 1153 return; |
| 1154 } | 1154 } |
| 1155 if (to == NULL) { | 1155 if (to == NULL) { |
| 1156 __ j(condition, &backtrack_label_, hint); | 1156 __ j(condition, &backtrack_label_, Label::kFar, hint); |
| 1157 return; | 1157 return; |
| 1158 } | 1158 } |
| 1159 __ j(condition, to, hint); | 1159 __ j(condition, to, Label::kFar, hint); |
| 1160 } | 1160 } |
| 1161 | 1161 |
| 1162 | 1162 |
| 1163 void RegExpMacroAssemblerIA32::SafeCall(Label* to) { | 1163 void RegExpMacroAssemblerIA32::SafeCall(Label* to) { |
| 1164 Label return_to; | 1164 Label return_to; |
| 1165 __ push(Immediate::CodeRelativeOffset(&return_to)); | 1165 __ push(Immediate::CodeRelativeOffset(&return_to)); |
| 1166 __ jmp(to); | 1166 __ jmp(to); |
| 1167 __ bind(&return_to); | 1167 __ bind(&return_to); |
| 1168 } | 1168 } |
| 1169 | 1169 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 __ add(Operand(backtrack_stackpointer()), Immediate(kPointerSize)); | 1202 __ add(Operand(backtrack_stackpointer()), Immediate(kPointerSize)); |
| 1203 } | 1203 } |
| 1204 | 1204 |
| 1205 | 1205 |
| 1206 void RegExpMacroAssemblerIA32::CheckPreemption() { | 1206 void RegExpMacroAssemblerIA32::CheckPreemption() { |
| 1207 // Check for preemption. | 1207 // Check for preemption. |
| 1208 Label no_preempt; | 1208 Label no_preempt; |
| 1209 ExternalReference stack_limit = | 1209 ExternalReference stack_limit = |
| 1210 ExternalReference::address_of_stack_limit(masm_->isolate()); | 1210 ExternalReference::address_of_stack_limit(masm_->isolate()); |
| 1211 __ cmp(esp, Operand::StaticVariable(stack_limit)); | 1211 __ cmp(esp, Operand::StaticVariable(stack_limit)); |
| 1212 __ j(above, &no_preempt, taken); | 1212 __ j(above, &no_preempt, Label::kFar, taken); |
| 1213 | 1213 |
| 1214 SafeCall(&check_preempt_label_); | 1214 SafeCall(&check_preempt_label_); |
| 1215 | 1215 |
| 1216 __ bind(&no_preempt); | 1216 __ bind(&no_preempt); |
| 1217 } | 1217 } |
| 1218 | 1218 |
| 1219 | 1219 |
| 1220 void RegExpMacroAssemblerIA32::CheckStackLimit() { | 1220 void RegExpMacroAssemblerIA32::CheckStackLimit() { |
| 1221 Label no_stack_overflow; | 1221 Label no_stack_overflow; |
| 1222 ExternalReference stack_limit = | 1222 ExternalReference stack_limit = |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1255 } | 1255 } |
| 1256 | 1256 |
| 1257 | 1257 |
| 1258 #undef __ | 1258 #undef __ |
| 1259 | 1259 |
| 1260 #endif // V8_INTERPRETED_REGEXP | 1260 #endif // V8_INTERPRETED_REGEXP |
| 1261 | 1261 |
| 1262 }} // namespace v8::internal | 1262 }} // namespace v8::internal |
| 1263 | 1263 |
| 1264 #endif // V8_TARGET_ARCH_IA32 | 1264 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |