| 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 #if V8_TARGET_ARCH_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
| 6 | 6 |
| 7 #include "src/regexp/mips/regexp-macro-assembler-mips.h" | 7 #include "src/regexp/mips/regexp-macro-assembler-mips.h" |
| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 BranchOrBacktrack(on_equal, eq, current_character(), Operand(c)); | 174 BranchOrBacktrack(on_equal, eq, current_character(), Operand(c)); |
| 175 } | 175 } |
| 176 | 176 |
| 177 | 177 |
| 178 void RegExpMacroAssemblerMIPS::CheckCharacterGT(uc16 limit, Label* on_greater) { | 178 void RegExpMacroAssemblerMIPS::CheckCharacterGT(uc16 limit, Label* on_greater) { |
| 179 BranchOrBacktrack(on_greater, gt, current_character(), Operand(limit)); | 179 BranchOrBacktrack(on_greater, gt, current_character(), Operand(limit)); |
| 180 } | 180 } |
| 181 | 181 |
| 182 | 182 |
| 183 void RegExpMacroAssemblerMIPS::CheckAtStart(Label* on_at_start) { | 183 void RegExpMacroAssemblerMIPS::CheckAtStart(Label* on_at_start) { |
| 184 Label not_at_start; | 184 __ Addu(a0, end_of_input_address(), Operand(current_input_offset())); |
| 185 // Did we start the match at the start of the string at all? | 185 __ lw(a1, MemOperand(frame_pointer(), kStartIndex)); |
| 186 __ lw(a0, MemOperand(frame_pointer(), kStartIndex)); | 186 for (int i = 0; i < char_size(); i++) { |
| 187 BranchOrBacktrack(¬_at_start, ne, a0, Operand(zero_reg)); | 187 __ Addu(a0, a0, Operand(a1)); |
| 188 | 188 } |
| 189 // If we did, are we still at the start of the input? | |
| 190 __ lw(a1, MemOperand(frame_pointer(), kInputStart)); | 189 __ lw(a1, MemOperand(frame_pointer(), kInputStart)); |
| 191 __ Addu(a0, end_of_input_address(), Operand(current_input_offset())); | |
| 192 BranchOrBacktrack(on_at_start, eq, a0, Operand(a1)); | 190 BranchOrBacktrack(on_at_start, eq, a0, Operand(a1)); |
| 193 __ bind(¬_at_start); | |
| 194 } | 191 } |
| 195 | 192 |
| 196 | 193 |
| 197 void RegExpMacroAssemblerMIPS::CheckNotAtStart(Label* on_not_at_start) { | 194 void RegExpMacroAssemblerMIPS::CheckNotAtStart(int cp_offset, |
| 198 // Did we start the match at the start of the string at all? | 195 Label* on_not_at_start) { |
| 199 __ lw(a0, MemOperand(frame_pointer(), kStartIndex)); | 196 __ Addu(a0, end_of_input_address(), Operand(current_input_offset())); |
| 200 BranchOrBacktrack(on_not_at_start, ne, a0, Operand(zero_reg)); | 197 __ Addu(a0, a0, Operand(cp_offset * char_size())); |
| 201 // If we did, are we still at the start of the input? | 198 __ lw(a1, MemOperand(frame_pointer(), kStartIndex)); |
| 199 for (int i = 0; i < char_size(); i++) { |
| 200 __ Addu(a0, a0, Operand(a1)); |
| 201 } |
| 202 __ lw(a1, MemOperand(frame_pointer(), kInputStart)); | 202 __ lw(a1, MemOperand(frame_pointer(), kInputStart)); |
| 203 __ Addu(a0, end_of_input_address(), Operand(current_input_offset())); | |
| 204 BranchOrBacktrack(on_not_at_start, ne, a0, Operand(a1)); | 203 BranchOrBacktrack(on_not_at_start, ne, a0, Operand(a1)); |
| 205 } | 204 } |
| 206 | 205 |
| 207 | 206 |
| 208 void RegExpMacroAssemblerMIPS::CheckCharacterLT(uc16 limit, Label* on_less) { | 207 void RegExpMacroAssemblerMIPS::CheckCharacterLT(uc16 limit, Label* on_less) { |
| 209 BranchOrBacktrack(on_less, lt, current_character(), Operand(limit)); | 208 BranchOrBacktrack(on_less, lt, current_character(), Operand(limit)); |
| 210 } | 209 } |
| 211 | 210 |
| 212 | 211 |
| 213 void RegExpMacroAssemblerMIPS::CheckGreedyLoop(Label* on_equal) { | 212 void RegExpMacroAssemblerMIPS::CheckGreedyLoop(Label* on_equal) { |
| 214 Label backtrack_non_equal; | 213 Label backtrack_non_equal; |
| 215 __ lw(a0, MemOperand(backtrack_stackpointer(), 0)); | 214 __ lw(a0, MemOperand(backtrack_stackpointer(), 0)); |
| 216 __ Branch(&backtrack_non_equal, ne, current_input_offset(), Operand(a0)); | 215 __ Branch(&backtrack_non_equal, ne, current_input_offset(), Operand(a0)); |
| 217 __ Addu(backtrack_stackpointer(), | 216 __ Addu(backtrack_stackpointer(), |
| 218 backtrack_stackpointer(), | 217 backtrack_stackpointer(), |
| 219 Operand(kPointerSize)); | 218 Operand(kPointerSize)); |
| 220 __ bind(&backtrack_non_equal); | 219 __ bind(&backtrack_non_equal); |
| 221 BranchOrBacktrack(on_equal, eq, current_input_offset(), Operand(a0)); | 220 BranchOrBacktrack(on_equal, eq, current_input_offset(), Operand(a0)); |
| 222 } | 221 } |
| 223 | 222 |
| 224 | 223 |
| 225 void RegExpMacroAssemblerMIPS::CheckNotBackReferenceIgnoreCase( | 224 void RegExpMacroAssemblerMIPS::CheckNotBackReferenceIgnoreCase( |
| 226 int start_reg, | 225 int start_reg, bool read_backward, Label* on_no_match) { |
| 227 Label* on_no_match) { | |
| 228 Label fallthrough; | 226 Label fallthrough; |
| 229 __ lw(a0, register_location(start_reg)); // Index of start of capture. | 227 __ lw(a0, register_location(start_reg)); // Index of start of capture. |
| 230 __ lw(a1, register_location(start_reg + 1)); // Index of end of capture. | 228 __ lw(a1, register_location(start_reg + 1)); // Index of end of capture. |
| 231 __ Subu(a1, a1, a0); // Length of capture. | 229 __ Subu(a1, a1, a0); // Length of capture. |
| 232 | 230 |
| 233 // If length is zero, either the capture is empty or it is not participating. | 231 // The length of the capture can only be negative if the end of the |
| 234 // In either case succeed immediately. | 232 // capture is not yet recorded. If the length is zero, the capture is |
| 235 __ Branch(&fallthrough, eq, a1, Operand(zero_reg)); | 233 // either empty or uncaptured. In either of those cases, succeed. |
| 234 __ Branch(&fallthrough, le, a1, Operand(zero_reg)); |
| 236 | 235 |
| 237 __ Addu(t5, a1, current_input_offset()); | 236 if (read_backward) { |
| 238 // Check that there are enough characters left in the input. | 237 __ Addu(t5, end_of_input_address(), Operand(current_input_offset())); |
| 239 BranchOrBacktrack(on_no_match, gt, t5, Operand(zero_reg)); | 238 __ lw(t0, MemOperand(frame_pointer(), kStartIndex)); |
| 239 for (int i = 0; i < char_size(); i++) { |
| 240 __ Addu(t5, t5, Operand(t0)); |
| 241 } |
| 242 __ lw(t0, MemOperand(frame_pointer(), kInputStart)); |
| 243 BranchOrBacktrack(on_no_match, lt, t5, Operand(t0)); |
| 244 } else { |
| 245 __ Addu(t5, a1, current_input_offset()); |
| 246 // Check that there are enough characters left in the input. |
| 247 BranchOrBacktrack(on_no_match, gt, t5, Operand(zero_reg)); |
| 248 } |
| 240 | 249 |
| 241 if (mode_ == LATIN1) { | 250 if (mode_ == LATIN1) { |
| 242 Label success; | 251 Label success; |
| 243 Label fail; | 252 Label fail; |
| 244 Label loop_check; | 253 Label loop_check; |
| 245 | 254 |
| 246 // a0 - offset of start of capture. | 255 // a0 - offset of start of capture. |
| 247 // a1 - length of capture. | 256 // a1 - length of capture. |
| 248 __ Addu(a0, a0, Operand(end_of_input_address())); | 257 __ Addu(a0, a0, Operand(end_of_input_address())); |
| 249 __ Addu(a2, end_of_input_address(), Operand(current_input_offset())); | 258 __ Addu(a2, end_of_input_address(), Operand(current_input_offset())); |
| 259 if (read_backward) { |
| 260 __ Subu(a2, a2, Operand(a1)); |
| 261 } |
| 250 __ Addu(a1, a0, Operand(a1)); | 262 __ Addu(a1, a0, Operand(a1)); |
| 251 | 263 |
| 252 // a0 - Address of start of capture. | 264 // a0 - Address of start of capture. |
| 253 // a1 - Address of end of capture. | 265 // a1 - Address of end of capture. |
| 254 // a2 - Address of current input position. | 266 // a2 - Address of current input position. |
| 255 | 267 |
| 256 Label loop; | 268 Label loop; |
| 257 __ bind(&loop); | 269 __ bind(&loop); |
| 258 __ lbu(a3, MemOperand(a0, 0)); | 270 __ lbu(a3, MemOperand(a0, 0)); |
| 259 __ addiu(a0, a0, char_size()); | 271 __ addiu(a0, a0, char_size()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 278 __ bind(&loop_check); | 290 __ bind(&loop_check); |
| 279 __ Branch(&loop, lt, a0, Operand(a1)); | 291 __ Branch(&loop, lt, a0, Operand(a1)); |
| 280 __ jmp(&success); | 292 __ jmp(&success); |
| 281 | 293 |
| 282 __ bind(&fail); | 294 __ bind(&fail); |
| 283 GoTo(on_no_match); | 295 GoTo(on_no_match); |
| 284 | 296 |
| 285 __ bind(&success); | 297 __ bind(&success); |
| 286 // Compute new value of character position after the matched part. | 298 // Compute new value of character position after the matched part. |
| 287 __ Subu(current_input_offset(), a2, end_of_input_address()); | 299 __ Subu(current_input_offset(), a2, end_of_input_address()); |
| 300 if (read_backward) { |
| 301 __ lw(t0, register_location(start_reg)); // Index of start of capture. |
| 302 __ lw(t5, register_location(start_reg + 1)); // Index of end of capture. |
| 303 __ Addu(current_input_offset(), current_input_offset(), Operand(t0)); |
| 304 __ Subu(current_input_offset(), current_input_offset(), Operand(t5)); |
| 305 } |
| 288 } else { | 306 } else { |
| 289 DCHECK(mode_ == UC16); | 307 DCHECK(mode_ == UC16); |
| 290 // Put regexp engine registers on stack. | 308 // Put regexp engine registers on stack. |
| 291 RegList regexp_registers_to_retain = current_input_offset().bit() | | 309 RegList regexp_registers_to_retain = current_input_offset().bit() | |
| 292 current_character().bit() | backtrack_stackpointer().bit(); | 310 current_character().bit() | backtrack_stackpointer().bit(); |
| 293 __ MultiPush(regexp_registers_to_retain); | 311 __ MultiPush(regexp_registers_to_retain); |
| 294 | 312 |
| 295 int argument_count = 4; | 313 int argument_count = 4; |
| 296 __ PrepareCallCFunction(argument_count, a2); | 314 __ PrepareCallCFunction(argument_count, a2); |
| 297 | 315 |
| 298 // a0 - offset of start of capture. | 316 // a0 - offset of start of capture. |
| 299 // a1 - length of capture. | 317 // a1 - length of capture. |
| 300 | 318 |
| 301 // Put arguments into arguments registers. | 319 // Put arguments into arguments registers. |
| 302 // Parameters are | 320 // Parameters are |
| 303 // a0: Address byte_offset1 - Address captured substring's start. | 321 // a0: Address byte_offset1 - Address captured substring's start. |
| 304 // a1: Address byte_offset2 - Address of current character position. | 322 // a1: Address byte_offset2 - Address of current character position. |
| 305 // a2: size_t byte_length - length of capture in bytes(!). | 323 // a2: size_t byte_length - length of capture in bytes(!). |
| 306 // a3: Isolate* isolate. | 324 // a3: Isolate* isolate. |
| 307 | 325 |
| 308 // Address of start of capture. | 326 // Address of start of capture. |
| 309 __ Addu(a0, a0, Operand(end_of_input_address())); | 327 __ Addu(a0, a0, Operand(end_of_input_address())); |
| 310 // Length of capture. | 328 // Length of capture. |
| 311 __ mov(a2, a1); | 329 __ mov(a2, a1); |
| 312 // Save length in callee-save register for use on return. | 330 // Save length in callee-save register for use on return. |
| 313 __ mov(s3, a1); | 331 __ mov(s3, a1); |
| 314 // Address of current input position. | 332 // Address of current input position. |
| 315 __ Addu(a1, current_input_offset(), Operand(end_of_input_address())); | 333 __ Addu(a1, current_input_offset(), Operand(end_of_input_address())); |
| 334 if (read_backward) { |
| 335 __ Subu(a1, a1, Operand(s3)); |
| 336 } |
| 316 // Isolate. | 337 // Isolate. |
| 317 __ li(a3, Operand(ExternalReference::isolate_address(masm_->isolate()))); | 338 __ li(a3, Operand(ExternalReference::isolate_address(masm_->isolate()))); |
| 318 | 339 |
| 319 { | 340 { |
| 320 AllowExternalCallThatCantCauseGC scope(masm_); | 341 AllowExternalCallThatCantCauseGC scope(masm_); |
| 321 ExternalReference function = | 342 ExternalReference function = |
| 322 ExternalReference::re_case_insensitive_compare_uc16(masm_->isolate()); | 343 ExternalReference::re_case_insensitive_compare_uc16(masm_->isolate()); |
| 323 __ CallCFunction(function, argument_count); | 344 __ CallCFunction(function, argument_count); |
| 324 } | 345 } |
| 325 | 346 |
| 326 // Restore regexp engine registers. | 347 // Restore regexp engine registers. |
| 327 __ MultiPop(regexp_registers_to_retain); | 348 __ MultiPop(regexp_registers_to_retain); |
| 328 __ li(code_pointer(), Operand(masm_->CodeObject()), CONSTANT_SIZE); | 349 __ li(code_pointer(), Operand(masm_->CodeObject()), CONSTANT_SIZE); |
| 329 __ lw(end_of_input_address(), MemOperand(frame_pointer(), kInputEnd)); | 350 __ lw(end_of_input_address(), MemOperand(frame_pointer(), kInputEnd)); |
| 330 | 351 |
| 331 // Check if function returned non-zero for success or zero for failure. | 352 // Check if function returned non-zero for success or zero for failure. |
| 332 BranchOrBacktrack(on_no_match, eq, v0, Operand(zero_reg)); | 353 BranchOrBacktrack(on_no_match, eq, v0, Operand(zero_reg)); |
| 333 // On success, increment position by length of capture. | 354 // On success, advance position by length of capture. |
| 334 __ Addu(current_input_offset(), current_input_offset(), Operand(s3)); | 355 if (read_backward) { |
| 356 __ Subu(current_input_offset(), current_input_offset(), Operand(s3)); |
| 357 } else { |
| 358 __ Addu(current_input_offset(), current_input_offset(), Operand(s3)); |
| 359 } |
| 335 } | 360 } |
| 336 | 361 |
| 337 __ bind(&fallthrough); | 362 __ bind(&fallthrough); |
| 338 } | 363 } |
| 339 | 364 |
| 340 | 365 |
| 341 void RegExpMacroAssemblerMIPS::CheckNotBackReference( | 366 void RegExpMacroAssemblerMIPS::CheckNotBackReference(int start_reg, |
| 342 int start_reg, | 367 bool read_backward, |
| 343 Label* on_no_match) { | 368 Label* on_no_match) { |
| 344 Label fallthrough; | 369 Label fallthrough; |
| 345 Label success; | 370 Label success; |
| 346 | 371 |
| 347 // Find length of back-referenced capture. | 372 // Find length of back-referenced capture. |
| 348 __ lw(a0, register_location(start_reg)); | 373 __ lw(a0, register_location(start_reg)); |
| 349 __ lw(a1, register_location(start_reg + 1)); | 374 __ lw(a1, register_location(start_reg + 1)); |
| 350 __ Subu(a1, a1, a0); // Length to check. | 375 __ Subu(a1, a1, a0); // Length to check. |
| 351 // Succeed on empty capture (including no capture). | 376 // The length of the capture can only be negative if the end of the |
| 352 __ Branch(&fallthrough, eq, a1, Operand(zero_reg)); | 377 // capture is not yet recorded. If the length is zero, the capture is |
| 378 // either empty or uncaptured. In either of those cases, succeed. |
| 379 __ Branch(&fallthrough, le, a1, Operand(zero_reg)); |
| 353 | 380 |
| 354 __ Addu(t5, a1, current_input_offset()); | 381 if (read_backward) { |
| 355 // Check that there are enough characters left in the input. | 382 __ Addu(t5, end_of_input_address(), Operand(current_input_offset())); |
| 356 BranchOrBacktrack(on_no_match, gt, t5, Operand(zero_reg)); | 383 __ lw(t0, MemOperand(frame_pointer(), kStartIndex)); |
| 384 for (int i = 0; i < char_size(); i++) { |
| 385 __ Addu(t5, t5, Operand(t0)); |
| 386 } |
| 387 __ lw(t0, MemOperand(frame_pointer(), kInputStart)); |
| 388 BranchOrBacktrack(on_no_match, lt, t5, Operand(t0)); |
| 389 } else { |
| 390 __ Addu(t5, a1, current_input_offset()); |
| 391 // Check that there are enough characters left in the input. |
| 392 BranchOrBacktrack(on_no_match, gt, t5, Operand(zero_reg)); |
| 393 } |
| 357 | 394 |
| 358 // Compute pointers to match string and capture string. | 395 // a0 - offset of start of capture. |
| 396 // a1 - length of capture. |
| 359 __ Addu(a0, a0, Operand(end_of_input_address())); | 397 __ Addu(a0, a0, Operand(end_of_input_address())); |
| 360 __ Addu(a2, end_of_input_address(), Operand(current_input_offset())); | 398 __ Addu(a2, end_of_input_address(), Operand(current_input_offset())); |
| 361 __ Addu(a1, a1, Operand(a0)); | 399 if (read_backward) { |
| 400 __ Subu(a2, a2, Operand(a1)); |
| 401 } |
| 402 __ Addu(a1, a0, Operand(a1)); |
| 403 |
| 404 // a0 - Address of start of capture. |
| 405 // a1 - Address of end of capture. |
| 406 // a2 - Address of current input position. |
| 407 |
| 362 | 408 |
| 363 Label loop; | 409 Label loop; |
| 364 __ bind(&loop); | 410 __ bind(&loop); |
| 365 if (mode_ == LATIN1) { | 411 if (mode_ == LATIN1) { |
| 366 __ lbu(a3, MemOperand(a0, 0)); | 412 __ lbu(a3, MemOperand(a0, 0)); |
| 367 __ addiu(a0, a0, char_size()); | 413 __ addiu(a0, a0, char_size()); |
| 368 __ lbu(t0, MemOperand(a2, 0)); | 414 __ lbu(t0, MemOperand(a2, 0)); |
| 369 __ addiu(a2, a2, char_size()); | 415 __ addiu(a2, a2, char_size()); |
| 370 } else { | 416 } else { |
| 371 DCHECK(mode_ == UC16); | 417 DCHECK(mode_ == UC16); |
| 372 __ lhu(a3, MemOperand(a0, 0)); | 418 __ lhu(a3, MemOperand(a0, 0)); |
| 373 __ addiu(a0, a0, char_size()); | 419 __ addiu(a0, a0, char_size()); |
| 374 __ lhu(t0, MemOperand(a2, 0)); | 420 __ lhu(t0, MemOperand(a2, 0)); |
| 375 __ addiu(a2, a2, char_size()); | 421 __ addiu(a2, a2, char_size()); |
| 376 } | 422 } |
| 377 BranchOrBacktrack(on_no_match, ne, a3, Operand(t0)); | 423 BranchOrBacktrack(on_no_match, ne, a3, Operand(t0)); |
| 378 __ Branch(&loop, lt, a0, Operand(a1)); | 424 __ Branch(&loop, lt, a0, Operand(a1)); |
| 379 | 425 |
| 380 // Move current character position to position after match. | 426 // Move current character position to position after match. |
| 381 __ Subu(current_input_offset(), a2, end_of_input_address()); | 427 __ Subu(current_input_offset(), a2, end_of_input_address()); |
| 428 if (read_backward) { |
| 429 __ lw(t0, register_location(start_reg)); // Index of start of capture. |
| 430 __ lw(t5, register_location(start_reg + 1)); // Index of end of capture. |
| 431 __ Addu(current_input_offset(), current_input_offset(), Operand(t0)); |
| 432 __ Subu(current_input_offset(), current_input_offset(), Operand(t5)); |
| 433 } |
| 382 __ bind(&fallthrough); | 434 __ bind(&fallthrough); |
| 383 } | 435 } |
| 384 | 436 |
| 385 | 437 |
| 386 void RegExpMacroAssemblerMIPS::CheckNotCharacter(uint32_t c, | 438 void RegExpMacroAssemblerMIPS::CheckNotCharacter(uint32_t c, |
| 387 Label* on_not_equal) { | 439 Label* on_not_equal) { |
| 388 BranchOrBacktrack(on_not_equal, ne, current_character(), Operand(c)); | 440 BranchOrBacktrack(on_not_equal, ne, current_character(), Operand(c)); |
| 389 } | 441 } |
| 390 | 442 |
| 391 | 443 |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 RegExpMacroAssembler::IrregexpImplementation | 950 RegExpMacroAssembler::IrregexpImplementation |
| 899 RegExpMacroAssemblerMIPS::Implementation() { | 951 RegExpMacroAssemblerMIPS::Implementation() { |
| 900 return kMIPSImplementation; | 952 return kMIPSImplementation; |
| 901 } | 953 } |
| 902 | 954 |
| 903 | 955 |
| 904 void RegExpMacroAssemblerMIPS::LoadCurrentCharacter(int cp_offset, | 956 void RegExpMacroAssemblerMIPS::LoadCurrentCharacter(int cp_offset, |
| 905 Label* on_end_of_input, | 957 Label* on_end_of_input, |
| 906 bool check_bounds, | 958 bool check_bounds, |
| 907 int characters) { | 959 int characters) { |
| 908 DCHECK(cp_offset >= -1); // ^ and \b can look behind one character. | |
| 909 DCHECK(cp_offset < (1<<30)); // Be sane! (And ensure negation works). | 960 DCHECK(cp_offset < (1<<30)); // Be sane! (And ensure negation works). |
| 910 if (check_bounds) { | 961 if (check_bounds) { |
| 911 CheckPosition(cp_offset + characters - 1, on_end_of_input); | 962 if (cp_offset >= 0) { |
| 963 CheckPosition(cp_offset + characters - 1, on_end_of_input); |
| 964 } else { |
| 965 CheckPosition(cp_offset, on_end_of_input); |
| 966 } |
| 912 } | 967 } |
| 913 LoadCurrentCharacterUnchecked(cp_offset, characters); | 968 LoadCurrentCharacterUnchecked(cp_offset, characters); |
| 914 } | 969 } |
| 915 | 970 |
| 916 | 971 |
| 917 void RegExpMacroAssemblerMIPS::PopCurrentPosition() { | 972 void RegExpMacroAssemblerMIPS::PopCurrentPosition() { |
| 918 Pop(current_input_offset()); | 973 Pop(current_input_offset()); |
| 919 } | 974 } |
| 920 | 975 |
| 921 | 976 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 if (num_registers_ <= register_index) { | 1177 if (num_registers_ <= register_index) { |
| 1123 num_registers_ = register_index + 1; | 1178 num_registers_ = register_index + 1; |
| 1124 } | 1179 } |
| 1125 return MemOperand(frame_pointer(), | 1180 return MemOperand(frame_pointer(), |
| 1126 kRegisterZero - register_index * kPointerSize); | 1181 kRegisterZero - register_index * kPointerSize); |
| 1127 } | 1182 } |
| 1128 | 1183 |
| 1129 | 1184 |
| 1130 void RegExpMacroAssemblerMIPS::CheckPosition(int cp_offset, | 1185 void RegExpMacroAssemblerMIPS::CheckPosition(int cp_offset, |
| 1131 Label* on_outside_input) { | 1186 Label* on_outside_input) { |
| 1132 BranchOrBacktrack(on_outside_input, | 1187 if (cp_offset >= 0) { |
| 1133 ge, | 1188 BranchOrBacktrack(on_outside_input, ge, current_input_offset(), |
| 1134 current_input_offset(), | 1189 Operand(-cp_offset * char_size())); |
| 1135 Operand(-cp_offset * char_size())); | 1190 } else { |
| 1191 __ Addu(a0, end_of_input_address(), Operand(current_input_offset())); |
| 1192 __ Addu(a0, a0, Operand(cp_offset * char_size())); |
| 1193 __ lw(a1, MemOperand(frame_pointer(), kStartIndex)); |
| 1194 for (int i = 0; i < char_size(); i++) { |
| 1195 __ Addu(a0, a0, Operand(a1)); |
| 1196 } |
| 1197 __ lw(a1, MemOperand(frame_pointer(), kInputStart)); |
| 1198 BranchOrBacktrack(on_outside_input, lt, a0, Operand(a1)); |
| 1199 } |
| 1136 } | 1200 } |
| 1137 | 1201 |
| 1138 | 1202 |
| 1139 void RegExpMacroAssemblerMIPS::BranchOrBacktrack(Label* to, | 1203 void RegExpMacroAssemblerMIPS::BranchOrBacktrack(Label* to, |
| 1140 Condition condition, | 1204 Condition condition, |
| 1141 Register rs, | 1205 Register rs, |
| 1142 const Operand& rt) { | 1206 const Operand& rt) { |
| 1143 if (condition == al) { // Unconditional. | 1207 if (condition == al) { // Unconditional. |
| 1144 if (to == NULL) { | 1208 if (to == NULL) { |
| 1145 Backtrack(); | 1209 Backtrack(); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 | 1300 |
| 1237 | 1301 |
| 1238 #undef __ | 1302 #undef __ |
| 1239 | 1303 |
| 1240 #endif // V8_INTERPRETED_REGEXP | 1304 #endif // V8_INTERPRETED_REGEXP |
| 1241 | 1305 |
| 1242 } // namespace internal | 1306 } // namespace internal |
| 1243 } // namespace v8 | 1307 } // namespace v8 |
| 1244 | 1308 |
| 1245 #endif // V8_TARGET_ARCH_MIPS | 1309 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |