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 5025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5036 // a1: previous index | 5036 // a1: previous index |
5037 // a3: encoding of subject string (1 if ASCII, 0 if two_byte); | 5037 // a3: encoding of subject string (1 if ASCII, 0 if two_byte); |
5038 // t9: code | 5038 // t9: code |
5039 // subject: Subject string | 5039 // subject: Subject string |
5040 // regexp_data: RegExp data (FixedArray) | 5040 // regexp_data: RegExp data (FixedArray) |
5041 // All checks done. Now push arguments for native regexp code. | 5041 // All checks done. Now push arguments for native regexp code. |
5042 __ IncrementCounter(isolate->counters()->regexp_entry_native(), | 5042 __ IncrementCounter(isolate->counters()->regexp_entry_native(), |
5043 1, a0, a2); | 5043 1, a0, a2); |
5044 | 5044 |
5045 // Isolates: note we add an additional parameter here (isolate pointer). | 5045 // Isolates: note we add an additional parameter here (isolate pointer). |
5046 const int kRegExpExecuteArguments = 8; | 5046 const int kRegExpExecuteArguments = 9; |
5047 const int kParameterRegisters = 4; | 5047 const int kParameterRegisters = 4; |
5048 __ EnterExitFrame(false, kRegExpExecuteArguments - kParameterRegisters); | 5048 __ EnterExitFrame(false, kRegExpExecuteArguments - kParameterRegisters); |
5049 | 5049 |
5050 // Stack pointer now points to cell where return address is to be written. | 5050 // Stack pointer now points to cell where return address is to be written. |
5051 // Arguments are before that on the stack or in registers, meaning we | 5051 // Arguments are before that on the stack or in registers, meaning we |
5052 // treat the return address as argument 5. Thus every argument after that | 5052 // treat the return address as argument 5. Thus every argument after that |
5053 // needs to be shifted back by 1. Since DirectCEntryStub will handle | 5053 // needs to be shifted back by 1. Since DirectCEntryStub will handle |
5054 // allocating space for the c argument slots, we don't need to calculate | 5054 // allocating space for the c argument slots, we don't need to calculate |
5055 // that into the argument positions on the stack. This is how the stack will | 5055 // that into the argument positions on the stack. This is how the stack will |
5056 // look (sp meaning the value of sp at this moment): | 5056 // look (sp meaning the value of sp at this moment): |
| 5057 // [sp + 5] - Argument 9 |
5057 // [sp + 4] - Argument 8 | 5058 // [sp + 4] - Argument 8 |
5058 // [sp + 3] - Argument 7 | 5059 // [sp + 3] - Argument 7 |
5059 // [sp + 2] - Argument 6 | 5060 // [sp + 2] - Argument 6 |
5060 // [sp + 1] - Argument 5 | 5061 // [sp + 1] - Argument 5 |
5061 // [sp + 0] - saved ra | 5062 // [sp + 0] - saved ra |
5062 | 5063 |
5063 // Argument 8: Pass current isolate address. | 5064 // Argument 9: Pass current isolate address. |
5064 // CFunctionArgumentOperand handles MIPS stack argument slots. | 5065 // CFunctionArgumentOperand handles MIPS stack argument slots. |
5065 __ li(a0, Operand(ExternalReference::isolate_address())); | 5066 __ li(a0, Operand(ExternalReference::isolate_address())); |
| 5067 __ sw(a0, MemOperand(sp, 5 * kPointerSize)); |
| 5068 |
| 5069 // Argument 8: Indicate that this is a direct call from JavaScript. |
| 5070 __ li(a0, Operand(1)); |
5066 __ sw(a0, MemOperand(sp, 4 * kPointerSize)); | 5071 __ sw(a0, MemOperand(sp, 4 * kPointerSize)); |
5067 | 5072 |
5068 // Argument 7: Indicate that this is a direct call from JavaScript. | 5073 // Argument 7: Start (high end) of backtracking stack memory area. |
5069 __ li(a0, Operand(1)); | |
5070 __ sw(a0, MemOperand(sp, 3 * kPointerSize)); | |
5071 | |
5072 // Argument 6: Start (high end) of backtracking stack memory area. | |
5073 __ li(a0, Operand(address_of_regexp_stack_memory_address)); | 5074 __ li(a0, Operand(address_of_regexp_stack_memory_address)); |
5074 __ lw(a0, MemOperand(a0, 0)); | 5075 __ lw(a0, MemOperand(a0, 0)); |
5075 __ li(a2, Operand(address_of_regexp_stack_memory_size)); | 5076 __ li(a2, Operand(address_of_regexp_stack_memory_size)); |
5076 __ lw(a2, MemOperand(a2, 0)); | 5077 __ lw(a2, MemOperand(a2, 0)); |
5077 __ addu(a0, a0, a2); | 5078 __ addu(a0, a0, a2); |
| 5079 __ sw(a0, MemOperand(sp, 3 * kPointerSize)); |
| 5080 |
| 5081 // Argument 6: Set the number of capture registers to zero to force global |
| 5082 // regexps to behave as non-global. This does not affect non-global regexps. |
| 5083 __ mov(a0, zero_reg); |
5078 __ sw(a0, MemOperand(sp, 2 * kPointerSize)); | 5084 __ sw(a0, MemOperand(sp, 2 * kPointerSize)); |
5079 | 5085 |
5080 // Argument 5: static offsets vector buffer. | 5086 // Argument 5: static offsets vector buffer. |
5081 __ li(a0, Operand( | 5087 __ li(a0, Operand( |
5082 ExternalReference::address_of_static_offsets_vector(isolate))); | 5088 ExternalReference::address_of_static_offsets_vector(isolate))); |
5083 __ sw(a0, MemOperand(sp, 1 * kPointerSize)); | 5089 __ sw(a0, MemOperand(sp, 1 * kPointerSize)); |
5084 | 5090 |
5085 // For arguments 4 and 3 get string length, calculate start of string data | 5091 // For arguments 4 and 3 get string length, calculate start of string data |
5086 // and calculate the shift of the index (0 for ASCII and 1 for two byte). | 5092 // and calculate the shift of the index (0 for ASCII and 1 for two byte). |
5087 __ Addu(t2, subject, Operand(SeqString::kHeaderSize - kHeapObjectTag)); | 5093 __ Addu(t2, subject, Operand(SeqString::kHeaderSize - kHeapObjectTag)); |
(...skipping 30 matching lines...) Expand all Loading... |
5118 __ LeaveExitFrame(false, no_reg); | 5124 __ LeaveExitFrame(false, no_reg); |
5119 | 5125 |
5120 // v0: result | 5126 // v0: result |
5121 // subject: subject string (callee saved) | 5127 // subject: subject string (callee saved) |
5122 // regexp_data: RegExp data (callee saved) | 5128 // regexp_data: RegExp data (callee saved) |
5123 // last_match_info_elements: Last match info elements (callee saved) | 5129 // last_match_info_elements: Last match info elements (callee saved) |
5124 | 5130 |
5125 // Check the result. | 5131 // Check the result. |
5126 | 5132 |
5127 Label success; | 5133 Label success; |
5128 __ Branch(&success, eq, v0, Operand(NativeRegExpMacroAssembler::SUCCESS)); | 5134 __ Branch(&success, eq, v0, Operand(1)); |
| 5135 // We expect exactly one result since we force the called regexp to behave |
| 5136 // as non-global. |
5129 Label failure; | 5137 Label failure; |
5130 __ Branch(&failure, eq, v0, Operand(NativeRegExpMacroAssembler::FAILURE)); | 5138 __ Branch(&failure, eq, v0, Operand(NativeRegExpMacroAssembler::FAILURE)); |
5131 // If not exception it can only be retry. Handle that in the runtime system. | 5139 // If not exception it can only be retry. Handle that in the runtime system. |
5132 __ Branch(&runtime, ne, v0, Operand(NativeRegExpMacroAssembler::EXCEPTION)); | 5140 __ Branch(&runtime, ne, v0, Operand(NativeRegExpMacroAssembler::EXCEPTION)); |
5133 // Result must now be exception. If there is no pending exception already a | 5141 // Result must now be exception. If there is no pending exception already a |
5134 // stack overflow (on the backtrack stack) was detected in RegExp code but | 5142 // stack overflow (on the backtrack stack) was detected in RegExp code but |
5135 // haven't created the exception yet. Handle that in the runtime system. | 5143 // haven't created the exception yet. Handle that in the runtime system. |
5136 // TODO(592): Rerunning the RegExp to get the stack overflow exception. | 5144 // TODO(592): Rerunning the RegExp to get the stack overflow exception. |
5137 __ li(a1, Operand(isolate->factory()->the_hole_value())); | 5145 __ li(a1, Operand(isolate->factory()->the_hole_value())); |
5138 __ li(a2, Operand(ExternalReference(Isolate::kPendingExceptionAddress, | 5146 __ li(a2, Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
(...skipping 2535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7674 __ Ret(USE_DELAY_SLOT); | 7682 __ Ret(USE_DELAY_SLOT); |
7675 __ mov(v0, a0); | 7683 __ mov(v0, a0); |
7676 } | 7684 } |
7677 | 7685 |
7678 | 7686 |
7679 #undef __ | 7687 #undef __ |
7680 | 7688 |
7681 } } // namespace v8::internal | 7689 } } // namespace v8::internal |
7682 | 7690 |
7683 #endif // V8_TARGET_ARCH_MIPS | 7691 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |