Reviewers: Kevin Millikin,

Description:
Remove unnecessary IGNORE policy from Lithium operands.

1. This policy was only used for unused spill operands. I'm assigning
an INVALID LOperand to those instead. As a result, we only need
3 bits to encode the policy and have one more available for virtual
registers.

2. Furthermore, corrected the calculation of the maximal number of virtual
registers and changed the upper limit for the size of the Hydrogen IR
accordingly.

3. Doubled the maximal number of deoptimization entries to 8K.

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

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

Affected files:
  M     src/deoptimizer.h
  M     src/lithium-allocator.cc
  M     src/lithium.h
  M     src/lithium.cc


Index: src/deoptimizer.h
===================================================================
--- src/deoptimizer.h   (revision 10480)
+++ src/deoptimizer.h   (working copy)
@@ -258,7 +258,7 @@
   };

  private:
-  static const int kNumberOfEntries = 4096;
+  static const int kNumberOfEntries = 8192;

   Deoptimizer(Isolate* isolate,
               JSFunction* function,
Index: src/lithium-allocator.cc
===================================================================
--- src/lithium-allocator.cc    (revision 10480)
+++ src/lithium-allocator.cc    (working copy)
@@ -161,9 +161,8 @@
       next_(NULL),
       current_interval_(NULL),
       last_processed_use_(NULL),
-      spill_start_index_(kMaxInt) {
-  spill_operand_ = new LUnallocated(LUnallocated::IGNORE);
-}
+      spill_operand_(new LOperand()),
+      spill_start_index_(kMaxInt) { }


void LiveRange::set_assigned_register(int reg, RegisterKind register_kind) {
@@ -184,14 +183,15 @@


 bool LiveRange::HasAllocatedSpillOperand() const {
-  return spill_operand_ != NULL && !spill_operand_->IsUnallocated();
+  ASSERT(spill_operand_ != NULL);
+  return !spill_operand_->IsIgnored();
 }


 void LiveRange::SetSpillOperand(LOperand* operand) {
   ASSERT(!operand->IsUnallocated());
   ASSERT(spill_operand_ != NULL);
-  ASSERT(spill_operand_->IsUnallocated());
+  ASSERT(spill_operand_->IsIgnored());
   spill_operand_->ConvertTo(operand->kind(), operand->index());
 }

@@ -1643,7 +1643,7 @@


 int LAllocator::max_initial_value_ids() {
-  return LUnallocated::kMaxVirtualRegisters / 32;
+  return LUnallocated::kMaxVirtualRegisters / 16;
 }


Index: src/lithium.cc
===================================================================
--- src/lithium.cc      (revision 10480)
+++ src/lithium.cc      (working copy)
@@ -36,7 +36,9 @@
   LUnallocated* unalloc = NULL;
   switch (kind()) {
     case INVALID:
+      stream->Add("(0)");
       break;
+      break;
     case UNALLOCATED:
       unalloc = LUnallocated::cast(this);
       stream->Add("v%d", unalloc->virtual_register());
@@ -70,9 +72,6 @@
         case LUnallocated::ANY:
           stream->Add("(-)");
           break;
-        case LUnallocated::IGNORE:
-          stream->Add("(0)");
-          break;
       }
       break;
     case CONSTANT_OPERAND:
Index: src/lithium.h
===================================================================
--- src/lithium.h       (revision 10480)
+++ src/lithium.h       (working copy)
@@ -59,6 +59,7 @@
   bool IsDoubleRegister() const { return kind() == DOUBLE_REGISTER; }
   bool IsArgument() const { return kind() == ARGUMENT; }
   bool IsUnallocated() const { return kind() == UNALLOCATED; }
+  bool IsIgnored() const { return kind() == INVALID; }
   bool Equals(LOperand* other) const { return value_ == other->value_; }
   int VirtualRegister();

@@ -89,8 +90,7 @@
     FIXED_SLOT,
     MUST_HAVE_REGISTER,
     WRITABLE_REGISTER,
-    SAME_AS_FIRST_INPUT,
-    IGNORE
+    SAME_AS_FIRST_INPUT
   };

   // Lifetime of operand inside the instruction.
@@ -121,9 +121,9 @@

   // The superclass has a KindField.  Some policies have a signed fixed
   // index in the upper bits.
-  static const int kPolicyWidth = 4;
+  static const int kPolicyWidth = 3;
   static const int kLifetimeWidth = 1;
-  static const int kVirtualRegisterWidth = 17;
+  static const int kVirtualRegisterWidth = 18;

   static const int kPolicyShift = kKindFieldWidth;
   static const int kLifetimeShift = kPolicyShift + kPolicyWidth;
@@ -143,12 +143,10 @@
                         kVirtualRegisterWidth> {
   };

-  static const int kMaxVirtualRegisters = 1 << (kVirtualRegisterWidth + 1);
+  static const int kMaxVirtualRegisters = 1 << kVirtualRegisterWidth;
   static const int kMaxFixedIndex = 63;
   static const int kMinFixedIndex = -64;

-  bool HasIgnorePolicy() const { return policy() == IGNORE; }
-  bool HasNoPolicy() const { return policy() == NONE; }
   bool HasAnyPolicy() const {
     return policy() == ANY;
   }
@@ -234,9 +232,7 @@
   }

   bool IsIgnored() const {
-    return destination_ != NULL &&
-        destination_->IsUnallocated() &&
-        LUnallocated::cast(destination_)->HasIgnorePolicy();
+    return destination_ != NULL && destination_->IsIgnored();
   }

   // We clear both operands to indicate move that's been eliminated.


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

Reply via email to