Chromium Code Reviews| Index: src/lithium-allocator.h |
| diff --git a/src/lithium-allocator.h b/src/lithium-allocator.h |
| index 3ec984e262f9e397801f98bbfcb11430d2b3f4b1..5587961f2043a6e4dd10055c05dfc8de7d10e272 100644 |
| --- a/src/lithium-allocator.h |
| +++ b/src/lithium-allocator.h |
| @@ -30,6 +30,7 @@ |
| #include "v8.h" |
| +#include "data-flow.h" |
| #include "zone.h" |
| namespace v8 { |
| @@ -754,6 +755,40 @@ class LiveRange: public ZoneObject { |
| }; |
| +class FlexibleBitVector BASE_EMBEDDED { |
|
Kevin Millikin (Chromium)
2011/01/03 16:44:46
Maybe GrowableBitVector is more descriptive? It n
|
| + public: |
| + FlexibleBitVector() : bits_(NULL) { } |
| + |
| + bool Contains(int value) const { |
|
Kevin Millikin (Chromium)
2011/01/03 16:44:46
Maybe it's too cute, but you could make this class
|
| + if (!InBitsRange(value)) return false; |
| + return bits_->Contains(value); |
| + } |
| + |
| + void Add(int value) { |
| + EnsureCapacity(value); |
| + bits_->Add(value); |
| + } |
| + |
| + private: |
| + static const int kInitialLength = 1024; |
|
Kevin Millikin (Chromium)
2011/01/03 16:44:46
This seems like a big initial length.
|
| + |
| + bool InBitsRange(int value) const { |
| + return bits_ != NULL && bits_->length() > value; |
| + } |
| + |
| + void EnsureCapacity(int value) { |
| + if (InBitsRange(value)) return; |
| + int new_length = bits_ == NULL ? kInitialLength : bits_->length(); |
| + while (new_length <= value) new_length *= 2; |
| + BitVector* new_bits = new BitVector(new_length); |
| + if (bits_ != NULL) new_bits->CopyFrom(*bits_); |
| + bits_ = new_bits; |
| + } |
| + |
| + BitVector* bits_; |
| +}; |
| + |
| + |
| class LAllocator BASE_EMBEDDED { |
| public: |
| explicit LAllocator(int first_virtual_register, HGraph* graph) |
| @@ -972,6 +1007,8 @@ class LAllocator BASE_EMBEDDED { |
| // Next virtual register number to be assigned to temporaries. |
| int next_virtual_register_; |
| + int first_artificial_register_; |
|
Kevin Millikin (Chromium)
2011/01/03 16:44:46
I'd be more comfortable with an initial value, eve
|
| + FlexibleBitVector double_artificial_registers_; |
| RegisterKind mode_; |
| int num_registers_; |