Instead of jumping over a conditional backtrack, jump to a single instance somewhere else.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1007 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
lrn@chromium.org 2008-12-19 12:08:29 +00:00
parent 2c3b392c8c
commit d7290b6b6e
2 changed files with 10 additions and 4 deletions

View File

@ -93,6 +93,7 @@ RegExpMacroAssemblerIA32::RegExpMacroAssemblerIA32(
entry_label_(),
start_label_(),
success_label_(),
backtrack_label_(),
exit_label_(),
self_(Heap::undefined_value()) {
__ jmp(&entry_label_); // We'll write the entry code later.
@ -106,6 +107,7 @@ RegExpMacroAssemblerIA32::~RegExpMacroAssemblerIA32() {
entry_label_.Unuse();
start_label_.Unuse();
success_label_.Unuse();
backtrack_label_.Unuse();
exit_label_.Unuse();
check_preempt_label_.Unuse();
}
@ -564,6 +566,12 @@ Handle<Object> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) {
__ pop(esi);
__ ret(0);
// Backtrack code (branch target for conditional backtracks).
if (backtrack_label_.is_linked()) {
__ bind(&backtrack_label_);
Backtrack();
}
// Preempt-code
if (check_preempt_label_.is_linked()) {
__ bind(&check_preempt_label_);
@ -818,10 +826,7 @@ void RegExpMacroAssemblerIA32::BranchOrBacktrack(Condition condition,
return;
}
if (to == NULL) {
Label skip;
__ j(NegateCondition(condition), &skip);
Backtrack();
__ bind(&skip);
__ j(condition, &backtrack_label_);
return;
}
__ j(condition, to);

View File

@ -201,6 +201,7 @@ class RegExpMacroAssemblerIA32: public RegExpMacroAssembler {
Label entry_label_;
Label start_label_;
Label success_label_;
Label backtrack_label_;
Label exit_label_;
Label check_preempt_label_;
// Handle used to represent the generated code object itself.