Author: [email protected]
Date: Fri May 15 04:17:29 2009
New Revision: 1966

Modified:
    branches/bleeding_edge/src/arm/jump-target-arm.cc
    branches/bleeding_edge/src/ia32/jump-target-ia32.cc
    branches/bleeding_edge/src/jump-target.cc
    branches/bleeding_edge/src/jump-target.h

Log:
Remove the redundant flags is_bound_ and is_linked_ from the
JumpTarget class in favor of using other internal state.

Review URL: http://codereview.chromium.org/113456

Modified: branches/bleeding_edge/src/arm/jump-target-arm.cc
==============================================================================
--- branches/bleeding_edge/src/arm/jump-target-arm.cc   (original)
+++ branches/bleeding_edge/src/arm/jump-target-arm.cc   Fri May 15 04:17:29  
2009
@@ -62,8 +62,6 @@
      cgen_->SetFrame(NULL, &empty);
      __ jmp(&merge_labels_.last());
    }
-
-  is_linked_ = !is_bound_;
  }


@@ -124,7 +122,6 @@
      // the merge code is emitted.
      AddReachingFrame(new VirtualFrame(cgen_->frame()));
      __ b(cc, &merge_labels_.last());
-    is_linked_ = true;
    }
  }

@@ -149,8 +146,6 @@
    ASSERT(entry_frame_ == NULL);
    AddReachingFrame(target_frame);
    __ bl(&merge_labels_.last());
-
-  is_linked_ = !is_bound_;
  }


@@ -175,8 +170,7 @@
          frame->stack_pointer_ -= difference;
          __ add(sp, sp, Operand(difference * kPointerSize));
        }
-
-      is_bound_ = true;
+      __ bind(&entry_label_);
        return;
      }

@@ -199,9 +193,7 @@
          frame->stack_pointer_ -= difference;
          __ add(sp, sp, Operand(difference * kPointerSize));
        }
-
-      is_linked_ = false;
-      is_bound_ = true;
+      __ bind(&entry_label_);
        return;
      }
    }
@@ -298,10 +290,6 @@
        cgen_->SetFrame(new VirtualFrame(entry_frame_), &reserved_registers);
      }

-    // There is certainly a current frame equal to the entry frame.
-    // Bind the entry frame label.
-    __ bind(&entry_label_);
-
      // There may be unprocessed reaching frames that did not need
      // merge code.  They will have unbound merge labels.  Bind their
      // merge labels to be the same as the entry label and deallocate
@@ -328,11 +316,9 @@
      cgen_->SetFrame(new VirtualFrame(reaching_frames_[0]), &reserved);
      __ bind(&merge_labels_[0]);
      cgen_->frame()->MergeTo(entry_frame_);
-    __ bind(&entry_label_);
    }

-  is_linked_ = false;
-  is_bound_ = true;
+  __ bind(&entry_label_);
  }

  #undef __

Modified: branches/bleeding_edge/src/ia32/jump-target-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/ia32/jump-target-ia32.cc (original)
+++ branches/bleeding_edge/src/ia32/jump-target-ia32.cc Fri May 15 04:17:29  
2009
@@ -65,8 +65,6 @@
      cgen_->SetFrame(NULL, &empty);
      __ jmp(&merge_labels_.last());
    }
-
-  is_linked_ = !is_bound_;
  }


@@ -123,18 +121,20 @@
      // Forward branch with a preconfigured entry frame.  Assert the
      // current frame matches the expected one and branch to the block.
      ASSERT(cgen_->frame()->Equals(entry_frame_));
-    // Use masm_-> instead of __ as forward branches are expected to
-    // be a fixed size (no inserted coverage-checking instructions
-    // please).  This is used in Reference::GetValue.
+    // Explicitly use the macro assembler instead of __ as forward
+    // branches are expected to be a fixed size (no inserted
+    // coverage-checking instructions please).  This is used in
+    // Reference::GetValue.
      masm_->j(cc, &entry_label_, hint);
-    is_linked_ = true;

    } else {
      // Forward branch.  A copy of the current frame is remembered and
-    // a branch to the merge code is emitted.
+    // a branch to the merge code is emitted.  Explicitly use the
+    // macro assembler instead of __ as forward branches are expected
+    // to be a fixed size (no inserted coverage-checking instructions
+    // please).  This is used in Reference::GetValue.
      AddReachingFrame(new VirtualFrame(cgen_->frame()));
      masm_->j(cc, &merge_labels_.last(), hint);
-    is_linked_ = true;
    }
  }

@@ -159,8 +159,6 @@
    ASSERT(entry_frame_ == NULL);
    AddReachingFrame(target_frame);
    __ call(&merge_labels_.last());
-
-  is_linked_ = !is_bound_;
  }


@@ -190,8 +188,6 @@
        entry_frame_ = NULL;
      }
      __ bind(&entry_label_);
-    is_linked_ = false;
-    is_bound_ = true;
      return;
    }

@@ -208,7 +204,6 @@
          frame->stack_pointer_ -= difference;
          __ add(Operand(esp), Immediate(difference * kPointerSize));
        }
-
      } else {
        ASSERT(direction_ == BIDIRECTIONAL);
        // Fast case: no forward jumps, possible backward ones.  Remove
@@ -216,9 +211,8 @@
        // frame and use it as the entry frame.
        cgen_->frame()->MakeMergable(mergable_elements);
        entry_frame_ = new VirtualFrame(cgen_->frame());
-      __ bind(&entry_label_);
      }
-    is_bound_ = true;
+    __ bind(&entry_label_);
      return;
    }

@@ -243,8 +237,7 @@
        __ add(Operand(esp), Immediate(difference * kPointerSize));
      }

-    is_linked_ = false;
-    is_bound_ = true;
+    __ bind(&entry_label_);
      return;
    }

@@ -338,10 +331,6 @@
        cgen_->SetFrame(new VirtualFrame(entry_frame_), &reserved_registers);
      }

-    // There is certainly a current frame equal to the entry frame.
-    // Bind the entry frame label.
-    __ bind(&entry_label_);
-
      // There may be unprocessed reaching frames that did not need
      // merge code.  They will have unbound merge labels.  Bind their
      // merge labels to be the same as the entry label and deallocate
@@ -368,11 +357,9 @@
      cgen_->SetFrame(new VirtualFrame(reaching_frames_[0]), &reserved);
      __ bind(&merge_labels_[0]);
      cgen_->frame()->MergeTo(entry_frame_);
-    __ bind(&entry_label_);
    }

-  is_linked_ = false;
-  is_bound_ = true;
+  __ bind(&entry_label_);
  }

  #undef __

Modified: branches/bleeding_edge/src/jump-target.cc
==============================================================================
--- branches/bleeding_edge/src/jump-target.cc   (original)
+++ branches/bleeding_edge/src/jump-target.cc   Fri May 15 04:17:29 2009
@@ -42,8 +42,6 @@
  JumpTarget::JumpTarget(CodeGenerator* cgen, Directionality direction)
      : cgen_(cgen),
        direction_(direction),
-      is_bound_(false),
-      is_linked_(false),
        reaching_frames_(0),
        merge_labels_(0),
        entry_frame_(NULL) {
@@ -56,8 +54,6 @@
      : cgen_(NULL),
        masm_(NULL),
        direction_(FORWARD_ONLY),
-      is_bound_(false),
-      is_linked_(false),
        reaching_frames_(0),
        merge_labels_(0),
        entry_frame_(NULL) {
@@ -78,8 +74,6 @@
    merge_labels_.Clear();
    entry_frame_ = NULL;
    entry_label_.Unuse();
-  is_bound_ = false;
-  is_linked_ = false;
  }


@@ -547,8 +541,6 @@
    }
    destination->entry_frame_ = entry_frame_;
    destination->entry_label_ = entry_label_;
-  destination->is_bound_ = is_bound_;
-  destination->is_linked_ = is_linked_;
    destination->expected_height_ = expected_height_;
  }


Modified: branches/bleeding_edge/src/jump-target.h
==============================================================================
--- branches/bleeding_edge/src/jump-target.h    (original)
+++ branches/bleeding_edge/src/jump-target.h    Fri May 15 04:17:29 2009
@@ -90,9 +90,14 @@
    }

    // Predicates testing the state of the encapsulated label.
-  bool is_bound() const { return is_bound_; }
-  bool is_linked() const { return is_linked_; }
-  bool is_unused() const { return !is_bound() && !is_linked(); }
+  bool is_bound() const { return entry_label_.is_bound(); }
+  bool is_linked() const {
+    return !is_bound() && !reaching_frames_.is_empty();
+  }
+  bool is_unused() const {
+    // This is !is_bound() && !is_linked().
+    return !is_bound() && reaching_frames_.is_empty();
+  }

    // Emit a jump to the target.  There must be a current frame at the
    // jump and there will be no current frame after the jump.
@@ -166,12 +171,6 @@

    // Directionality flag set at initialization time.
    Directionality direction_;
-
-  // A target is bound if its Bind member function has been called.
-  // It is linked if it is not bound but its Jump, Branch, or Call
-  // member functions have been called.
-  bool is_bound_;
-  bool is_linked_;

    // A list of frames reaching this block via forward jumps.
    ZoneList<VirtualFrame*> reaching_frames_;

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to