Make LiveRange objects 1 word smaller by using a bool instead of enum for register...
authorfschneider@chromium.org <fschneider@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 10 Nov 2011 15:37:24 +0000 (15:37 +0000)
committerfschneider@chromium.org <fschneider@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 10 Nov 2011 15:37:24 +0000 (15:37 +0000)
Review URL: http://codereview.chromium.org/8462016

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9959 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/lithium-allocator.cc
src/lithium-allocator.h

index 35281eb20fd11a3ffe92ebda170f3b79b50c6faf..3ef518dbf95b875e682b892f089c432d2e00d9f9 100644 (file)
@@ -152,8 +152,8 @@ bool LiveRange::HasOverlap(UseInterval* target) const {
 LiveRange::LiveRange(int id)
     : id_(id),
       spilled_(false),
+      is_double_(false),
       assigned_register_(kInvalidAssignment),
-      assigned_register_kind_(NONE),
       last_interval_(NULL),
       first_interval_(NULL),
       first_pos_(NULL),
@@ -169,7 +169,7 @@ LiveRange::LiveRange(int id)
 void LiveRange::set_assigned_register(int reg, RegisterKind register_kind) {
   ASSERT(!HasRegisterAssigned() && !IsSpilled());
   assigned_register_ = reg;
-  assigned_register_kind_ = register_kind;
+  is_double_ = (register_kind == DOUBLE_REGISTERS);
   ConvertOperands();
 }
 
@@ -555,7 +555,7 @@ LAllocator::LAllocator(int num_values, HGraph* graph)
       reusable_slots_(8),
       next_virtual_register_(num_values),
       first_artificial_register_(num_values),
-      mode_(NONE),
+      mode_(GENERAL_REGISTERS),
       num_registers_(-1),
       graph_(graph),
       has_osr_entry_(false) {}
@@ -1466,7 +1466,6 @@ void LAllocator::ProcessOsrEntry() {
 void LAllocator::AllocateGeneralRegisters() {
   HPhase phase("Allocate general registers", this);
   num_registers_ = Register::kNumAllocatableRegisters;
-  mode_ = GENERAL_REGISTERS;
   AllocateRegisters();
 }
 
@@ -1480,7 +1479,6 @@ void LAllocator::AllocateDoubleRegisters() {
 
 
 void LAllocator::AllocateRegisters() {
-  ASSERT(mode_ != NONE);
   ASSERT(unhandled_live_ranges_.is_empty());
 
   for (int i = 0; i < live_ranges_.length(); ++i) {
@@ -1585,7 +1583,6 @@ void LAllocator::AllocateRegisters() {
 
 
 const char* LAllocator::RegisterName(int allocation_index) {
-  ASSERT(mode_ != NONE);
   if (mode_ == GENERAL_REGISTERS) {
     return Register::AllocationIndexToString(allocation_index);
   } else {
index e4e64974b51e101184e27b4f717968e5029a1cb2..610beefc6d27367630e0766f376f3b0a95b24409 100644 (file)
@@ -146,7 +146,6 @@ class LifetimePosition {
 
 
 enum RegisterKind {
-  NONE,
   GENERAL_REGISTERS,
   DOUBLE_REGISTERS
 };
@@ -319,7 +318,7 @@ class LiveRange: public ZoneObject {
   // live range to the result live range.
   void SplitAt(LifetimePosition position, LiveRange* result);
 
-  bool IsDouble() const { return assigned_register_kind_ == DOUBLE_REGISTERS; }
+  bool IsDouble() const { return is_double_; }
   bool HasRegisterAssigned() const {
     return assigned_register_ != kInvalidAssignment;
   }
@@ -377,8 +376,8 @@ class LiveRange: public ZoneObject {
 
   int id_;
   bool spilled_;
+  bool is_double_;
   int assigned_register_;
-  RegisterKind assigned_register_kind_;
   UseInterval* last_interval_;
   UseInterval* first_interval_;
   UsePosition* first_pos_;