OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/log.h" | 10 #include "src/log.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 masm_(new MacroAssembler(zone->isolate(), NULL, kRegExpCodeSize)), | 139 masm_(new MacroAssembler(zone->isolate(), NULL, kRegExpCodeSize)), |
140 mode_(mode), | 140 mode_(mode), |
141 num_registers_(registers_to_save), | 141 num_registers_(registers_to_save), |
142 num_saved_registers_(registers_to_save), | 142 num_saved_registers_(registers_to_save), |
143 entry_label_(), | 143 entry_label_(), |
144 start_label_(), | 144 start_label_(), |
145 success_label_(), | 145 success_label_(), |
146 backtrack_label_(), | 146 backtrack_label_(), |
147 exit_label_(), | 147 exit_label_(), |
148 internal_failure_label_() { | 148 internal_failure_label_() { |
149 ASSERT_EQ(0, registers_to_save % 2); | 149 DCHECK_EQ(0, registers_to_save % 2); |
150 __ jmp(&entry_label_); // We'll write the entry code later. | 150 __ jmp(&entry_label_); // We'll write the entry code later. |
151 // If the code gets too big or corrupted, an internal exception will be | 151 // If the code gets too big or corrupted, an internal exception will be |
152 // raised, and we will exit right away. | 152 // raised, and we will exit right away. |
153 __ bind(&internal_failure_label_); | 153 __ bind(&internal_failure_label_); |
154 __ li(v0, Operand(FAILURE)); | 154 __ li(v0, Operand(FAILURE)); |
155 __ Ret(); | 155 __ Ret(); |
156 __ bind(&start_label_); // And then continue from here. | 156 __ bind(&start_label_); // And then continue from here. |
157 } | 157 } |
158 | 158 |
159 | 159 |
(...skipping 18 matching lines...) Expand all Loading... |
178 | 178 |
179 void RegExpMacroAssemblerMIPS::AdvanceCurrentPosition(int by) { | 179 void RegExpMacroAssemblerMIPS::AdvanceCurrentPosition(int by) { |
180 if (by != 0) { | 180 if (by != 0) { |
181 __ Daddu(current_input_offset(), | 181 __ Daddu(current_input_offset(), |
182 current_input_offset(), Operand(by * char_size())); | 182 current_input_offset(), Operand(by * char_size())); |
183 } | 183 } |
184 } | 184 } |
185 | 185 |
186 | 186 |
187 void RegExpMacroAssemblerMIPS::AdvanceRegister(int reg, int by) { | 187 void RegExpMacroAssemblerMIPS::AdvanceRegister(int reg, int by) { |
188 ASSERT(reg >= 0); | 188 DCHECK(reg >= 0); |
189 ASSERT(reg < num_registers_); | 189 DCHECK(reg < num_registers_); |
190 if (by != 0) { | 190 if (by != 0) { |
191 __ ld(a0, register_location(reg)); | 191 __ ld(a0, register_location(reg)); |
192 __ Daddu(a0, a0, Operand(by)); | 192 __ Daddu(a0, a0, Operand(by)); |
193 __ sd(a0, register_location(reg)); | 193 __ sd(a0, register_location(reg)); |
194 } | 194 } |
195 } | 195 } |
196 | 196 |
197 | 197 |
198 void RegExpMacroAssemblerMIPS::Backtrack() { | 198 void RegExpMacroAssemblerMIPS::Backtrack() { |
199 CheckPreemption(); | 199 CheckPreemption(); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 __ Branch(&loop, lt, a0, Operand(a1)); | 318 __ Branch(&loop, lt, a0, Operand(a1)); |
319 __ jmp(&success); | 319 __ jmp(&success); |
320 | 320 |
321 __ bind(&fail); | 321 __ bind(&fail); |
322 GoTo(on_no_match); | 322 GoTo(on_no_match); |
323 | 323 |
324 __ bind(&success); | 324 __ bind(&success); |
325 // Compute new value of character position after the matched part. | 325 // Compute new value of character position after the matched part. |
326 __ Dsubu(current_input_offset(), a2, end_of_input_address()); | 326 __ Dsubu(current_input_offset(), a2, end_of_input_address()); |
327 } else { | 327 } else { |
328 ASSERT(mode_ == UC16); | 328 DCHECK(mode_ == UC16); |
329 // Put regexp engine registers on stack. | 329 // Put regexp engine registers on stack. |
330 RegList regexp_registers_to_retain = current_input_offset().bit() | | 330 RegList regexp_registers_to_retain = current_input_offset().bit() | |
331 current_character().bit() | backtrack_stackpointer().bit(); | 331 current_character().bit() | backtrack_stackpointer().bit(); |
332 __ MultiPush(regexp_registers_to_retain); | 332 __ MultiPush(regexp_registers_to_retain); |
333 | 333 |
334 int argument_count = 4; | 334 int argument_count = 4; |
335 __ PrepareCallCFunction(argument_count, a2); | 335 __ PrepareCallCFunction(argument_count, a2); |
336 | 336 |
337 // a0 - offset of start of capture. | 337 // a0 - offset of start of capture. |
338 // a1 - length of capture. | 338 // a1 - length of capture. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 __ Daddu(a1, a1, Operand(a0)); | 400 __ Daddu(a1, a1, Operand(a0)); |
401 | 401 |
402 Label loop; | 402 Label loop; |
403 __ bind(&loop); | 403 __ bind(&loop); |
404 if (mode_ == ASCII) { | 404 if (mode_ == ASCII) { |
405 __ lbu(a3, MemOperand(a0, 0)); | 405 __ lbu(a3, MemOperand(a0, 0)); |
406 __ daddiu(a0, a0, char_size()); | 406 __ daddiu(a0, a0, char_size()); |
407 __ lbu(a4, MemOperand(a2, 0)); | 407 __ lbu(a4, MemOperand(a2, 0)); |
408 __ daddiu(a2, a2, char_size()); | 408 __ daddiu(a2, a2, char_size()); |
409 } else { | 409 } else { |
410 ASSERT(mode_ == UC16); | 410 DCHECK(mode_ == UC16); |
411 __ lhu(a3, MemOperand(a0, 0)); | 411 __ lhu(a3, MemOperand(a0, 0)); |
412 __ daddiu(a0, a0, char_size()); | 412 __ daddiu(a0, a0, char_size()); |
413 __ lhu(a4, MemOperand(a2, 0)); | 413 __ lhu(a4, MemOperand(a2, 0)); |
414 __ daddiu(a2, a2, char_size()); | 414 __ daddiu(a2, a2, char_size()); |
415 } | 415 } |
416 BranchOrBacktrack(on_no_match, ne, a3, Operand(a4)); | 416 BranchOrBacktrack(on_no_match, ne, a3, Operand(a4)); |
417 __ Branch(&loop, lt, a0, Operand(a1)); | 417 __ Branch(&loop, lt, a0, Operand(a1)); |
418 | 418 |
419 // Move current character position to position after match. | 419 // Move current character position to position after match. |
420 __ Dsubu(current_input_offset(), a2, end_of_input_address()); | 420 __ Dsubu(current_input_offset(), a2, end_of_input_address()); |
(...skipping 23 matching lines...) Expand all Loading... |
444 Operand rhs = (c == 0) ? Operand(zero_reg) : Operand(c); | 444 Operand rhs = (c == 0) ? Operand(zero_reg) : Operand(c); |
445 BranchOrBacktrack(on_not_equal, ne, a0, rhs); | 445 BranchOrBacktrack(on_not_equal, ne, a0, rhs); |
446 } | 446 } |
447 | 447 |
448 | 448 |
449 void RegExpMacroAssemblerMIPS::CheckNotCharacterAfterMinusAnd( | 449 void RegExpMacroAssemblerMIPS::CheckNotCharacterAfterMinusAnd( |
450 uc16 c, | 450 uc16 c, |
451 uc16 minus, | 451 uc16 minus, |
452 uc16 mask, | 452 uc16 mask, |
453 Label* on_not_equal) { | 453 Label* on_not_equal) { |
454 ASSERT(minus < String::kMaxUtf16CodeUnit); | 454 DCHECK(minus < String::kMaxUtf16CodeUnit); |
455 __ Dsubu(a0, current_character(), Operand(minus)); | 455 __ Dsubu(a0, current_character(), Operand(minus)); |
456 __ And(a0, a0, Operand(mask)); | 456 __ And(a0, a0, Operand(mask)); |
457 BranchOrBacktrack(on_not_equal, ne, a0, Operand(c)); | 457 BranchOrBacktrack(on_not_equal, ne, a0, Operand(c)); |
458 } | 458 } |
459 | 459 |
460 | 460 |
461 void RegExpMacroAssemblerMIPS::CheckCharacterInRange( | 461 void RegExpMacroAssemblerMIPS::CheckCharacterInRange( |
462 uc16 from, | 462 uc16 from, |
463 uc16 to, | 463 uc16 to, |
464 Label* on_in_range) { | 464 Label* on_in_range) { |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 __ ld(a2, MemOperand(frame_pointer(), kStartIndex)); | 744 __ ld(a2, MemOperand(frame_pointer(), kStartIndex)); |
745 __ Dsubu(a1, end_of_input_address(), a1); | 745 __ Dsubu(a1, end_of_input_address(), a1); |
746 // a1 is length of input in bytes. | 746 // a1 is length of input in bytes. |
747 if (mode_ == UC16) { | 747 if (mode_ == UC16) { |
748 __ dsrl(a1, a1, 1); | 748 __ dsrl(a1, a1, 1); |
749 } | 749 } |
750 // a1 is length of input in characters. | 750 // a1 is length of input in characters. |
751 __ Daddu(a1, a1, Operand(a2)); | 751 __ Daddu(a1, a1, Operand(a2)); |
752 // a1 is length of string in characters. | 752 // a1 is length of string in characters. |
753 | 753 |
754 ASSERT_EQ(0, num_saved_registers_ % 2); | 754 DCHECK_EQ(0, num_saved_registers_ % 2); |
755 // Always an even number of capture registers. This allows us to | 755 // Always an even number of capture registers. This allows us to |
756 // unroll the loop once to add an operation between a load of a register | 756 // unroll the loop once to add an operation between a load of a register |
757 // and the following use of that register. | 757 // and the following use of that register. |
758 for (int i = 0; i < num_saved_registers_; i += 2) { | 758 for (int i = 0; i < num_saved_registers_; i += 2) { |
759 __ ld(a2, register_location(i)); | 759 __ ld(a2, register_location(i)); |
760 __ ld(a3, register_location(i + 1)); | 760 __ ld(a3, register_location(i + 1)); |
761 if (i == 0 && global_with_zero_length_check()) { | 761 if (i == 0 && global_with_zero_length_check()) { |
762 // Keep capture start in a4 for the zero-length check later. | 762 // Keep capture start in a4 for the zero-length check later. |
763 __ mov(t3, a2); | 763 __ mov(t3, a2); |
764 } | 764 } |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 RegExpMacroAssembler::IrregexpImplementation | 947 RegExpMacroAssembler::IrregexpImplementation |
948 RegExpMacroAssemblerMIPS::Implementation() { | 948 RegExpMacroAssemblerMIPS::Implementation() { |
949 return kMIPSImplementation; | 949 return kMIPSImplementation; |
950 } | 950 } |
951 | 951 |
952 | 952 |
953 void RegExpMacroAssemblerMIPS::LoadCurrentCharacter(int cp_offset, | 953 void RegExpMacroAssemblerMIPS::LoadCurrentCharacter(int cp_offset, |
954 Label* on_end_of_input, | 954 Label* on_end_of_input, |
955 bool check_bounds, | 955 bool check_bounds, |
956 int characters) { | 956 int characters) { |
957 ASSERT(cp_offset >= -1); // ^ and \b can look behind one character. | 957 DCHECK(cp_offset >= -1); // ^ and \b can look behind one character. |
958 ASSERT(cp_offset < (1<<30)); // Be sane! (And ensure negation works). | 958 DCHECK(cp_offset < (1<<30)); // Be sane! (And ensure negation works). |
959 if (check_bounds) { | 959 if (check_bounds) { |
960 CheckPosition(cp_offset + characters - 1, on_end_of_input); | 960 CheckPosition(cp_offset + characters - 1, on_end_of_input); |
961 } | 961 } |
962 LoadCurrentCharacterUnchecked(cp_offset, characters); | 962 LoadCurrentCharacterUnchecked(cp_offset, characters); |
963 } | 963 } |
964 | 964 |
965 | 965 |
966 void RegExpMacroAssemblerMIPS::PopCurrentPosition() { | 966 void RegExpMacroAssemblerMIPS::PopCurrentPosition() { |
967 Pop(current_input_offset()); | 967 Pop(current_input_offset()); |
968 } | 968 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 __ li(current_input_offset(), -by * char_size()); | 1033 __ li(current_input_offset(), -by * char_size()); |
1034 // On RegExp code entry (where this operation is used), the character before | 1034 // On RegExp code entry (where this operation is used), the character before |
1035 // the current position is expected to be already loaded. | 1035 // the current position is expected to be already loaded. |
1036 // We have advanced the position, so it's safe to read backwards. | 1036 // We have advanced the position, so it's safe to read backwards. |
1037 LoadCurrentCharacterUnchecked(-1, 1); | 1037 LoadCurrentCharacterUnchecked(-1, 1); |
1038 __ bind(&after_position); | 1038 __ bind(&after_position); |
1039 } | 1039 } |
1040 | 1040 |
1041 | 1041 |
1042 void RegExpMacroAssemblerMIPS::SetRegister(int register_index, int to) { | 1042 void RegExpMacroAssemblerMIPS::SetRegister(int register_index, int to) { |
1043 ASSERT(register_index >= num_saved_registers_); // Reserved for positions! | 1043 DCHECK(register_index >= num_saved_registers_); // Reserved for positions! |
1044 __ li(a0, Operand(to)); | 1044 __ li(a0, Operand(to)); |
1045 __ sd(a0, register_location(register_index)); | 1045 __ sd(a0, register_location(register_index)); |
1046 } | 1046 } |
1047 | 1047 |
1048 | 1048 |
1049 bool RegExpMacroAssemblerMIPS::Succeed() { | 1049 bool RegExpMacroAssemblerMIPS::Succeed() { |
1050 __ jmp(&success_label_); | 1050 __ jmp(&success_label_); |
1051 return global(); | 1051 return global(); |
1052 } | 1052 } |
1053 | 1053 |
1054 | 1054 |
1055 void RegExpMacroAssemblerMIPS::WriteCurrentPositionToRegister(int reg, | 1055 void RegExpMacroAssemblerMIPS::WriteCurrentPositionToRegister(int reg, |
1056 int cp_offset) { | 1056 int cp_offset) { |
1057 if (cp_offset == 0) { | 1057 if (cp_offset == 0) { |
1058 __ sd(current_input_offset(), register_location(reg)); | 1058 __ sd(current_input_offset(), register_location(reg)); |
1059 } else { | 1059 } else { |
1060 __ Daddu(a0, current_input_offset(), Operand(cp_offset * char_size())); | 1060 __ Daddu(a0, current_input_offset(), Operand(cp_offset * char_size())); |
1061 __ sd(a0, register_location(reg)); | 1061 __ sd(a0, register_location(reg)); |
1062 } | 1062 } |
1063 } | 1063 } |
1064 | 1064 |
1065 | 1065 |
1066 void RegExpMacroAssemblerMIPS::ClearRegisters(int reg_from, int reg_to) { | 1066 void RegExpMacroAssemblerMIPS::ClearRegisters(int reg_from, int reg_to) { |
1067 ASSERT(reg_from <= reg_to); | 1067 DCHECK(reg_from <= reg_to); |
1068 __ ld(a0, MemOperand(frame_pointer(), kInputStartMinusOne)); | 1068 __ ld(a0, MemOperand(frame_pointer(), kInputStartMinusOne)); |
1069 for (int reg = reg_from; reg <= reg_to; reg++) { | 1069 for (int reg = reg_from; reg <= reg_to; reg++) { |
1070 __ sd(a0, register_location(reg)); | 1070 __ sd(a0, register_location(reg)); |
1071 } | 1071 } |
1072 } | 1072 } |
1073 | 1073 |
1074 | 1074 |
1075 void RegExpMacroAssemblerMIPS::WriteStackPointerToRegister(int reg) { | 1075 void RegExpMacroAssemblerMIPS::WriteStackPointerToRegister(int reg) { |
1076 __ ld(a1, MemOperand(frame_pointer(), kStackHighEnd)); | 1076 __ ld(a1, MemOperand(frame_pointer(), kStackHighEnd)); |
1077 __ Dsubu(a0, backtrack_stackpointer(), a1); | 1077 __ Dsubu(a0, backtrack_stackpointer(), a1); |
1078 __ sd(a0, register_location(reg)); | 1078 __ sd(a0, register_location(reg)); |
1079 } | 1079 } |
1080 | 1080 |
1081 | 1081 |
1082 bool RegExpMacroAssemblerMIPS::CanReadUnaligned() { | 1082 bool RegExpMacroAssemblerMIPS::CanReadUnaligned() { |
1083 return false; | 1083 return false; |
1084 } | 1084 } |
1085 | 1085 |
1086 | 1086 |
1087 // Private methods: | 1087 // Private methods: |
1088 | 1088 |
1089 void RegExpMacroAssemblerMIPS::CallCheckStackGuardState(Register scratch) { | 1089 void RegExpMacroAssemblerMIPS::CallCheckStackGuardState(Register scratch) { |
1090 int stack_alignment = base::OS::ActivationFrameAlignment(); | 1090 int stack_alignment = base::OS::ActivationFrameAlignment(); |
1091 | 1091 |
1092 // Align the stack pointer and save the original sp value on the stack. | 1092 // Align the stack pointer and save the original sp value on the stack. |
1093 __ mov(scratch, sp); | 1093 __ mov(scratch, sp); |
1094 __ Dsubu(sp, sp, Operand(kPointerSize)); | 1094 __ Dsubu(sp, sp, Operand(kPointerSize)); |
1095 ASSERT(IsPowerOf2(stack_alignment)); | 1095 DCHECK(IsPowerOf2(stack_alignment)); |
1096 __ And(sp, sp, Operand(-stack_alignment)); | 1096 __ And(sp, sp, Operand(-stack_alignment)); |
1097 __ sd(scratch, MemOperand(sp)); | 1097 __ sd(scratch, MemOperand(sp)); |
1098 | 1098 |
1099 __ mov(a2, frame_pointer()); | 1099 __ mov(a2, frame_pointer()); |
1100 // Code* of self. | 1100 // Code* of self. |
1101 __ li(a1, Operand(masm_->CodeObject()), CONSTANT_SIZE); | 1101 __ li(a1, Operand(masm_->CodeObject()), CONSTANT_SIZE); |
1102 | 1102 |
1103 // We need to make room for the return address on the stack. | 1103 // We need to make room for the return address on the stack. |
1104 ASSERT(IsAligned(stack_alignment, kPointerSize)); | 1104 DCHECK(IsAligned(stack_alignment, kPointerSize)); |
1105 __ Dsubu(sp, sp, Operand(stack_alignment)); | 1105 __ Dsubu(sp, sp, Operand(stack_alignment)); |
1106 | 1106 |
1107 // Stack pointer now points to cell where return address is to be written. | 1107 // Stack pointer now points to cell where return address is to be written. |
1108 // Arguments are in registers, meaning we teat the return address as | 1108 // Arguments are in registers, meaning we teat the return address as |
1109 // argument 5. Since DirectCEntryStub will handleallocating space for the C | 1109 // argument 5. Since DirectCEntryStub will handleallocating space for the C |
1110 // argument slots, we don't need to care about that here. This is how the | 1110 // argument slots, we don't need to care about that here. This is how the |
1111 // stack will look (sp meaning the value of sp at this moment): | 1111 // stack will look (sp meaning the value of sp at this moment): |
1112 // [sp + 3] - empty slot if needed for alignment. | 1112 // [sp + 3] - empty slot if needed for alignment. |
1113 // [sp + 2] - saved sp. | 1113 // [sp + 2] - saved sp. |
1114 // [sp + 1] - second word reserved for return value. | 1114 // [sp + 1] - second word reserved for return value. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 } | 1167 } |
1168 | 1168 |
1169 // Prepare for possible GC. | 1169 // Prepare for possible GC. |
1170 HandleScope handles(isolate); | 1170 HandleScope handles(isolate); |
1171 Handle<Code> code_handle(re_code); | 1171 Handle<Code> code_handle(re_code); |
1172 | 1172 |
1173 Handle<String> subject(frame_entry<String*>(re_frame, kInputString)); | 1173 Handle<String> subject(frame_entry<String*>(re_frame, kInputString)); |
1174 // Current string. | 1174 // Current string. |
1175 bool is_ascii = subject->IsOneByteRepresentationUnderneath(); | 1175 bool is_ascii = subject->IsOneByteRepresentationUnderneath(); |
1176 | 1176 |
1177 ASSERT(re_code->instruction_start() <= *return_address); | 1177 DCHECK(re_code->instruction_start() <= *return_address); |
1178 ASSERT(*return_address <= | 1178 DCHECK(*return_address <= |
1179 re_code->instruction_start() + re_code->instruction_size()); | 1179 re_code->instruction_start() + re_code->instruction_size()); |
1180 | 1180 |
1181 Object* result = isolate->stack_guard()->HandleInterrupts(); | 1181 Object* result = isolate->stack_guard()->HandleInterrupts(); |
1182 | 1182 |
1183 if (*code_handle != re_code) { // Return address no longer valid. | 1183 if (*code_handle != re_code) { // Return address no longer valid. |
1184 int delta = code_handle->address() - re_code->address(); | 1184 int delta = code_handle->address() - re_code->address(); |
1185 // Overwrite the return address on the stack. | 1185 // Overwrite the return address on the stack. |
1186 *return_address += delta; | 1186 *return_address += delta; |
1187 } | 1187 } |
1188 | 1188 |
(...skipping 18 matching lines...) Expand all Loading... |
1207 // If we changed between an ASCII and an UC16 string, the specialized | 1207 // If we changed between an ASCII and an UC16 string, the specialized |
1208 // code cannot be used, and we need to restart regexp matching from | 1208 // code cannot be used, and we need to restart regexp matching from |
1209 // scratch (including, potentially, compiling a new version of the code). | 1209 // scratch (including, potentially, compiling a new version of the code). |
1210 return RETRY; | 1210 return RETRY; |
1211 } | 1211 } |
1212 | 1212 |
1213 // Otherwise, the content of the string might have moved. It must still | 1213 // Otherwise, the content of the string might have moved. It must still |
1214 // be a sequential or external string with the same content. | 1214 // be a sequential or external string with the same content. |
1215 // Update the start and end pointers in the stack frame to the current | 1215 // Update the start and end pointers in the stack frame to the current |
1216 // location (whether it has actually moved or not). | 1216 // location (whether it has actually moved or not). |
1217 ASSERT(StringShape(*subject_tmp).IsSequential() || | 1217 DCHECK(StringShape(*subject_tmp).IsSequential() || |
1218 StringShape(*subject_tmp).IsExternal()); | 1218 StringShape(*subject_tmp).IsExternal()); |
1219 | 1219 |
1220 // The original start address of the characters to match. | 1220 // The original start address of the characters to match. |
1221 const byte* start_address = frame_entry<const byte*>(re_frame, kInputStart); | 1221 const byte* start_address = frame_entry<const byte*>(re_frame, kInputStart); |
1222 | 1222 |
1223 // Find the current start address of the same character at the current string | 1223 // Find the current start address of the same character at the current string |
1224 // position. | 1224 // position. |
1225 int start_index = frame_entry<int>(re_frame, kStartIndex); | 1225 int start_index = frame_entry<int>(re_frame, kStartIndex); |
1226 const byte* new_address = StringCharacterPosition(*subject_tmp, | 1226 const byte* new_address = StringCharacterPosition(*subject_tmp, |
1227 start_index + slice_offset); | 1227 start_index + slice_offset); |
(...skipping 11 matching lines...) Expand all Loading... |
1239 // short-circuiting during GC. That will not change start_address but | 1239 // short-circuiting during GC. That will not change start_address but |
1240 // will change pointer inside the subject handle. | 1240 // will change pointer inside the subject handle. |
1241 frame_entry<const String*>(re_frame, kInputString) = *subject; | 1241 frame_entry<const String*>(re_frame, kInputString) = *subject; |
1242 } | 1242 } |
1243 | 1243 |
1244 return 0; | 1244 return 0; |
1245 } | 1245 } |
1246 | 1246 |
1247 | 1247 |
1248 MemOperand RegExpMacroAssemblerMIPS::register_location(int register_index) { | 1248 MemOperand RegExpMacroAssemblerMIPS::register_location(int register_index) { |
1249 ASSERT(register_index < (1<<30)); | 1249 DCHECK(register_index < (1<<30)); |
1250 if (num_registers_ <= register_index) { | 1250 if (num_registers_ <= register_index) { |
1251 num_registers_ = register_index + 1; | 1251 num_registers_ = register_index + 1; |
1252 } | 1252 } |
1253 return MemOperand(frame_pointer(), | 1253 return MemOperand(frame_pointer(), |
1254 kRegisterZero - register_index * kPointerSize); | 1254 kRegisterZero - register_index * kPointerSize); |
1255 } | 1255 } |
1256 | 1256 |
1257 | 1257 |
1258 void RegExpMacroAssemblerMIPS::CheckPosition(int cp_offset, | 1258 void RegExpMacroAssemblerMIPS::CheckPosition(int cp_offset, |
1259 Label* on_outside_input) { | 1259 Label* on_outside_input) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 | 1300 |
1301 | 1301 |
1302 void RegExpMacroAssemblerMIPS::SafeCallTarget(Label* name) { | 1302 void RegExpMacroAssemblerMIPS::SafeCallTarget(Label* name) { |
1303 __ bind(name); | 1303 __ bind(name); |
1304 __ Dsubu(ra, ra, Operand(masm_->CodeObject())); | 1304 __ Dsubu(ra, ra, Operand(masm_->CodeObject())); |
1305 __ push(ra); | 1305 __ push(ra); |
1306 } | 1306 } |
1307 | 1307 |
1308 | 1308 |
1309 void RegExpMacroAssemblerMIPS::Push(Register source) { | 1309 void RegExpMacroAssemblerMIPS::Push(Register source) { |
1310 ASSERT(!source.is(backtrack_stackpointer())); | 1310 DCHECK(!source.is(backtrack_stackpointer())); |
1311 __ Daddu(backtrack_stackpointer(), | 1311 __ Daddu(backtrack_stackpointer(), |
1312 backtrack_stackpointer(), | 1312 backtrack_stackpointer(), |
1313 Operand(-kIntSize)); | 1313 Operand(-kIntSize)); |
1314 __ sw(source, MemOperand(backtrack_stackpointer())); | 1314 __ sw(source, MemOperand(backtrack_stackpointer())); |
1315 } | 1315 } |
1316 | 1316 |
1317 | 1317 |
1318 void RegExpMacroAssemblerMIPS::Pop(Register target) { | 1318 void RegExpMacroAssemblerMIPS::Pop(Register target) { |
1319 ASSERT(!target.is(backtrack_stackpointer())); | 1319 DCHECK(!target.is(backtrack_stackpointer())); |
1320 __ lw(target, MemOperand(backtrack_stackpointer())); | 1320 __ lw(target, MemOperand(backtrack_stackpointer())); |
1321 __ Daddu(backtrack_stackpointer(), backtrack_stackpointer(), kIntSize); | 1321 __ Daddu(backtrack_stackpointer(), backtrack_stackpointer(), kIntSize); |
1322 } | 1322 } |
1323 | 1323 |
1324 | 1324 |
1325 void RegExpMacroAssemblerMIPS::CheckPreemption() { | 1325 void RegExpMacroAssemblerMIPS::CheckPreemption() { |
1326 // Check for preemption. | 1326 // Check for preemption. |
1327 ExternalReference stack_limit = | 1327 ExternalReference stack_limit = |
1328 ExternalReference::address_of_stack_limit(masm_->isolate()); | 1328 ExternalReference::address_of_stack_limit(masm_->isolate()); |
1329 __ li(a0, Operand(stack_limit)); | 1329 __ li(a0, Operand(stack_limit)); |
(...skipping 15 matching lines...) Expand all Loading... |
1345 void RegExpMacroAssemblerMIPS::LoadCurrentCharacterUnchecked(int cp_offset, | 1345 void RegExpMacroAssemblerMIPS::LoadCurrentCharacterUnchecked(int cp_offset, |
1346 int characters) { | 1346 int characters) { |
1347 Register offset = current_input_offset(); | 1347 Register offset = current_input_offset(); |
1348 if (cp_offset != 0) { | 1348 if (cp_offset != 0) { |
1349 // t3 is not being used to store the capture start index at this point. | 1349 // t3 is not being used to store the capture start index at this point. |
1350 __ Daddu(t3, current_input_offset(), Operand(cp_offset * char_size())); | 1350 __ Daddu(t3, current_input_offset(), Operand(cp_offset * char_size())); |
1351 offset = t3; | 1351 offset = t3; |
1352 } | 1352 } |
1353 // We assume that we cannot do unaligned loads on MIPS, so this function | 1353 // We assume that we cannot do unaligned loads on MIPS, so this function |
1354 // must only be used to load a single character at a time. | 1354 // must only be used to load a single character at a time. |
1355 ASSERT(characters == 1); | 1355 DCHECK(characters == 1); |
1356 __ Daddu(t1, end_of_input_address(), Operand(offset)); | 1356 __ Daddu(t1, end_of_input_address(), Operand(offset)); |
1357 if (mode_ == ASCII) { | 1357 if (mode_ == ASCII) { |
1358 __ lbu(current_character(), MemOperand(t1, 0)); | 1358 __ lbu(current_character(), MemOperand(t1, 0)); |
1359 } else { | 1359 } else { |
1360 ASSERT(mode_ == UC16); | 1360 DCHECK(mode_ == UC16); |
1361 __ lhu(current_character(), MemOperand(t1, 0)); | 1361 __ lhu(current_character(), MemOperand(t1, 0)); |
1362 } | 1362 } |
1363 } | 1363 } |
1364 | 1364 |
1365 #undef __ | 1365 #undef __ |
1366 | 1366 |
1367 #endif // V8_INTERPRETED_REGEXP | 1367 #endif // V8_INTERPRETED_REGEXP |
1368 | 1368 |
1369 }} // namespace v8::internal | 1369 }} // namespace v8::internal |
1370 | 1370 |
1371 #endif // V8_TARGET_ARCH_MIPS64 | 1371 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |