Reviewers: whessedk,

Description:
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.


Please review this at http://codereview.chromium.org/113198

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     src/jump-target.cc


Index: src/jump-target.cc
===================================================================
--- src/jump-target.cc  (revision 1906)
+++ src/jump-target.cc  (working copy)
@@ -195,13 +195,17 @@
    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 if they are.  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 @@
        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 @@
          }
        }

-      // 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 {



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

Reply via email to