Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1261)

Unified Diff: src/lithium-allocator.h

Issue 6065010: Remember required register kind when creating artificial virtual register. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/data-flow.h ('k') | src/lithium-allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « src/data-flow.h ('k') | src/lithium-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698