Modify JumpTarget::ComputeEntryFrame to mark copied elements

immediately when putting a copy in the entry frame, rather than as
part of a separate pass after fully constructing the entry fraem.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1907 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent bcab3697
......@@ -195,13 +195,17 @@ void JumpTarget::ComputeEntryFrame(int mergable_elements) {
entry_frame_ = new VirtualFrame(cgen_);
int index = 0;
for (; index < entry_frame_->elements_.length(); index++) {
// If the element is determined, set it now and count registers.
// Undetermined elements are initially recorded as if in memory.
// If the element is determined, set it now. Count registers. Mark
// elements as copied exactly when they have a copy. Undetermined
// elements are initially recorded as if in memory.
if (elements[index] != NULL) {
entry_frame_->elements_[index] = *elements[index];
entry_frame_->elements_[index].clear_copied();
if (elements[index]->is_register()) {
entry_frame_->register_locations_[elements[index]->reg().code()] =
index;
} else if (elements[index]->is_copy()) {
entry_frame_->elements_[elements[index]->index()].set_copied();
}
}
}
......@@ -211,9 +215,12 @@ void JumpTarget::ComputeEntryFrame(int mergable_elements) {
entry_frame_->elements_.Add(FrameElement::MemoryElement());
} else {
entry_frame_->elements_.Add(*elements[index]);
entry_frame_->elements_[index].clear_copied();
if (elements[index]->is_register()) {
entry_frame_->register_locations_[elements[index]->reg().code()] =
index;
} else if (elements[index]->is_copy()) {
entry_frame_->elements_[elements[index]->index()].set_copied();
}
}
}
......@@ -261,27 +268,25 @@ void JumpTarget::ComputeEntryFrame(int mergable_elements) {
}
}
// If there was a register choice, use it. If not do nothing
// (the element is already recorded as in memory)
if (best_reg_code != no_reg.code_) {
// If there was a register choice, use it. Preserve the copied
// flag on the element.
bool is_copied = entry_frame_->elements_[i].is_copied();
Register reg = { best_reg_code };
entry_frame_->elements_[i] =
FrameElement::RegisterElement(reg,
FrameElement::NOT_SYNCED);
if (is_copied) entry_frame_->elements_[i].set_copied();
entry_frame_->register_locations_[best_reg_code] = i;
}
// If there was no register found, the element is already
// recorded as in memory.
}
}
// Set the copied flags in the frame to be exact. This assumes that
// the backing store of copies is always lower in the frame.
// Set the static type of frame elements.
for (int i = 0; i < length; i++) {
FrameElement* current = &entry_frame_->elements_[i];
current->clear_copied();
if (current->is_copy()) {
entry_frame_->elements_[current->index()].set_copied();
}
if (direction_ == BIDIRECTIONAL && i >= high_water_mark) {
current->set_static_type(StaticType::unknown());
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment