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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1966 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
kmillikin@chromium.org 2009-05-15 11:17:29 +00:00
parent a3f30f5a3a
commit f579685469
4 changed files with 22 additions and 58 deletions

View File

@ -62,8 +62,6 @@ void JumpTarget::DoJump() {
cgen_->SetFrame(NULL, &empty);
__ jmp(&merge_labels_.last());
}
is_linked_ = !is_bound_;
}
@ -124,7 +122,6 @@ void JumpTarget::DoBranch(Condition cc, Hint ignored) {
// the merge code is emitted.
AddReachingFrame(new VirtualFrame(cgen_->frame()));
__ b(cc, &merge_labels_.last());
is_linked_ = true;
}
}
@ -149,8 +146,6 @@ void JumpTarget::Call() {
ASSERT(entry_frame_ == NULL);
AddReachingFrame(target_frame);
__ bl(&merge_labels_.last());
is_linked_ = !is_bound_;
}
@ -175,8 +170,7 @@ void JumpTarget::DoBind(int mergable_elements) {
frame->stack_pointer_ -= difference;
__ add(sp, sp, Operand(difference * kPointerSize));
}
is_bound_ = true;
__ bind(&entry_label_);
return;
}
@ -199,9 +193,7 @@ void JumpTarget::DoBind(int mergable_elements) {
frame->stack_pointer_ -= difference;
__ add(sp, sp, Operand(difference * kPointerSize));
}
is_linked_ = false;
is_bound_ = true;
__ bind(&entry_label_);
return;
}
}
@ -298,10 +290,6 @@ void JumpTarget::DoBind(int mergable_elements) {
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 @@ void JumpTarget::DoBind(int mergable_elements) {
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 __

View File

@ -65,8 +65,6 @@ void JumpTarget::DoJump() {
cgen_->SetFrame(NULL, &empty);
__ jmp(&merge_labels_.last());
}
is_linked_ = !is_bound_;
}
@ -123,18 +121,20 @@ void JumpTarget::DoBranch(Condition cc, Hint hint) {
// 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 @@ void JumpTarget::Call() {
ASSERT(entry_frame_ == NULL);
AddReachingFrame(target_frame);
__ call(&merge_labels_.last());
is_linked_ = !is_bound_;
}
@ -190,8 +188,6 @@ void JumpTarget::DoBind(int mergable_elements) {
entry_frame_ = NULL;
}
__ bind(&entry_label_);
is_linked_ = false;
is_bound_ = true;
return;
}
@ -208,7 +204,6 @@ void JumpTarget::DoBind(int mergable_elements) {
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 @@ void JumpTarget::DoBind(int mergable_elements) {
// 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 @@ void JumpTarget::DoBind(int mergable_elements) {
__ add(Operand(esp), Immediate(difference * kPointerSize));
}
is_linked_ = false;
is_bound_ = true;
__ bind(&entry_label_);
return;
}
@ -338,10 +331,6 @@ void JumpTarget::DoBind(int mergable_elements) {
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 @@ void JumpTarget::DoBind(int mergable_elements) {
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 __

View File

@ -42,8 +42,6 @@ bool JumpTarget::compiling_deferred_code_ = false;
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 @@ JumpTarget::JumpTarget()
: 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 @@ void JumpTarget::Unuse() {
merge_labels_.Clear();
entry_frame_ = NULL;
entry_label_.Unuse();
is_bound_ = false;
is_linked_ = false;
}
@ -547,8 +541,6 @@ void BreakTarget::CopyTo(BreakTarget* destination) {
}
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_;
}

View File

@ -90,9 +90,14 @@ class JumpTarget : public ZoneObject { // Shadows are dynamically allocated.
}
// 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.
@ -167,12 +172,6 @@ class JumpTarget : public ZoneObject { // Shadows are dynamically allocated.
// 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_;