| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   379  |   379  | 
|   380     { |   380     { | 
|   381       AllowExternalCallThatCantCauseGC scope(masm_); |   381       AllowExternalCallThatCantCauseGC scope(masm_); | 
|   382       ExternalReference function = |   382       ExternalReference function = | 
|   383           ExternalReference::re_case_insensitive_compare_uc16(masm_->isolate()); |   383           ExternalReference::re_case_insensitive_compare_uc16(masm_->isolate()); | 
|   384       __ CallCFunction(function, argument_count); |   384       __ CallCFunction(function, argument_count); | 
|   385     } |   385     } | 
|   386  |   386  | 
|   387     // Restore regexp engine registers. |   387     // Restore regexp engine registers. | 
|   388     __ MultiPop(regexp_registers_to_retain); |   388     __ MultiPop(regexp_registers_to_retain); | 
|   389     __ li(code_pointer(), Operand(masm_->CodeObject())); |   389     __ li(code_pointer(), Operand(masm_->CodeObject()), CONSTANT_SIZE); | 
|   390     __ lw(end_of_input_address(), MemOperand(frame_pointer(), kInputEnd)); |   390     __ lw(end_of_input_address(), MemOperand(frame_pointer(), kInputEnd)); | 
|   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     BranchOrBacktrack(on_no_match, eq, v0, Operand(zero_reg)); |   393     BranchOrBacktrack(on_no_match, eq, v0, Operand(zero_reg)); | 
|   394     // On success, increment position by length of capture. |   394     // On success, increment position by length of capture. | 
|   395     __ Addu(current_input_offset(), current_input_offset(), Operand(s3)); |   395     __ Addu(current_input_offset(), current_input_offset(), Operand(s3)); | 
|   396   } |   396   } | 
|   397  |   397  | 
|   398   __ bind(&fallthrough); |   398   __ bind(&fallthrough); | 
|   399 } |   399 } | 
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   691       __ bind(&init_loop); |   691       __ bind(&init_loop); | 
|   692       __ sw(a0, MemOperand(a1)); |   692       __ sw(a0, MemOperand(a1)); | 
|   693       __ Addu(a1, a1, Operand(-kPointerSize)); |   693       __ Addu(a1, a1, Operand(-kPointerSize)); | 
|   694       __ Subu(a2, a2, Operand(1)); |   694       __ Subu(a2, a2, Operand(1)); | 
|   695       __ Branch(&init_loop, ne, a2, Operand(zero_reg)); |   695       __ Branch(&init_loop, ne, a2, Operand(zero_reg)); | 
|   696     } |   696     } | 
|   697  |   697  | 
|   698     // Initialize backtrack stack pointer. |   698     // Initialize backtrack stack pointer. | 
|   699     __ lw(backtrack_stackpointer(), MemOperand(frame_pointer(), kStackHighEnd)); |   699     __ lw(backtrack_stackpointer(), MemOperand(frame_pointer(), kStackHighEnd)); | 
|   700     // Initialize code pointer register |   700     // Initialize code pointer register | 
|   701     __ li(code_pointer(), Operand(masm_->CodeObject())); |   701     __ li(code_pointer(), Operand(masm_->CodeObject()), CONSTANT_SIZE); | 
|   702     // Load previous char as initial value of current character register. |   702     // Load previous char as initial value of current character register. | 
|   703     Label at_start; |   703     Label at_start; | 
|   704     __ lw(a0, MemOperand(frame_pointer(), kAtStart)); |   704     __ lw(a0, MemOperand(frame_pointer(), kAtStart)); | 
|   705     __ Branch(&at_start, ne, a0, Operand(zero_reg)); |   705     __ Branch(&at_start, ne, a0, Operand(zero_reg)); | 
|   706     LoadCurrentCharacterUnchecked(-1, 1);  // Load previous char. |   706     LoadCurrentCharacterUnchecked(-1, 1);  // Load previous char. | 
|   707     __ jmp(&start_label_); |   707     __ jmp(&start_label_); | 
|   708     __ bind(&at_start); |   708     __ bind(&at_start); | 
|   709     __ li(current_character(), Operand('\n')); |   709     __ li(current_character(), Operand('\n')); | 
|   710     __ jmp(&start_label_); |   710     __ jmp(&start_label_); | 
|   711  |   711  | 
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   776           current_character().bit() | backtrack_stackpointer().bit(); |   776           current_character().bit() | backtrack_stackpointer().bit(); | 
|   777       __ MultiPush(regexp_registers_to_retain); |   777       __ MultiPush(regexp_registers_to_retain); | 
|   778       CallCheckStackGuardState(a0); |   778       CallCheckStackGuardState(a0); | 
|   779       __ MultiPop(regexp_registers_to_retain); |   779       __ MultiPop(regexp_registers_to_retain); | 
|   780       // If returning non-zero, we should end execution with the given |   780       // If returning non-zero, we should end execution with the given | 
|   781       // result as return value. |   781       // result as return value. | 
|   782       __ Branch(&exit_label_, ne, v0, Operand(zero_reg)); |   782       __ Branch(&exit_label_, ne, v0, Operand(zero_reg)); | 
|   783  |   783  | 
|   784       // String might have moved: Reload end of string from frame. |   784       // String might have moved: Reload end of string from frame. | 
|   785       __ lw(end_of_input_address(), MemOperand(frame_pointer(), kInputEnd)); |   785       __ lw(end_of_input_address(), MemOperand(frame_pointer(), kInputEnd)); | 
|   786       __ li(code_pointer(), Operand(masm_->CodeObject())); |   786       __ li(code_pointer(), Operand(masm_->CodeObject()), CONSTANT_SIZE); | 
|   787       SafeReturn(); |   787       SafeReturn(); | 
|   788     } |   788     } | 
|   789  |   789  | 
|   790     // Backtrack stack overflow code. |   790     // Backtrack stack overflow code. | 
|   791     if (stack_overflow_label_.is_linked()) { |   791     if (stack_overflow_label_.is_linked()) { | 
|   792       SafeCallTarget(&stack_overflow_label_); |   792       SafeCallTarget(&stack_overflow_label_); | 
|   793       // Reached if the backtrack-stack limit has been hit. |   793       // Reached if the backtrack-stack limit has been hit. | 
|   794       // Put regexp engine registers on stack first. |   794       // Put regexp engine registers on stack first. | 
|   795       RegList regexp_registers = current_input_offset().bit() | |   795       RegList regexp_registers = current_input_offset().bit() | | 
|   796           current_character().bit(); |   796           current_character().bit(); | 
|   797       __ MultiPush(regexp_registers); |   797       __ MultiPush(regexp_registers); | 
|   798       Label grow_failed; |   798       Label grow_failed; | 
|   799       // Call GrowStack(backtrack_stackpointer(), &stack_base) |   799       // Call GrowStack(backtrack_stackpointer(), &stack_base) | 
|   800       static const int num_arguments = 3; |   800       static const int num_arguments = 3; | 
|   801       __ PrepareCallCFunction(num_arguments, a0); |   801       __ PrepareCallCFunction(num_arguments, a0); | 
|   802       __ mov(a0, backtrack_stackpointer()); |   802       __ mov(a0, backtrack_stackpointer()); | 
|   803       __ Addu(a1, frame_pointer(), Operand(kStackHighEnd)); |   803       __ Addu(a1, frame_pointer(), Operand(kStackHighEnd)); | 
|   804       __ li(a2, Operand(ExternalReference::isolate_address())); |   804       __ li(a2, Operand(ExternalReference::isolate_address())); | 
|   805       ExternalReference grow_stack = |   805       ExternalReference grow_stack = | 
|   806           ExternalReference::re_grow_stack(masm_->isolate()); |   806           ExternalReference::re_grow_stack(masm_->isolate()); | 
|   807       __ CallCFunction(grow_stack, num_arguments); |   807       __ CallCFunction(grow_stack, num_arguments); | 
|   808       // Restore regexp registers. |   808       // Restore regexp registers. | 
|   809       __ MultiPop(regexp_registers); |   809       __ MultiPop(regexp_registers); | 
|   810       // If return NULL, we have failed to grow the stack, and |   810       // If return NULL, we have failed to grow the stack, and | 
|   811       // must exit with a stack-overflow exception. |   811       // must exit with a stack-overflow exception. | 
|   812       __ Branch(&exit_with_exception, eq, v0, Operand(zero_reg)); |   812       __ Branch(&exit_with_exception, eq, v0, Operand(zero_reg)); | 
|   813       // Otherwise use return value as new stack pointer. |   813       // Otherwise use return value as new stack pointer. | 
|   814       __ mov(backtrack_stackpointer(), v0); |   814       __ mov(backtrack_stackpointer(), v0); | 
|   815       // Restore saved registers and continue. |   815       // Restore saved registers and continue. | 
|   816       __ li(code_pointer(), Operand(masm_->CodeObject())); |   816       __ li(code_pointer(), Operand(masm_->CodeObject()), CONSTANT_SIZE); | 
|   817       __ lw(end_of_input_address(), MemOperand(frame_pointer(), kInputEnd)); |   817       __ lw(end_of_input_address(), MemOperand(frame_pointer(), kInputEnd)); | 
|   818       SafeReturn(); |   818       SafeReturn(); | 
|   819     } |   819     } | 
|   820  |   820  | 
|   821     if (exit_with_exception.is_linked()) { |   821     if (exit_with_exception.is_linked()) { | 
|   822       // If any of the code above needed to exit with an exception. |   822       // If any of the code above needed to exit with an exception. | 
|   823       __ bind(&exit_with_exception); |   823       __ bind(&exit_with_exception); | 
|   824       // Exit with Result EXCEPTION(-1) to signal thrown exception. |   824       // Exit with Result EXCEPTION(-1) to signal thrown exception. | 
|   825       __ li(v0, Operand(EXCEPTION)); |   825       __ li(v0, Operand(EXCEPTION)); | 
|   826       __ jmp(&exit_label_); |   826       __ jmp(&exit_label_); | 
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1003 } |  1003 } | 
|  1004  |  1004  | 
|  1005  |  1005  | 
|  1006 // Private methods: |  1006 // Private methods: | 
|  1007  |  1007  | 
|  1008 void RegExpMacroAssemblerMIPS::CallCheckStackGuardState(Register scratch) { |  1008 void RegExpMacroAssemblerMIPS::CallCheckStackGuardState(Register scratch) { | 
|  1009   static const int num_arguments = 3; |  1009   static const int num_arguments = 3; | 
|  1010   __ PrepareCallCFunction(num_arguments, scratch); |  1010   __ PrepareCallCFunction(num_arguments, scratch); | 
|  1011   __ mov(a2, frame_pointer()); |  1011   __ mov(a2, frame_pointer()); | 
|  1012   // Code* of self. |  1012   // Code* of self. | 
|  1013   __ li(a1, Operand(masm_->CodeObject())); |  1013   __ li(a1, Operand(masm_->CodeObject()), CONSTANT_SIZE); | 
|  1014   // a0 becomes return address pointer. |  1014   // a0 becomes return address pointer. | 
|  1015   ExternalReference stack_guard_check = |  1015   ExternalReference stack_guard_check = | 
|  1016       ExternalReference::re_check_stack_guard_state(masm_->isolate()); |  1016       ExternalReference::re_check_stack_guard_state(masm_->isolate()); | 
|  1017   CallCFunctionUsingStub(stack_guard_check, num_arguments); |  1017   CallCFunctionUsingStub(stack_guard_check, num_arguments); | 
|  1018 } |  1018 } | 
|  1019  |  1019  | 
|  1020  |  1020  | 
|  1021 // Helper function for reading a value out of a stack frame. |  1021 // Helper function for reading a value out of a stack frame. | 
|  1022 template <typename T> |  1022 template <typename T> | 
|  1023 static T& frame_entry(Address re_frame, int frame_offset) { |  1023 static T& frame_entry(Address re_frame, int frame_offset) { | 
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1222     ExternalReference function, |  1222     ExternalReference function, | 
|  1223     int num_arguments) { |  1223     int num_arguments) { | 
|  1224   // Must pass all arguments in registers. The stub pushes on the stack. |  1224   // Must pass all arguments in registers. The stub pushes on the stack. | 
|  1225   ASSERT(num_arguments <= 4); |  1225   ASSERT(num_arguments <= 4); | 
|  1226   __ li(code_pointer(), Operand(function)); |  1226   __ li(code_pointer(), Operand(function)); | 
|  1227   RegExpCEntryStub stub; |  1227   RegExpCEntryStub stub; | 
|  1228   __ CallStub(&stub); |  1228   __ CallStub(&stub); | 
|  1229   if (OS::ActivationFrameAlignment() != 0) { |  1229   if (OS::ActivationFrameAlignment() != 0) { | 
|  1230     __ lw(sp, MemOperand(sp, 16)); |  1230     __ lw(sp, MemOperand(sp, 16)); | 
|  1231   } |  1231   } | 
|  1232   __ li(code_pointer(), Operand(masm_->CodeObject())); |  1232   __ li(code_pointer(), Operand(masm_->CodeObject()), CONSTANT_SIZE); | 
|  1233 } |  1233 } | 
|  1234  |  1234  | 
|  1235  |  1235  | 
|  1236 void RegExpMacroAssemblerMIPS::LoadCurrentCharacterUnchecked(int cp_offset, |  1236 void RegExpMacroAssemblerMIPS::LoadCurrentCharacterUnchecked(int cp_offset, | 
|  1237                                                             int characters) { |  1237                                                             int characters) { | 
|  1238   Register offset = current_input_offset(); |  1238   Register offset = current_input_offset(); | 
|  1239   if (cp_offset != 0) { |  1239   if (cp_offset != 0) { | 
|  1240     __ Addu(a0, current_input_offset(), Operand(cp_offset * char_size())); |  1240     __ Addu(a0, current_input_offset(), Operand(cp_offset * char_size())); | 
|  1241     offset = a0; |  1241     offset = a0; | 
|  1242   } |  1242   } | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
|  1270 } |  1270 } | 
|  1271  |  1271  | 
|  1272  |  1272  | 
|  1273 #undef __ |  1273 #undef __ | 
|  1274  |  1274  | 
|  1275 #endif  // V8_INTERPRETED_REGEXP |  1275 #endif  // V8_INTERPRETED_REGEXP | 
|  1276  |  1276  | 
|  1277 }}  // namespace v8::internal |  1277 }}  // namespace v8::internal | 
|  1278  |  1278  | 
|  1279 #endif  // V8_TARGET_ARCH_MIPS |  1279 #endif  // V8_TARGET_ARCH_MIPS | 
| OLD | NEW |