Use placement-new operator in the register allocator.

Pass the zone explicitly to avoid calling Isolate::Current()->zone().
Review URL: https://chromiumcodereview.appspot.com/9430002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10785 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4b54dc52
......@@ -7617,7 +7617,7 @@ void HTracer::TraceLiveRange(LiveRange* range, const char* type) {
PrintIndent();
trace_.Add("%d %s", range->id(), type);
if (range->HasRegisterAssigned()) {
LOperand* op = range->CreateAssignedOperand();
LOperand* op = range->CreateAssignedOperand(ZONE);
int assigned_reg = op->index();
if (op->IsDoubleRegister()) {
trace_.Add(" \"%s\"",
......
This diff is collapsed.
......@@ -216,7 +216,7 @@ class UseInterval: public ZoneObject {
// Split this interval at the given position without effecting the
// live range that owns it. The interval must contain the position.
void SplitAt(LifetimePosition pos);
void SplitAt(LifetimePosition pos, Zone* zone);
// If this interval intersects with other return smallest position
// that belongs to both of them.
......@@ -277,7 +277,7 @@ class LiveRange: public ZoneObject {
public:
static const int kInvalidAssignment = 0x7fffffff;
explicit LiveRange(int id);
LiveRange(int id, Zone* zone);
UseInterval* first_interval() const { return first_interval_; }
UsePosition* first_pos() const { return first_pos_; }
......@@ -288,11 +288,13 @@ class LiveRange: public ZoneObject {
int id() const { return id_; }
bool IsFixed() const { return id_ < 0; }
bool IsEmpty() const { return first_interval() == NULL; }
LOperand* CreateAssignedOperand();
LOperand* CreateAssignedOperand(Zone* zone);
int assigned_register() const { return assigned_register_; }
int spill_start_index() const { return spill_start_index_; }
void set_assigned_register(int reg, RegisterKind register_kind);
void MakeSpilled();
void set_assigned_register(int reg,
RegisterKind register_kind,
Zone* zone);
void MakeSpilled(Zone* zone);
// Returns use position in this live range that follows both start
// and last processed use position.
......@@ -316,7 +318,7 @@ class LiveRange: public ZoneObject {
// the range.
// All uses following the given position will be moved from this
// live range to the result live range.
void SplitAt(LifetimePosition position, LiveRange* result);
void SplitAt(LifetimePosition position, LiveRange* result, Zone* zone);
bool IsDouble() const { return is_double_; }
bool HasRegisterAssigned() const {
......@@ -355,9 +357,15 @@ class LiveRange: public ZoneObject {
LifetimePosition FirstIntersection(LiveRange* other);
// Add a new interval or a new use position to this live range.
void EnsureInterval(LifetimePosition start, LifetimePosition end);
void AddUseInterval(LifetimePosition start, LifetimePosition end);
UsePosition* AddUsePosition(LifetimePosition pos, LOperand* operand);
void EnsureInterval(LifetimePosition start,
LifetimePosition end,
Zone* zone);
void AddUseInterval(LifetimePosition start,
LifetimePosition end,
Zone* zone);
UsePosition* AddUsePosition(LifetimePosition pos,
LOperand* operand,
Zone* zone);
// Shorten the most recently added interval by setting a new start.
void ShortenTo(LifetimePosition start);
......@@ -369,7 +377,7 @@ class LiveRange: public ZoneObject {
#endif
private:
void ConvertOperands();
void ConvertOperands(Zone* zone);
UseInterval* FirstSearchIntervalForPosition(LifetimePosition position) const;
void AdvanceLastProcessedMarker(UseInterval* to_start_of,
LifetimePosition but_not_past) const;
......@@ -400,8 +408,8 @@ class GrowableBitVector BASE_EMBEDDED {
return bits_->Contains(value);
}
void Add(int value) {
EnsureCapacity(value);
void Add(int value, Zone* zone) {
EnsureCapacity(value, zone);
bits_->Add(value);
}
......@@ -412,11 +420,11 @@ class GrowableBitVector BASE_EMBEDDED {
return bits_ != NULL && bits_->length() > value;
}
void EnsureCapacity(int value) {
void EnsureCapacity(int value, Zone* zone) {
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);
BitVector* new_bits = new(zone) BitVector(new_length);
if (bits_ != NULL) new_bits->CopyFrom(*bits_);
bits_ = new_bits;
}
......@@ -587,10 +595,9 @@ class LAllocator BASE_EMBEDDED {
inline LGap* GapAt(int index);
LChunk* chunk_;
Zone* zone_;
// Indicates success or failure during register allocation.
bool allocation_ok_;
LChunk* chunk_;
// During liveness analysis keep a mapping from block id to live_in sets
// for blocks already analyzed.
......@@ -621,6 +628,9 @@ class LAllocator BASE_EMBEDDED {
bool has_osr_entry_;
// Indicates success or failure during register allocation.
bool allocation_ok_;
DISALLOW_COPY_AND_ASSIGN(LAllocator);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment