mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 1026438 part 9 - Make irregexp CheckNotBackReferenceIgnoreCase work with Latin1 strings. r=bhackett
This commit is contained in:
parent
62dbea1c96
commit
fe281c9068
@ -729,7 +729,69 @@ NativeRegExpMacroAssembler::CheckNotBackReferenceIgnoreCase(int start_reg, Label
|
||||
masm.branchPtr(Assembler::GreaterThan, temp0, ImmWord(0), BranchOrBacktrack(on_no_match));
|
||||
|
||||
if (mode_ == ASCII) {
|
||||
MOZ_ASSUME_UNREACHABLE("Ascii case not implemented");
|
||||
Label success, fail;
|
||||
|
||||
// Save register contents to make the registers available below. After
|
||||
// this, the temp0, temp2, and current_position registers are available.
|
||||
masm.push(current_position);
|
||||
|
||||
masm.addPtr(input_end_pointer, current_character); // Start of capture.
|
||||
masm.addPtr(input_end_pointer, current_position); // Start of text to match against capture.
|
||||
masm.addPtr(current_position, temp1); // End of text to match against capture.
|
||||
|
||||
Label loop, loop_increment;
|
||||
masm.bind(&loop);
|
||||
masm.load8ZeroExtend(Address(current_position, 0), temp0);
|
||||
masm.load8ZeroExtend(Address(current_character, 0), temp2);
|
||||
masm.branch32(Assembler::Equal, temp0, temp2, &loop_increment);
|
||||
|
||||
// Mismatch, try case-insensitive match (converting letters to lower-case).
|
||||
masm.or32(Imm32(0x20), temp0); // Convert match character to lower-case.
|
||||
|
||||
// Is temp0 a lowercase letter?
|
||||
Label convert_capture;
|
||||
masm.computeEffectiveAddress(Address(temp0, -'a'), temp2);
|
||||
masm.branch32(Assembler::BelowOrEqual, temp2, Imm32(static_cast<int32_t>('z' - 'a')),
|
||||
&convert_capture);
|
||||
|
||||
// Latin-1: Check for values in range [224,254] but not 247.
|
||||
masm.sub32(Imm32(224 - 'a'), temp2);
|
||||
masm.branch32(Assembler::Above, temp2, Imm32(254 - 224), &fail);
|
||||
|
||||
// Check for 247.
|
||||
masm.branch32(Assembler::Equal, temp2, Imm32(247 - 224), &fail);
|
||||
|
||||
masm.bind(&convert_capture);
|
||||
|
||||
// Also convert capture character.
|
||||
masm.load8ZeroExtend(Address(current_character, 0), temp2);
|
||||
masm.or32(Imm32(0x20), temp2);
|
||||
|
||||
masm.branch32(Assembler::NotEqual, temp0, temp2, &fail);
|
||||
|
||||
masm.bind(&loop_increment);
|
||||
|
||||
// Increment pointers into match and capture strings.
|
||||
masm.addPtr(Imm32(1), current_character);
|
||||
masm.addPtr(Imm32(1), current_position);
|
||||
|
||||
// Compare to end of match, and loop if not done.
|
||||
masm.branchPtr(Assembler::Below, current_position, temp1, &loop);
|
||||
masm.jump(&success);
|
||||
|
||||
masm.bind(&fail);
|
||||
|
||||
// Restore original values before failing.
|
||||
masm.pop(current_position);
|
||||
JumpOrBacktrack(on_no_match);
|
||||
|
||||
masm.bind(&success);
|
||||
|
||||
// Drop original character position value.
|
||||
masm.addPtr(Imm32(sizeof(uintptr_t)), StackPointer);
|
||||
|
||||
// Compute new value of character position after the matched part.
|
||||
masm.subPtr(input_end_pointer, current_position);
|
||||
} else {
|
||||
JS_ASSERT(mode_ == JSCHAR);
|
||||
|
||||
|
@ -1975,6 +1975,12 @@ MacroAssemblerARMCompat::or32(Imm32 imm, const Address &dest)
|
||||
store32(ScratchRegister, dest);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssemblerARMCompat::or32(Imm32 imm, Register dest)
|
||||
{
|
||||
ma_orr(imm, dest);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssemblerARMCompat::xorPtr(Imm32 imm, Register dest)
|
||||
{
|
||||
|
@ -1311,6 +1311,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
|
||||
void and32(Imm32 imm, Register dest);
|
||||
void and32(Imm32 imm, const Address &dest);
|
||||
void and32(const Address &src, Register dest);
|
||||
void or32(Imm32 imm, Register dest);
|
||||
void or32(Imm32 imm, const Address &dest);
|
||||
void xorPtr(Imm32 imm, Register dest);
|
||||
void xorPtr(Register src, Register dest);
|
||||
|
Loading…
Reference in New Issue
Block a user