Instead of jumping over a conditional backtrack, jump to a single instance somewhere...
authorlrn@chromium.org <lrn@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 19 Dec 2008 12:08:29 +0000 (12:08 +0000)
committerlrn@chromium.org <lrn@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 19 Dec 2008 12:08:29 +0000 (12:08 +0000)
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1007 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/regexp-macro-assembler-ia32.cc
src/regexp-macro-assembler-ia32.h

index 2fa23bcf164c07ae567947fb93ef11b8e25a277d..29d9d31f7bf6f525ee5207295ec5bc9ff1f66b13 100644 (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);
index d639a2eef46235df34836f6f6c1f26da99694805..95ff01a1095ebe7c40912399fd9078e2e39a2200 100644 (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.