| 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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
| 6 | 6 |
| 7 #include "src/regexp/mips64/regexp-macro-assembler-mips64.h" | 7 #include "src/regexp/mips64/regexp-macro-assembler-mips64.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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 BranchOrBacktrack(on_equal, eq, current_character(), Operand(c)); | 210 BranchOrBacktrack(on_equal, eq, current_character(), Operand(c)); |
| 211 } | 211 } |
| 212 | 212 |
| 213 | 213 |
| 214 void RegExpMacroAssemblerMIPS::CheckCharacterGT(uc16 limit, Label* on_greater) { | 214 void RegExpMacroAssemblerMIPS::CheckCharacterGT(uc16 limit, Label* on_greater) { |
| 215 BranchOrBacktrack(on_greater, gt, current_character(), Operand(limit)); | 215 BranchOrBacktrack(on_greater, gt, current_character(), Operand(limit)); |
| 216 } | 216 } |
| 217 | 217 |
| 218 | 218 |
| 219 void RegExpMacroAssemblerMIPS::CheckAtStart(Label* on_at_start) { | 219 void RegExpMacroAssemblerMIPS::CheckAtStart(Label* on_at_start) { |
| 220 Label not_at_start; | 220 __ Daddu(a0, end_of_input_address(), Operand(current_input_offset())); |
| 221 // Did we start the match at the start of the string at all? | 221 __ ld(a1, MemOperand(frame_pointer(), kStartIndex)); |
| 222 __ ld(a0, MemOperand(frame_pointer(), kStartIndex)); | 222 for (int i = 0; i < char_size(); i++) { |
| 223 BranchOrBacktrack(¬_at_start, ne, a0, Operand(zero_reg)); | 223 __ Daddu(a0, a0, Operand(a1)); |
| 224 | 224 } |
| 225 // If we did, are we still at the start of the input? | |
| 226 __ ld(a1, MemOperand(frame_pointer(), kInputStart)); | 225 __ ld(a1, MemOperand(frame_pointer(), kInputStart)); |
| 227 __ Daddu(a0, end_of_input_address(), Operand(current_input_offset())); | |
| 228 BranchOrBacktrack(on_at_start, eq, a0, Operand(a1)); | 226 BranchOrBacktrack(on_at_start, eq, a0, Operand(a1)); |
| 229 __ bind(¬_at_start); | |
| 230 } | 227 } |
| 231 | 228 |
| 232 | 229 |
| 233 void RegExpMacroAssemblerMIPS::CheckNotAtStart(Label* on_not_at_start) { | 230 void RegExpMacroAssemblerMIPS::CheckNotAtStart(int cp_offset, |
| 234 // Did we start the match at the start of the string at all? | 231 Label* on_not_at_start) { |
| 235 __ ld(a0, MemOperand(frame_pointer(), kStartIndex)); | 232 __ Daddu(a0, end_of_input_address(), Operand(current_input_offset())); |
| 236 BranchOrBacktrack(on_not_at_start, ne, a0, Operand(zero_reg)); | 233 __ Daddu(a0, a0, Operand(cp_offset * char_size())); |
| 237 // If we did, are we still at the start of the input? | 234 __ ld(a1, MemOperand(frame_pointer(), kStartIndex)); |
| 235 for (int i = 0; i < char_size(); i++) { |
| 236 __ Daddu(a0, a0, Operand(a1)); |
| 237 } |
| 238 __ ld(a1, MemOperand(frame_pointer(), kInputStart)); | 238 __ ld(a1, MemOperand(frame_pointer(), kInputStart)); |
| 239 __ Daddu(a0, end_of_input_address(), Operand(current_input_offset())); | |
| 240 BranchOrBacktrack(on_not_at_start, ne, a0, Operand(a1)); | 239 BranchOrBacktrack(on_not_at_start, ne, a0, Operand(a1)); |
| 241 } | 240 } |
| 242 | 241 |
| 243 | 242 |
| 244 void RegExpMacroAssemblerMIPS::CheckCharacterLT(uc16 limit, Label* on_less) { | 243 void RegExpMacroAssemblerMIPS::CheckCharacterLT(uc16 limit, Label* on_less) { |
| 245 BranchOrBacktrack(on_less, lt, current_character(), Operand(limit)); | 244 BranchOrBacktrack(on_less, lt, current_character(), Operand(limit)); |
| 246 } | 245 } |
| 247 | 246 |
| 248 | 247 |
| 249 void RegExpMacroAssemblerMIPS::CheckGreedyLoop(Label* on_equal) { | 248 void RegExpMacroAssemblerMIPS::CheckGreedyLoop(Label* on_equal) { |
| 250 Label backtrack_non_equal; | 249 Label backtrack_non_equal; |
| 251 __ lw(a0, MemOperand(backtrack_stackpointer(), 0)); | 250 __ lw(a0, MemOperand(backtrack_stackpointer(), 0)); |
| 252 __ Branch(&backtrack_non_equal, ne, current_input_offset(), Operand(a0)); | 251 __ Branch(&backtrack_non_equal, ne, current_input_offset(), Operand(a0)); |
| 253 __ Daddu(backtrack_stackpointer(), | 252 __ Daddu(backtrack_stackpointer(), |
| 254 backtrack_stackpointer(), | 253 backtrack_stackpointer(), |
| 255 Operand(kIntSize)); | 254 Operand(kIntSize)); |
| 256 __ bind(&backtrack_non_equal); | 255 __ bind(&backtrack_non_equal); |
| 257 BranchOrBacktrack(on_equal, eq, current_input_offset(), Operand(a0)); | 256 BranchOrBacktrack(on_equal, eq, current_input_offset(), Operand(a0)); |
| 258 } | 257 } |
| 259 | 258 |
| 260 | 259 |
| 261 void RegExpMacroAssemblerMIPS::CheckNotBackReferenceIgnoreCase( | 260 void RegExpMacroAssemblerMIPS::CheckNotBackReferenceIgnoreCase( |
| 262 int start_reg, | 261 int start_reg, bool read_backward, Label* on_no_match) { |
| 263 Label* on_no_match) { | |
| 264 Label fallthrough; | 262 Label fallthrough; |
| 265 __ ld(a0, register_location(start_reg)); // Index of start of capture. | 263 __ ld(a0, register_location(start_reg)); // Index of start of capture. |
| 266 __ ld(a1, register_location(start_reg + 1)); // Index of end of capture. | 264 __ ld(a1, register_location(start_reg + 1)); // Index of end of capture. |
| 267 __ Dsubu(a1, a1, a0); // Length of capture. | 265 __ Dsubu(a1, a1, a0); // Length of capture. |
| 268 | 266 |
| 269 // If length is zero, either the capture is empty or it is not participating. | 267 // The length of the capture can only be negative if the end of the |
| 270 // In either case succeed immediately. | 268 // capture is not yet recorded. If the length is zero, the capture is |
| 271 __ Branch(&fallthrough, eq, a1, Operand(zero_reg)); | 269 // either empty or uncaptured. In either of those cases, succeed. |
| 270 __ Branch(&fallthrough, le, a1, Operand(zero_reg)); |
| 272 | 271 |
| 273 __ Daddu(t1, a1, current_input_offset()); | 272 if (read_backward) { |
| 274 // Check that there are enough characters left in the input. | 273 __ Daddu(a2, end_of_input_address(), Operand(current_input_offset())); |
| 275 BranchOrBacktrack(on_no_match, gt, t1, Operand(zero_reg)); | 274 __ ld(t1, MemOperand(frame_pointer(), kStartIndex)); |
| 275 for (int i = 0; i < char_size(); i++) { |
| 276 __ Daddu(a2, a2, Operand(t1)); |
| 277 } |
| 278 __ ld(t1, MemOperand(frame_pointer(), kInputStart)); |
| 279 BranchOrBacktrack(on_no_match, lt, a2, Operand(t1)); |
| 280 } else { |
| 281 __ Daddu(t1, a1, current_input_offset()); |
| 282 // Check that there are enough characters left in the input. |
| 283 BranchOrBacktrack(on_no_match, gt, t1, Operand(zero_reg)); |
| 284 } |
| 276 | 285 |
| 277 if (mode_ == LATIN1) { | 286 if (mode_ == LATIN1) { |
| 278 Label success; | 287 Label success; |
| 279 Label fail; | 288 Label fail; |
| 280 Label loop_check; | 289 Label loop_check; |
| 281 | 290 |
| 282 // a0 - offset of start of capture. | 291 // a0 - offset of start of capture. |
| 283 // a1 - length of capture. | 292 // a1 - length of capture. |
| 284 __ Daddu(a0, a0, Operand(end_of_input_address())); | 293 __ Daddu(a0, a0, Operand(end_of_input_address())); |
| 285 __ Daddu(a2, end_of_input_address(), Operand(current_input_offset())); | 294 __ Daddu(a2, end_of_input_address(), Operand(current_input_offset())); |
| 295 if (read_backward) { |
| 296 __ Dsubu(a2, a2, Operand(a1)); |
| 297 } |
| 286 __ Daddu(a1, a0, Operand(a1)); | 298 __ Daddu(a1, a0, Operand(a1)); |
| 287 | 299 |
| 288 // a0 - Address of start of capture. | 300 // a0 - Address of start of capture. |
| 289 // a1 - Address of end of capture. | 301 // a1 - Address of end of capture. |
| 290 // a2 - Address of current input position. | 302 // a2 - Address of current input position. |
| 291 | 303 |
| 292 Label loop; | 304 Label loop; |
| 293 __ bind(&loop); | 305 __ bind(&loop); |
| 294 __ lbu(a3, MemOperand(a0, 0)); | 306 __ lbu(a3, MemOperand(a0, 0)); |
| 295 __ daddiu(a0, a0, char_size()); | 307 __ daddiu(a0, a0, char_size()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 314 __ bind(&loop_check); | 326 __ bind(&loop_check); |
| 315 __ Branch(&loop, lt, a0, Operand(a1)); | 327 __ Branch(&loop, lt, a0, Operand(a1)); |
| 316 __ jmp(&success); | 328 __ jmp(&success); |
| 317 | 329 |
| 318 __ bind(&fail); | 330 __ bind(&fail); |
| 319 GoTo(on_no_match); | 331 GoTo(on_no_match); |
| 320 | 332 |
| 321 __ bind(&success); | 333 __ bind(&success); |
| 322 // Compute new value of character position after the matched part. | 334 // Compute new value of character position after the matched part. |
| 323 __ Dsubu(current_input_offset(), a2, end_of_input_address()); | 335 __ Dsubu(current_input_offset(), a2, end_of_input_address()); |
| 336 if (read_backward) { |
| 337 __ ld(t1, register_location(start_reg)); // Index of start of capture. |
| 338 __ ld(a2, register_location(start_reg + 1)); // Index of end of capture. |
| 339 __ Daddu(current_input_offset(), current_input_offset(), Operand(t1)); |
| 340 __ Dsubu(current_input_offset(), current_input_offset(), Operand(a2)); |
| 341 } |
| 324 } else { | 342 } else { |
| 325 DCHECK(mode_ == UC16); | 343 DCHECK(mode_ == UC16); |
| 326 // Put regexp engine registers on stack. | 344 // Put regexp engine registers on stack. |
| 327 RegList regexp_registers_to_retain = current_input_offset().bit() | | 345 RegList regexp_registers_to_retain = current_input_offset().bit() | |
| 328 current_character().bit() | backtrack_stackpointer().bit(); | 346 current_character().bit() | backtrack_stackpointer().bit(); |
| 329 __ MultiPush(regexp_registers_to_retain); | 347 __ MultiPush(regexp_registers_to_retain); |
| 330 | 348 |
| 331 int argument_count = 4; | 349 int argument_count = 4; |
| 332 __ PrepareCallCFunction(argument_count, a2); | 350 __ PrepareCallCFunction(argument_count, a2); |
| 333 | 351 |
| 334 // a0 - offset of start of capture. | 352 // a0 - offset of start of capture. |
| 335 // a1 - length of capture. | 353 // a1 - length of capture. |
| 336 | 354 |
| 337 // Put arguments into arguments registers. | 355 // Put arguments into arguments registers. |
| 338 // Parameters are | 356 // Parameters are |
| 339 // a0: Address byte_offset1 - Address captured substring's start. | 357 // a0: Address byte_offset1 - Address captured substring's start. |
| 340 // a1: Address byte_offset2 - Address of current character position. | 358 // a1: Address byte_offset2 - Address of current character position. |
| 341 // a2: size_t byte_length - length of capture in bytes(!). | 359 // a2: size_t byte_length - length of capture in bytes(!). |
| 342 // a3: Isolate* isolate. | 360 // a3: Isolate* isolate. |
| 343 | 361 |
| 344 // Address of start of capture. | 362 // Address of start of capture. |
| 345 __ Daddu(a0, a0, Operand(end_of_input_address())); | 363 __ Daddu(a0, a0, Operand(end_of_input_address())); |
| 346 // Length of capture. | 364 // Length of capture. |
| 347 __ mov(a2, a1); | 365 __ mov(a2, a1); |
| 348 // Save length in callee-save register for use on return. | 366 // Save length in callee-save register for use on return. |
| 349 __ mov(s3, a1); | 367 __ mov(s3, a1); |
| 350 // Address of current input position. | 368 // Address of current input position. |
| 351 __ Daddu(a1, current_input_offset(), Operand(end_of_input_address())); | 369 __ Daddu(a1, current_input_offset(), Operand(end_of_input_address())); |
| 370 if (read_backward) { |
| 371 __ Dsubu(a1, a1, Operand(s3)); |
| 372 } |
| 352 // Isolate. | 373 // Isolate. |
| 353 __ li(a3, Operand(ExternalReference::isolate_address(masm_->isolate()))); | 374 __ li(a3, Operand(ExternalReference::isolate_address(masm_->isolate()))); |
| 354 | 375 |
| 355 { | 376 { |
| 356 AllowExternalCallThatCantCauseGC scope(masm_); | 377 AllowExternalCallThatCantCauseGC scope(masm_); |
| 357 ExternalReference function = | 378 ExternalReference function = |
| 358 ExternalReference::re_case_insensitive_compare_uc16(masm_->isolate()); | 379 ExternalReference::re_case_insensitive_compare_uc16(masm_->isolate()); |
| 359 __ CallCFunction(function, argument_count); | 380 __ CallCFunction(function, argument_count); |
| 360 } | 381 } |
| 361 | 382 |
| 362 // Restore regexp engine registers. | 383 // Restore regexp engine registers. |
| 363 __ MultiPop(regexp_registers_to_retain); | 384 __ MultiPop(regexp_registers_to_retain); |
| 364 __ li(code_pointer(), Operand(masm_->CodeObject()), CONSTANT_SIZE); | 385 __ li(code_pointer(), Operand(masm_->CodeObject()), CONSTANT_SIZE); |
| 365 __ ld(end_of_input_address(), MemOperand(frame_pointer(), kInputEnd)); | 386 __ ld(end_of_input_address(), MemOperand(frame_pointer(), kInputEnd)); |
| 366 | 387 |
| 367 // Check if function returned non-zero for success or zero for failure. | 388 // Check if function returned non-zero for success or zero for failure. |
| 368 BranchOrBacktrack(on_no_match, eq, v0, Operand(zero_reg)); | 389 BranchOrBacktrack(on_no_match, eq, v0, Operand(zero_reg)); |
| 369 // On success, increment position by length of capture. | 390 // On success, increment position by length of capture. |
| 370 __ Daddu(current_input_offset(), current_input_offset(), Operand(s3)); | 391 if (read_backward) { |
| 392 __ Dsubu(current_input_offset(), current_input_offset(), Operand(s3)); |
| 393 } else { |
| 394 __ Daddu(current_input_offset(), current_input_offset(), Operand(s3)); |
| 395 } |
| 371 } | 396 } |
| 372 | 397 |
| 373 __ bind(&fallthrough); | 398 __ bind(&fallthrough); |
| 374 } | 399 } |
| 375 | 400 |
| 376 | 401 |
| 377 void RegExpMacroAssemblerMIPS::CheckNotBackReference( | 402 void RegExpMacroAssemblerMIPS::CheckNotBackReference(int start_reg, |
| 378 int start_reg, | 403 bool read_backward, |
| 379 Label* on_no_match) { | 404 Label* on_no_match) { |
| 380 Label fallthrough; | 405 Label fallthrough; |
| 381 Label success; | 406 Label success; |
| 382 | 407 |
| 383 // Find length of back-referenced capture. | 408 // Find length of back-referenced capture. |
| 384 __ ld(a0, register_location(start_reg)); | 409 __ ld(a0, register_location(start_reg)); |
| 385 __ ld(a1, register_location(start_reg + 1)); | 410 __ ld(a1, register_location(start_reg + 1)); |
| 386 __ Dsubu(a1, a1, a0); // Length to check. | 411 __ Dsubu(a1, a1, a0); // Length to check. |
| 387 // Succeed on empty capture (including no capture). | 412 // The length of the capture can only be negative if the end of the |
| 388 __ Branch(&fallthrough, eq, a1, Operand(zero_reg)); | 413 // capture is not yet recorded. If the length is zero, the capture is |
| 414 // either empty or uncaptured. In either of those cases, succeed. |
| 415 __ Branch(&fallthrough, le, a1, Operand(zero_reg)); |
| 389 | 416 |
| 390 __ Daddu(t1, a1, current_input_offset()); | 417 if (read_backward) { |
| 391 // Check that there are enough characters left in the input. | 418 __ Daddu(a2, end_of_input_address(), Operand(current_input_offset())); |
| 392 BranchOrBacktrack(on_no_match, gt, t1, Operand(zero_reg)); | 419 __ ld(t1, MemOperand(frame_pointer(), kStartIndex)); |
| 420 for (int i = 0; i < char_size(); i++) { |
| 421 __ Daddu(a2, a2, Operand(t1)); |
| 422 } |
| 423 __ ld(t1, MemOperand(frame_pointer(), kInputStart)); |
| 424 BranchOrBacktrack(on_no_match, lt, a2, Operand(t1)); |
| 425 } else { |
| 426 __ Daddu(t1, a1, current_input_offset()); |
| 427 // Check that there are enough characters left in the input. |
| 428 BranchOrBacktrack(on_no_match, gt, t1, Operand(zero_reg)); |
| 429 } |
| 393 | 430 |
| 394 // Compute pointers to match string and capture string. | 431 // Compute pointers to match string and capture string. |
| 395 __ Daddu(a0, a0, Operand(end_of_input_address())); | 432 __ Daddu(a0, a0, Operand(end_of_input_address())); |
| 396 __ Daddu(a2, end_of_input_address(), Operand(current_input_offset())); | 433 __ Daddu(a2, end_of_input_address(), Operand(current_input_offset())); |
| 434 if (read_backward) { |
| 435 __ Dsubu(a2, a2, Operand(a1)); |
| 436 } |
| 397 __ Daddu(a1, a1, Operand(a0)); | 437 __ Daddu(a1, a1, Operand(a0)); |
| 398 | 438 |
| 399 Label loop; | 439 Label loop; |
| 400 __ bind(&loop); | 440 __ bind(&loop); |
| 401 if (mode_ == LATIN1) { | 441 if (mode_ == LATIN1) { |
| 402 __ lbu(a3, MemOperand(a0, 0)); | 442 __ lbu(a3, MemOperand(a0, 0)); |
| 403 __ daddiu(a0, a0, char_size()); | 443 __ daddiu(a0, a0, char_size()); |
| 404 __ lbu(a4, MemOperand(a2, 0)); | 444 __ lbu(a4, MemOperand(a2, 0)); |
| 405 __ daddiu(a2, a2, char_size()); | 445 __ daddiu(a2, a2, char_size()); |
| 406 } else { | 446 } else { |
| 407 DCHECK(mode_ == UC16); | 447 DCHECK(mode_ == UC16); |
| 408 __ lhu(a3, MemOperand(a0, 0)); | 448 __ lhu(a3, MemOperand(a0, 0)); |
| 409 __ daddiu(a0, a0, char_size()); | 449 __ daddiu(a0, a0, char_size()); |
| 410 __ lhu(a4, MemOperand(a2, 0)); | 450 __ lhu(a4, MemOperand(a2, 0)); |
| 411 __ daddiu(a2, a2, char_size()); | 451 __ daddiu(a2, a2, char_size()); |
| 412 } | 452 } |
| 413 BranchOrBacktrack(on_no_match, ne, a3, Operand(a4)); | 453 BranchOrBacktrack(on_no_match, ne, a3, Operand(a4)); |
| 414 __ Branch(&loop, lt, a0, Operand(a1)); | 454 __ Branch(&loop, lt, a0, Operand(a1)); |
| 415 | 455 |
| 416 // Move current character position to position after match. | 456 // Move current character position to position after match. |
| 417 __ Dsubu(current_input_offset(), a2, end_of_input_address()); | 457 __ Dsubu(current_input_offset(), a2, end_of_input_address()); |
| 458 if (read_backward) { |
| 459 __ ld(t1, register_location(start_reg)); // Index of start of capture. |
| 460 __ ld(a2, register_location(start_reg + 1)); // Index of end of capture. |
| 461 __ Daddu(current_input_offset(), current_input_offset(), Operand(t1)); |
| 462 __ Dsubu(current_input_offset(), current_input_offset(), Operand(a2)); |
| 463 } |
| 418 __ bind(&fallthrough); | 464 __ bind(&fallthrough); |
| 419 } | 465 } |
| 420 | 466 |
| 421 | 467 |
| 422 void RegExpMacroAssemblerMIPS::CheckNotCharacter(uint32_t c, | 468 void RegExpMacroAssemblerMIPS::CheckNotCharacter(uint32_t c, |
| 423 Label* on_not_equal) { | 469 Label* on_not_equal) { |
| 424 BranchOrBacktrack(on_not_equal, ne, current_character(), Operand(c)); | 470 BranchOrBacktrack(on_not_equal, ne, current_character(), Operand(c)); |
| 425 } | 471 } |
| 426 | 472 |
| 427 | 473 |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 RegExpMacroAssembler::IrregexpImplementation | 990 RegExpMacroAssembler::IrregexpImplementation |
| 945 RegExpMacroAssemblerMIPS::Implementation() { | 991 RegExpMacroAssemblerMIPS::Implementation() { |
| 946 return kMIPSImplementation; | 992 return kMIPSImplementation; |
| 947 } | 993 } |
| 948 | 994 |
| 949 | 995 |
| 950 void RegExpMacroAssemblerMIPS::LoadCurrentCharacter(int cp_offset, | 996 void RegExpMacroAssemblerMIPS::LoadCurrentCharacter(int cp_offset, |
| 951 Label* on_end_of_input, | 997 Label* on_end_of_input, |
| 952 bool check_bounds, | 998 bool check_bounds, |
| 953 int characters) { | 999 int characters) { |
| 954 DCHECK(cp_offset >= -1); // ^ and \b can look behind one character. | |
| 955 DCHECK(cp_offset < (1<<30)); // Be sane! (And ensure negation works). | 1000 DCHECK(cp_offset < (1<<30)); // Be sane! (And ensure negation works). |
| 956 if (check_bounds) { | 1001 if (check_bounds) { |
| 957 CheckPosition(cp_offset + characters - 1, on_end_of_input); | 1002 if (cp_offset >= 0) { |
| 1003 CheckPosition(cp_offset + characters - 1, on_end_of_input); |
| 1004 } else { |
| 1005 CheckPosition(cp_offset, on_end_of_input); |
| 1006 } |
| 958 } | 1007 } |
| 959 LoadCurrentCharacterUnchecked(cp_offset, characters); | 1008 LoadCurrentCharacterUnchecked(cp_offset, characters); |
| 960 } | 1009 } |
| 961 | 1010 |
| 962 | 1011 |
| 963 void RegExpMacroAssemblerMIPS::PopCurrentPosition() { | 1012 void RegExpMacroAssemblerMIPS::PopCurrentPosition() { |
| 964 Pop(current_input_offset()); | 1013 Pop(current_input_offset()); |
| 965 } | 1014 } |
| 966 | 1015 |
| 967 | 1016 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 if (num_registers_ <= register_index) { | 1217 if (num_registers_ <= register_index) { |
| 1169 num_registers_ = register_index + 1; | 1218 num_registers_ = register_index + 1; |
| 1170 } | 1219 } |
| 1171 return MemOperand(frame_pointer(), | 1220 return MemOperand(frame_pointer(), |
| 1172 kRegisterZero - register_index * kPointerSize); | 1221 kRegisterZero - register_index * kPointerSize); |
| 1173 } | 1222 } |
| 1174 | 1223 |
| 1175 | 1224 |
| 1176 void RegExpMacroAssemblerMIPS::CheckPosition(int cp_offset, | 1225 void RegExpMacroAssemblerMIPS::CheckPosition(int cp_offset, |
| 1177 Label* on_outside_input) { | 1226 Label* on_outside_input) { |
| 1178 BranchOrBacktrack(on_outside_input, | 1227 if (cp_offset >= 0) { |
| 1179 ge, | 1228 BranchOrBacktrack(on_outside_input, ge, current_input_offset(), |
| 1180 current_input_offset(), | 1229 Operand(-cp_offset * char_size())); |
| 1181 Operand(-cp_offset * char_size())); | 1230 } else { |
| 1231 __ Daddu(a0, end_of_input_address(), Operand(current_input_offset())); |
| 1232 __ Daddu(a0, a0, Operand(cp_offset * char_size())); |
| 1233 __ ld(a1, MemOperand(frame_pointer(), kStartIndex)); |
| 1234 for (int i = 0; i < char_size(); i++) { |
| 1235 __ Daddu(a0, a0, Operand(a1)); |
| 1236 } |
| 1237 __ ld(a1, MemOperand(frame_pointer(), kInputStart)); |
| 1238 BranchOrBacktrack(on_outside_input, lt, a0, Operand(a1)); |
| 1239 } |
| 1182 } | 1240 } |
| 1183 | 1241 |
| 1184 | 1242 |
| 1185 void RegExpMacroAssemblerMIPS::BranchOrBacktrack(Label* to, | 1243 void RegExpMacroAssemblerMIPS::BranchOrBacktrack(Label* to, |
| 1186 Condition condition, | 1244 Condition condition, |
| 1187 Register rs, | 1245 Register rs, |
| 1188 const Operand& rt) { | 1246 const Operand& rt) { |
| 1189 if (condition == al) { // Unconditional. | 1247 if (condition == al) { // Unconditional. |
| 1190 if (to == NULL) { | 1248 if (to == NULL) { |
| 1191 Backtrack(); | 1249 Backtrack(); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 } | 1339 } |
| 1282 | 1340 |
| 1283 #undef __ | 1341 #undef __ |
| 1284 | 1342 |
| 1285 #endif // V8_INTERPRETED_REGEXP | 1343 #endif // V8_INTERPRETED_REGEXP |
| 1286 | 1344 |
| 1287 } // namespace internal | 1345 } // namespace internal |
| 1288 } // namespace v8 | 1346 } // namespace v8 |
| 1289 | 1347 |
| 1290 #endif // V8_TARGET_ARCH_MIPS64 | 1348 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |