From 0b3ce1dd9ee0ecfb4191dc5d24cc35a5f174ad6c Mon Sep 17 00:00:00 2001 From: "fschneider@chromium.org" Date: Tue, 24 Jan 2012 02:13:28 +0000 Subject: [PATCH] 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. Review URL: http://codereview.chromium.org/9160018 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10481 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/deoptimizer.h | 2 +- src/lithium-allocator.cc | 12 ++++++------ src/lithium.cc | 4 +--- src/lithium.h | 16 ++++++---------- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/deoptimizer.h b/src/deoptimizer.h index 284676c36..d7ef3346b 100644 --- a/src/deoptimizer.h +++ b/src/deoptimizer.h @@ -258,7 +258,7 @@ class Deoptimizer : public Malloced { }; private: - static const int kNumberOfEntries = 4096; + static const int kNumberOfEntries = 8192; Deoptimizer(Isolate* isolate, JSFunction* function, diff --git a/src/lithium-allocator.cc b/src/lithium-allocator.cc index 1601dcf14..0e5c992fb 100644 --- a/src/lithium-allocator.cc +++ b/src/lithium-allocator.cc @@ -161,9 +161,8 @@ LiveRange::LiveRange(int id) 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 @@ void LiveRange::MakeSpilled() { 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 @@ void LAllocator::RecordUse(HValue* value, LUnallocated* operand) { int LAllocator::max_initial_value_ids() { - return LUnallocated::kMaxVirtualRegisters / 32; + return LUnallocated::kMaxVirtualRegisters / 16; } diff --git a/src/lithium.cc b/src/lithium.cc index 31b16982d..5beca3306 100644 --- a/src/lithium.cc +++ b/src/lithium.cc @@ -36,6 +36,7 @@ void LOperand::PrintTo(StringStream* stream) { LUnallocated* unalloc = NULL; switch (kind()) { case INVALID: + stream->Add("(0)"); break; case UNALLOCATED: unalloc = LUnallocated::cast(this); @@ -70,9 +71,6 @@ void LOperand::PrintTo(StringStream* stream) { case LUnallocated::ANY: stream->Add("(-)"); break; - case LUnallocated::IGNORE: - stream->Add("(0)"); - break; } break; case CONSTANT_OPERAND: diff --git a/src/lithium.h b/src/lithium.h index 325352009..e6f5f2336 100644 --- a/src/lithium.h +++ b/src/lithium.h @@ -59,6 +59,7 @@ class LOperand: public ZoneObject { 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 @@ class LUnallocated: public LOperand { 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 @@ class LUnallocated: public LOperand { // 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 @@ class LUnallocated: public LOperand { 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 @@ class LMoveOperands BASE_EMBEDDED { } 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. -- 2.34.1