Initialize zone lists in the register allocator with more reasonable initial capacities.
Also replace fixed length zone lists with embedded vectors for the fixed live ranges. Review URL: http://codereview.chromium.org/6660023 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7122 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
ae38aedae4
commit
241e4d364e
@ -5734,12 +5734,12 @@ void HTracer::TraceLiveRanges(const char* name, LAllocator* allocator) {
|
|||||||
Tag tag(this, "intervals");
|
Tag tag(this, "intervals");
|
||||||
PrintStringProperty("name", name);
|
PrintStringProperty("name", name);
|
||||||
|
|
||||||
const ZoneList<LiveRange*>* fixed_d = allocator->fixed_double_live_ranges();
|
const Vector<LiveRange*>* fixed_d = allocator->fixed_double_live_ranges();
|
||||||
for (int i = 0; i < fixed_d->length(); ++i) {
|
for (int i = 0; i < fixed_d->length(); ++i) {
|
||||||
TraceLiveRange(fixed_d->at(i), "fixed");
|
TraceLiveRange(fixed_d->at(i), "fixed");
|
||||||
}
|
}
|
||||||
|
|
||||||
const ZoneList<LiveRange*>* fixed = allocator->fixed_live_ranges();
|
const Vector<LiveRange*>* fixed = allocator->fixed_live_ranges();
|
||||||
for (int i = 0; i < fixed->length(); ++i) {
|
for (int i = 0; i < fixed->length(); ++i) {
|
||||||
TraceLiveRange(fixed->at(i), "fixed");
|
TraceLiveRange(fixed->at(i), "fixed");
|
||||||
}
|
}
|
||||||
|
@ -525,6 +525,24 @@ LifetimePosition LiveRange::FirstIntersection(LiveRange* other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LAllocator::LAllocator(int num_values, HGraph* graph)
|
||||||
|
: chunk_(NULL),
|
||||||
|
live_in_sets_(graph->blocks()->length()),
|
||||||
|
live_ranges_(num_values * 2),
|
||||||
|
fixed_live_ranges_(NULL),
|
||||||
|
fixed_double_live_ranges_(NULL),
|
||||||
|
unhandled_live_ranges_(num_values * 2),
|
||||||
|
active_live_ranges_(8),
|
||||||
|
inactive_live_ranges_(8),
|
||||||
|
reusable_slots_(8),
|
||||||
|
next_virtual_register_(num_values),
|
||||||
|
first_artificial_register_(num_values),
|
||||||
|
mode_(NONE),
|
||||||
|
num_registers_(-1),
|
||||||
|
graph_(graph),
|
||||||
|
has_osr_entry_(false) {}
|
||||||
|
|
||||||
|
|
||||||
void LAllocator::InitializeLivenessAnalysis() {
|
void LAllocator::InitializeLivenessAnalysis() {
|
||||||
// Initialize the live_in sets for each block to NULL.
|
// Initialize the live_in sets for each block to NULL.
|
||||||
int block_count = graph_->blocks()->length();
|
int block_count = graph_->blocks()->length();
|
||||||
@ -618,11 +636,7 @@ LOperand* LAllocator::AllocateFixed(LUnallocated* operand,
|
|||||||
|
|
||||||
|
|
||||||
LiveRange* LAllocator::FixedLiveRangeFor(int index) {
|
LiveRange* LAllocator::FixedLiveRangeFor(int index) {
|
||||||
if (index >= fixed_live_ranges_.length()) {
|
ASSERT(index < Register::kNumAllocatableRegisters);
|
||||||
fixed_live_ranges_.AddBlock(NULL,
|
|
||||||
index - fixed_live_ranges_.length() + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
LiveRange* result = fixed_live_ranges_[index];
|
LiveRange* result = fixed_live_ranges_[index];
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
result = new LiveRange(FixedLiveRangeID(index));
|
result = new LiveRange(FixedLiveRangeID(index));
|
||||||
@ -635,11 +649,7 @@ LiveRange* LAllocator::FixedLiveRangeFor(int index) {
|
|||||||
|
|
||||||
|
|
||||||
LiveRange* LAllocator::FixedDoubleLiveRangeFor(int index) {
|
LiveRange* LAllocator::FixedDoubleLiveRangeFor(int index) {
|
||||||
if (index >= fixed_double_live_ranges_.length()) {
|
ASSERT(index < DoubleRegister::kNumAllocatableRegisters);
|
||||||
fixed_double_live_ranges_.AddBlock(NULL,
|
|
||||||
index - fixed_double_live_ranges_.length() + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
LiveRange* result = fixed_double_live_ranges_[index];
|
LiveRange* result = fixed_double_live_ranges_[index];
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
result = new LiveRange(FixedDoubleLiveRangeID(index));
|
result = new LiveRange(FixedDoubleLiveRangeID(index));
|
||||||
@ -650,6 +660,7 @@ LiveRange* LAllocator::FixedDoubleLiveRangeFor(int index) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LiveRange* LAllocator::LiveRangeFor(int index) {
|
LiveRange* LAllocator::LiveRangeFor(int index) {
|
||||||
if (index >= live_ranges_.length()) {
|
if (index >= live_ranges_.length()) {
|
||||||
live_ranges_.AddBlock(NULL, index - live_ranges_.length() + 1);
|
live_ranges_.AddBlock(NULL, index - live_ranges_.length() + 1);
|
||||||
|
@ -428,22 +428,7 @@ class GrowableBitVector BASE_EMBEDDED {
|
|||||||
|
|
||||||
class LAllocator BASE_EMBEDDED {
|
class LAllocator BASE_EMBEDDED {
|
||||||
public:
|
public:
|
||||||
explicit LAllocator(int first_virtual_register, HGraph* graph)
|
LAllocator(int first_virtual_register, HGraph* graph);
|
||||||
: chunk_(NULL),
|
|
||||||
live_in_sets_(0),
|
|
||||||
live_ranges_(16),
|
|
||||||
fixed_live_ranges_(8),
|
|
||||||
fixed_double_live_ranges_(8),
|
|
||||||
unhandled_live_ranges_(8),
|
|
||||||
active_live_ranges_(8),
|
|
||||||
inactive_live_ranges_(8),
|
|
||||||
reusable_slots_(8),
|
|
||||||
next_virtual_register_(first_virtual_register),
|
|
||||||
first_artificial_register_(first_virtual_register),
|
|
||||||
mode_(NONE),
|
|
||||||
num_registers_(-1),
|
|
||||||
graph_(graph),
|
|
||||||
has_osr_entry_(false) {}
|
|
||||||
|
|
||||||
static void Setup();
|
static void Setup();
|
||||||
static void TraceAlloc(const char* msg, ...);
|
static void TraceAlloc(const char* msg, ...);
|
||||||
@ -468,10 +453,10 @@ class LAllocator BASE_EMBEDDED {
|
|||||||
void Allocate(LChunk* chunk);
|
void Allocate(LChunk* chunk);
|
||||||
|
|
||||||
const ZoneList<LiveRange*>* live_ranges() const { return &live_ranges_; }
|
const ZoneList<LiveRange*>* live_ranges() const { return &live_ranges_; }
|
||||||
const ZoneList<LiveRange*>* fixed_live_ranges() const {
|
const Vector<LiveRange*>* fixed_live_ranges() const {
|
||||||
return &fixed_live_ranges_;
|
return &fixed_live_ranges_;
|
||||||
}
|
}
|
||||||
const ZoneList<LiveRange*>* fixed_double_live_ranges() const {
|
const Vector<LiveRange*>* fixed_double_live_ranges() const {
|
||||||
return &fixed_double_live_ranges_;
|
return &fixed_double_live_ranges_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -616,8 +601,10 @@ class LAllocator BASE_EMBEDDED {
|
|||||||
ZoneList<LiveRange*> live_ranges_;
|
ZoneList<LiveRange*> live_ranges_;
|
||||||
|
|
||||||
// Lists of live ranges
|
// Lists of live ranges
|
||||||
ZoneList<LiveRange*> fixed_live_ranges_;
|
EmbeddedVector<LiveRange*, Register::kNumAllocatableRegisters>
|
||||||
ZoneList<LiveRange*> fixed_double_live_ranges_;
|
fixed_live_ranges_;
|
||||||
|
EmbeddedVector<LiveRange*, DoubleRegister::kNumAllocatableRegisters>
|
||||||
|
fixed_double_live_ranges_;
|
||||||
ZoneList<LiveRange*> unhandled_live_ranges_;
|
ZoneList<LiveRange*> unhandled_live_ranges_;
|
||||||
ZoneList<LiveRange*> active_live_ranges_;
|
ZoneList<LiveRange*> active_live_ranges_;
|
||||||
ZoneList<LiveRange*> inactive_live_ranges_;
|
ZoneList<LiveRange*> inactive_live_ranges_;
|
||||||
|
Loading…
Reference in New Issue
Block a user