[webkit-reviews] review requested: [Bug 50295] Regexp JIT'ed Code Contains Branches to Branches for Backtracking : [Attachment 75232] Patch to remove most paren related branches to branches
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Nov 30 17:03:51 PST 2010
Michael Saboff <msaboff at apple.com> has asked for review:
Bug 50295: Regexp JIT'ed Code Contains Branches to Branches for Backtracking
https://bugs.webkit.org/show_bug.cgi?id=50295
Attachment 75232: Patch to remove most paren related branches to branches
https://bugs.webkit.org/attachment.cgi?id=75232&action=review
------- Additional Comments from Michael Saboff <msaboff at apple.com>
This patch propagates branches from within parentheses backtracking code to
later alternatives. It also emits the parentheses failure code at the end of
the routine. It handles indirect branches as backtracking destinations and
emits a trampoline to an indirect branch when needed.
Some cleanups were done as part of this patch. Specifically the
invertOrCapture flag was separated into two.
The code generated by this patch for the same regular expression in the
description is:
push %rbp
mov %rsp,%rbp
push %rbx
mov %esi,(%rcx)
sub $0x10,%rsp
add $0x2,%esi
cmp %edx,%esi
ja nextChar
loop:
mov %rsi,%rax
add $0xfffffffffffffffe,%eax
mov %eax,0x8(%rcx)
cmpw $0x61,-0x4(%rdi,%rsi,2)
jne tryAlt1A
mov $tryAlt1A,%r11
mov %r11,(%rsp)
jmpq term1Match
tryAlt1A:
cmpw $0x41,-0x4(%rdi,%rsi,2)
jne term1Fail
mov $term1Fail,%r11
mov %r11,(%rsp)
jmpq term1Match
term1Match:
mov %rsi,%rax
add $0xffffffffffffffff,%eax
mov %eax,0xc(%rcx)
mov %rsi,%rax
add $0xffffffffffffffff,%eax
mov %eax,0x10(%rcx)
cmpw $0x62,-0x2(%rdi,%rsi,2)
jne tryAlt2B
mov $tryAlt2B,%r11
mov %r11,0x8(%rsp)
jmpq term2Match
tryAlt2B:
cmpw $0x42,-0x2(%rdi,%rsi,2)
jne term2Fail
mov $term2Fail,%r11
mov %r11,0x8(%rsp)
jmpq term2Match
term2Match:
mov %esi,0x14(%rcx)
add $0x10,%rsp
mov (%rcx),%eax
mov %esi,0x4(%rcx)
pop %rbx
pop %rbp
retq
nextChar:
mov %rsi,%rax
sub $0x1,%eax
mov %eax,(%rcx)
add $0x1,%esi
cmp %edx,%esi
jbe loop:
add $0x10,%rsp
mov $0xffffffff,%eax
pop %rbx
pop %rbp
retq
term2Fail:
movl $0xffffffff,0x10(%rcx)
jmpq *(%rsp)
term1Fail:
movl $0xffffffff,0x8(%rcx)
jmpq nextChar
More information about the webkit-reviews
mailing list