V8 Project
v8::internal::LiveRange Class Reference

#include <lithium-allocator.h>

+ Inheritance diagram for v8::internal::LiveRange:
+ Collaboration diagram for v8::internal::LiveRange:

Public Member Functions

 LiveRange (int id, Zone *zone)
 
UseIntervalfirst_interval () const
 
UsePositionfirst_pos () const
 
LiveRangeparent () const
 
LiveRangeTopLevel ()
 
LiveRangenext () const
 
bool IsChild () const
 
int id () const
 
bool IsFixed () const
 
bool IsEmpty () const
 
LOperandCreateAssignedOperand (Zone *zone)
 
int assigned_register () const
 
int spill_start_index () const
 
void set_assigned_register (int reg, Zone *zone)
 
void MakeSpilled (Zone *zone)
 
UsePositionNextUsePosition (LifetimePosition start)
 
UsePositionNextRegisterPosition (LifetimePosition start)
 
UsePositionNextUsePositionRegisterIsBeneficial (LifetimePosition start)
 
UsePositionPreviousUsePositionRegisterIsBeneficial (LifetimePosition start)
 
bool CanBeSpilled (LifetimePosition pos)
 
void SplitAt (LifetimePosition position, LiveRange *result, Zone *zone)
 
RegisterKind Kind () const
 
bool HasRegisterAssigned () const
 
bool IsSpilled () const
 
LOperandcurrent_hint_operand () const
 
LOperandFirstHint () const
 
LifetimePosition Start () const
 
LifetimePosition End () const
 
bool HasAllocatedSpillOperand () const
 
LOperandGetSpillOperand () const
 
void SetSpillOperand (LOperand *operand)
 
void SetSpillStartIndex (int start)
 
bool ShouldBeAllocatedBefore (const LiveRange *other) const
 
bool CanCover (LifetimePosition position) const
 
bool Covers (LifetimePosition position)
 
LifetimePosition FirstIntersection (LiveRange *other)
 
void EnsureInterval (LifetimePosition start, LifetimePosition end, Zone *zone)
 
void AddUseInterval (LifetimePosition start, LifetimePosition end, Zone *zone)
 
void AddUsePosition (LifetimePosition pos, LOperand *operand, LOperand *hint, Zone *zone)
 
void ShortenTo (LifetimePosition start)
 
- Public Member Functions inherited from v8::internal::ZoneObject
 INLINE (void *operator new(size_t size, Zone *zone))
 
void operator delete (void *, size_t)
 
void operator delete (void *pointer, Zone *zone)
 

Static Public Attributes

static const int kInvalidAssignment = 0x7fffffff
 

Private Member Functions

void ConvertOperands (Zone *zone)
 
UseIntervalFirstSearchIntervalForPosition (LifetimePosition position) const
 
void AdvanceLastProcessedMarker (UseInterval *to_start_of, LifetimePosition but_not_past) const
 

Private Attributes

int id_
 
bool spilled_
 
RegisterKind kind_
 
int assigned_register_
 
UseIntervallast_interval_
 
UseIntervalfirst_interval_
 
UsePositionfirst_pos_
 
LiveRangeparent_
 
LiveRangenext_
 
UseIntervalcurrent_interval_
 
UsePositionlast_processed_use_
 
LOperandcurrent_hint_operand_
 
LOperandspill_operand_
 
int spill_start_index_
 

Friends

class LAllocator
 

Detailed Description

Definition at line 190 of file lithium-allocator.h.

Constructor & Destructor Documentation

◆ LiveRange()

v8::internal::LiveRange::LiveRange ( int  id,
Zone zone 
)

Definition at line 98 of file lithium-allocator.cc.

99  : id_(id),
100  spilled_(false),
105  first_pos_(NULL),
106  parent_(NULL),
107  next_(NULL),
111  spill_operand_(new (zone) LOperand()),
static const int kInvalidAssignment
UsePosition * last_processed_use_
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
const int kMaxInt
Definition: globals.h:109
@ UNALLOCATED_REGISTERS
Definition: lithium.h:779

Member Function Documentation

◆ AddUseInterval()

void v8::internal::LiveRange::AddUseInterval ( LifetimePosition  start,
LifetimePosition  end,
Zone zone 
)

Definition at line 388 of file lithium-allocator.cc.

390  {
391  LAllocator::TraceAlloc("Add to live range %d interval [%d %d[\n",
392  id_,
393  start.Value(),
394  end.Value());
395  if (first_interval_ == NULL) {
396  UseInterval* interval = new(zone) UseInterval(start, end);
397  first_interval_ = interval;
398  last_interval_ = interval;
399  } else {
400  if (end.Value() == first_interval_->start().Value()) {
401  first_interval_->set_start(start);
402  } else if (end.Value() < first_interval_->start().Value()) {
403  UseInterval* interval = new(zone) UseInterval(start, end);
404  interval->set_next(first_interval_);
405  first_interval_ = interval;
406  } else {
407  // Order of instruction's processing (see ProcessInstructions) guarantees
408  // that each new use interval either precedes or intersects with
409  // last added interval.
410  DCHECK(start.Value() < first_interval_->end().Value());
413  }
414  }
415 }
LifetimePosition end() const
void set_start(LifetimePosition start)
LifetimePosition start() const
#define DCHECK(condition)
Definition: logging.h:205
static LifetimePosition Min(LifetimePosition a, LifetimePosition b)
static LifetimePosition Max(LifetimePosition a, LifetimePosition b)

References DCHECK, v8::internal::UseInterval::end(), v8::internal::UseInterval::end_, first_interval_, id_, last_interval_, v8::internal::Max(), v8::internal::Min(), NULL, v8::internal::UseInterval::set_next(), v8::internal::UseInterval::set_start(), v8::internal::UseInterval::start(), v8::internal::UseInterval::start_, and v8::internal::LifetimePosition::Value().

+ Here is the call graph for this function:

◆ AddUsePosition()

void v8::internal::LiveRange::AddUsePosition ( LifetimePosition  pos,
LOperand operand,
LOperand hint,
Zone zone 
)

Definition at line 418 of file lithium-allocator.cc.

421  {
422  LAllocator::TraceAlloc("Add to live range %d use position %d\n",
423  id_,
424  pos.Value());
425  UsePosition* use_pos = new(zone) UsePosition(pos, operand, hint);
426  UsePosition* prev_hint = NULL;
427  UsePosition* prev = NULL;
428  UsePosition* current = first_pos_;
429  while (current != NULL && current->pos().Value() < pos.Value()) {
430  prev_hint = current->HasHint() ? current : prev_hint;
431  prev = current;
432  current = current->next();
433  }
434 
435  if (prev == NULL) {
436  use_pos->set_next(first_pos_);
437  first_pos_ = use_pos;
438  } else {
439  use_pos->next_ = prev->next_;
440  prev->next_ = use_pos;
441  }
442 
443  if (prev_hint == NULL && use_pos->HasHint()) {
444  current_hint_operand_ = hint;
445  }
446 }

References current_hint_operand_, first_pos_, v8::internal::UsePosition::HasHint(), id_, v8::internal::UsePosition::next(), v8::internal::UsePosition::next_, NULL, v8::internal::UsePosition::pos(), v8::internal::UsePosition::set_next(), and v8::internal::LifetimePosition::Value().

+ Here is the call graph for this function:

◆ AdvanceLastProcessedMarker()

void v8::internal::LiveRange::AdvanceLastProcessedMarker ( UseInterval to_start_of,
LifetimePosition  but_not_past 
) const
private

Definition at line 235 of file lithium-allocator.cc.

236  {
237  if (to_start_of == NULL) return;
238  if (to_start_of->start().Value() > but_not_past.Value()) return;
239  LifetimePosition start =
241  : current_interval_->start();
242  if (to_start_of->start().Value() > start.Value()) {
243  current_interval_ = to_start_of;
244  }
245 }
static LifetimePosition Invalid()

References current_interval_, v8::internal::LifetimePosition::Invalid(), NULL, v8::internal::UseInterval::start(), and v8::internal::LifetimePosition::Value().

Referenced by Covers(), and FirstIntersection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assigned_register()

int v8::internal::LiveRange::assigned_register ( ) const
inline

Definition at line 206 of file lithium-allocator.h.

206 { return assigned_register_; }

References assigned_register_.

Referenced by CreateAssignedOperand().

+ Here is the caller graph for this function:

◆ CanBeSpilled()

bool v8::internal::LiveRange::CanBeSpilled ( LifetimePosition  pos)

Definition at line 187 of file lithium-allocator.cc.

187  {
188  // We cannot spill a live range that has a use requiring a register
189  // at the current or the immediate next position.
190  UsePosition* use_pos = NextRegisterPosition(pos);
191  if (use_pos == NULL) return true;
192  return
193  use_pos->pos().Value() > pos.NextInstruction().InstructionEnd().Value();
194 }
UsePosition * NextRegisterPosition(LifetimePosition start)

References v8::internal::LifetimePosition::InstructionEnd(), v8::internal::LifetimePosition::NextInstruction(), NextRegisterPosition(), NULL, v8::internal::UsePosition::pos(), and v8::internal::LifetimePosition::Value().

+ Here is the call graph for this function:

◆ CanCover()

bool v8::internal::LiveRange::CanCover ( LifetimePosition  position) const

Definition at line 466 of file lithium-allocator.cc.

466  {
467  if (IsEmpty()) return false;
468  return Start().Value() <= position.Value() &&
469  position.Value() < End().Value();
470 }
LifetimePosition Start() const
LifetimePosition End() const

References End(), IsEmpty(), Start(), and v8::internal::LifetimePosition::Value().

Referenced by Covers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConvertOperands()

void v8::internal::LiveRange::ConvertOperands ( Zone zone)
private

Definition at line 449 of file lithium-allocator.cc.

449  {
450  LOperand* op = CreateAssignedOperand(zone);
451  UsePosition* use_pos = first_pos();
452  while (use_pos != NULL) {
453  DCHECK(Start().Value() <= use_pos->pos().Value() &&
454  use_pos->pos().Value() <= End().Value());
455 
456  if (use_pos->HasOperand()) {
457  DCHECK(op->IsRegister() || op->IsDoubleRegister() ||
458  !use_pos->RequiresRegister());
459  use_pos->operand()->ConvertTo(op->kind(), op->index());
460  }
461  use_pos = use_pos->next();
462  }
463 }
LOperand * CreateAssignedOperand(Zone *zone)
UsePosition * first_pos() const

References v8::internal::LOperand::ConvertTo(), CreateAssignedOperand(), DCHECK, End(), first_pos(), v8::internal::UsePosition::HasOperand(), v8::internal::LOperand::index(), v8::internal::LOperand::kind(), v8::internal::UsePosition::next(), NULL, v8::internal::UsePosition::operand(), v8::internal::UsePosition::pos(), v8::internal::UsePosition::RequiresRegister(), Start(), and v8::internal::LifetimePosition::Value().

Referenced by MakeSpilled(), and set_assigned_register().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Covers()

bool v8::internal::LiveRange::Covers ( LifetimePosition  position)

Definition at line 473 of file lithium-allocator.cc.

473  {
474  if (!CanCover(position)) return false;
475  UseInterval* start_search = FirstSearchIntervalForPosition(position);
476  for (UseInterval* interval = start_search;
477  interval != NULL;
478  interval = interval->next()) {
479  DCHECK(interval->next() == NULL ||
480  interval->next()->start().Value() >= interval->start().Value());
481  AdvanceLastProcessedMarker(interval, position);
482  if (interval->Contains(position)) return true;
483  if (interval->start().Value() > position.Value()) return false;
484  }
485  return false;
486 }
void AdvanceLastProcessedMarker(UseInterval *to_start_of, LifetimePosition but_not_past) const
bool CanCover(LifetimePosition position) const
UseInterval * FirstSearchIntervalForPosition(LifetimePosition position) const

References AdvanceLastProcessedMarker(), CanCover(), DCHECK, FirstSearchIntervalForPosition(), NULL, and v8::internal::LifetimePosition::Value().

+ Here is the call graph for this function:

◆ CreateAssignedOperand()

LOperand * v8::internal::LiveRange::CreateAssignedOperand ( Zone zone)

Definition at line 197 of file lithium-allocator.cc.

197  {
198  LOperand* op = NULL;
199  if (HasRegisterAssigned()) {
200  DCHECK(!IsSpilled());
201  switch (Kind()) {
202  case GENERAL_REGISTERS:
203  op = LRegister::Create(assigned_register(), zone);
204  break;
205  case DOUBLE_REGISTERS:
206  op = LDoubleRegister::Create(assigned_register(), zone);
207  break;
208  default:
209  UNREACHABLE();
210  }
211  } else if (IsSpilled()) {
213  op = TopLevel()->GetSpillOperand();
214  DCHECK(!op->IsUnallocated());
215  } else {
216  LUnallocated* unalloc = new(zone) LUnallocated(LUnallocated::NONE);
217  unalloc->set_virtual_register(id_);
218  op = unalloc;
219  }
220  return op;
221 }
RegisterKind Kind() const
LOperand * GetSpillOperand() const
#define UNREACHABLE()
Definition: logging.h:30
@ GENERAL_REGISTERS
Definition: lithium.h:780
@ DOUBLE_REGISTERS
Definition: lithium.h:781

References assigned_register(), DCHECK, v8::internal::DOUBLE_REGISTERS, v8::internal::GENERAL_REGISTERS, GetSpillOperand(), HasRegisterAssigned(), id_, IsSpilled(), Kind(), v8::internal::LUnallocated::NONE, NULL, v8::internal::LUnallocated::set_virtual_register(), TopLevel(), and UNREACHABLE.

Referenced by ConvertOperands().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ current_hint_operand()

LOperand* v8::internal::LiveRange::current_hint_operand ( ) const
inline

Definition at line 245 of file lithium-allocator.h.

245  {
247  return current_hint_operand_;
248  }
LOperand * FirstHint() const

References current_hint_operand_, DCHECK, and FirstHint().

+ Here is the call graph for this function:

◆ End()

LifetimePosition v8::internal::LiveRange::End ( ) const
inline

Definition at line 261 of file lithium-allocator.h.

261  {
262  DCHECK(!IsEmpty());
263  return last_interval_->end();
264  }

References DCHECK, v8::internal::UseInterval::end(), IsEmpty(), and last_interval_.

Referenced by CanCover(), ConvertOperands(), and FirstIntersection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EnsureInterval()

void v8::internal::LiveRange::EnsureInterval ( LifetimePosition  start,
LifetimePosition  end,
Zone zone 
)

Definition at line 363 of file lithium-allocator.cc.

365  {
366  LAllocator::TraceAlloc("Ensure live range %d in interval [%d %d[\n",
367  id_,
368  start.Value(),
369  end.Value());
370  LifetimePosition new_end = end;
371  while (first_interval_ != NULL &&
372  first_interval_->start().Value() <= end.Value()) {
373  if (first_interval_->end().Value() > end.Value()) {
374  new_end = first_interval_->end();
375  }
377  }
378 
379  UseInterval* new_interval = new(zone) UseInterval(start, new_end);
380  new_interval->next_ = first_interval_;
381  first_interval_ = new_interval;
382  if (new_interval->next() == NULL) {
383  last_interval_ = new_interval;
384  }
385 }
UseInterval * next() const

References v8::internal::UseInterval::end(), first_interval_, id_, last_interval_, v8::internal::UseInterval::next(), v8::internal::UseInterval::next_, NULL, v8::internal::UseInterval::start(), and v8::internal::LifetimePosition::Value().

+ Here is the call graph for this function:

◆ first_interval()

UseInterval* v8::internal::LiveRange::first_interval ( ) const
inline

Definition at line 196 of file lithium-allocator.h.

196 { return first_interval_; }

References first_interval_.

Referenced by FirstIntersection(), IsEmpty(), and Start().

+ Here is the caller graph for this function:

◆ first_pos()

UsePosition* v8::internal::LiveRange::first_pos ( ) const
inline

Definition at line 197 of file lithium-allocator.h.

197 { return first_pos_; }

References first_pos_.

Referenced by ConvertOperands(), NextUsePosition(), PreviousUsePositionRegisterIsBeneficial(), and ShouldBeAllocatedBefore().

+ Here is the caller graph for this function:

◆ FirstHint()

LOperand* v8::internal::LiveRange::FirstHint ( ) const
inline

Definition at line 249 of file lithium-allocator.h.

249  {
250  UsePosition* pos = first_pos_;
251  while (pos != NULL && !pos->HasHint()) pos = pos->next();
252  if (pos != NULL) return pos->hint();
253  return NULL;
254  }
UsePosition * next() const

References first_pos_, v8::internal::UsePosition::HasHint(), v8::internal::UsePosition::hint(), v8::internal::UsePosition::next(), and NULL.

Referenced by current_hint_operand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FirstIntersection()

LifetimePosition v8::internal::LiveRange::FirstIntersection ( LiveRange other)

Definition at line 489 of file lithium-allocator.cc.

489  {
490  UseInterval* b = other->first_interval();
491  if (b == NULL) return LifetimePosition::Invalid();
492  LifetimePosition advance_last_processed_up_to = b->start();
493  UseInterval* a = FirstSearchIntervalForPosition(b->start());
494  while (a != NULL && b != NULL) {
495  if (a->start().Value() > other->End().Value()) break;
496  if (b->start().Value() > End().Value()) break;
497  LifetimePosition cur_intersection = a->Intersect(b);
498  if (cur_intersection.IsValid()) {
499  return cur_intersection;
500  }
501  if (a->start().Value() < b->start().Value()) {
502  a = a->next();
503  if (a == NULL || a->start().Value() > other->End().Value()) break;
504  AdvanceLastProcessedMarker(a, advance_last_processed_up_to);
505  } else {
506  b = b->next();
507  }
508  }
509  return LifetimePosition::Invalid();
510 }

References AdvanceLastProcessedMarker(), End(), first_interval(), FirstSearchIntervalForPosition(), v8::internal::UseInterval::Intersect(), v8::internal::LifetimePosition::Invalid(), v8::internal::LifetimePosition::IsValid(), v8::internal::UseInterval::next(), NULL, v8::internal::UseInterval::start(), and v8::internal::LifetimePosition::Value().

+ Here is the call graph for this function:

◆ FirstSearchIntervalForPosition()

UseInterval * v8::internal::LiveRange::FirstSearchIntervalForPosition ( LifetimePosition  position) const
private

Definition at line 224 of file lithium-allocator.cc.

225  {
226  if (current_interval_ == NULL) return first_interval_;
227  if (current_interval_->start().Value() > position.Value()) {
229  return first_interval_;
230  }
231  return current_interval_;
232 }

References current_interval_, first_interval_, NULL, v8::internal::UseInterval::start(), and v8::internal::LifetimePosition::Value().

Referenced by Covers(), FirstIntersection(), and SplitAt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSpillOperand()

LOperand* v8::internal::LiveRange::GetSpillOperand ( ) const
inline

Definition at line 267 of file lithium-allocator.h.

267 { return spill_operand_; }

References spill_operand_.

Referenced by CreateAssignedOperand().

+ Here is the caller graph for this function:

◆ HasAllocatedSpillOperand()

bool v8::internal::LiveRange::HasAllocatedSpillOperand ( ) const

Definition at line 131 of file lithium-allocator.cc.

131  {
133  return !spill_operand_->IsIgnored();
134 }

References DCHECK, NULL, and spill_operand_.

Referenced by MakeSpilled().

+ Here is the caller graph for this function:

◆ HasRegisterAssigned()

bool v8::internal::LiveRange::HasRegisterAssigned ( ) const
inline

Definition at line 240 of file lithium-allocator.h.

240  {
242  }

References assigned_register_, and kInvalidAssignment.

Referenced by CreateAssignedOperand(), and set_assigned_register().

+ Here is the caller graph for this function:

◆ id()

int v8::internal::LiveRange::id ( ) const
inline

Definition at line 202 of file lithium-allocator.h.

202 { return id_; }

References id_.

◆ IsChild()

bool v8::internal::LiveRange::IsChild ( ) const
inline

Definition at line 201 of file lithium-allocator.h.

201 { return parent() != NULL; }
LiveRange * parent() const

References NULL, and parent().

+ Here is the call graph for this function:

◆ IsEmpty()

bool v8::internal::LiveRange::IsEmpty ( ) const
inline

Definition at line 204 of file lithium-allocator.h.

204 { return first_interval() == NULL; }
UseInterval * first_interval() const

References first_interval(), and NULL.

Referenced by CanCover(), End(), SplitAt(), and Start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsFixed()

bool v8::internal::LiveRange::IsFixed ( ) const
inline

Definition at line 203 of file lithium-allocator.h.

203 { return id_ < 0; }

References id_.

◆ IsSpilled()

bool v8::internal::LiveRange::IsSpilled ( ) const
inline

Definition at line 243 of file lithium-allocator.h.

243 { return spilled_; }

References spilled_.

Referenced by CreateAssignedOperand(), MakeSpilled(), and set_assigned_register().

+ Here is the caller graph for this function:

◆ Kind()

RegisterKind v8::internal::LiveRange::Kind ( ) const
inline

Definition at line 239 of file lithium-allocator.h.

239 { return kind_; }

References kind_.

Referenced by CreateAssignedOperand().

+ Here is the caller graph for this function:

◆ MakeSpilled()

void v8::internal::LiveRange::MakeSpilled ( Zone zone)

Definition at line 122 of file lithium-allocator.cc.

122  {
123  DCHECK(!IsSpilled());
125  spilled_ = true;
127  ConvertOperands(zone);
128 }
bool HasAllocatedSpillOperand() const
void ConvertOperands(Zone *zone)

References assigned_register_, ConvertOperands(), DCHECK, HasAllocatedSpillOperand(), IsSpilled(), kInvalidAssignment, spilled_, and TopLevel().

+ Here is the call graph for this function:

◆ next()

LiveRange* v8::internal::LiveRange::next ( ) const
inline

Definition at line 200 of file lithium-allocator.h.

200 { return next_; }

References next_.

Referenced by SplitAt().

+ Here is the caller graph for this function:

◆ NextRegisterPosition()

UsePosition * v8::internal::LiveRange::NextRegisterPosition ( LifetimePosition  start)

Definition at line 178 of file lithium-allocator.cc.

178  {
179  UsePosition* pos = NextUsePosition(start);
180  while (pos != NULL && !pos->RequiresRegister()) {
181  pos = pos->next();
182  }
183  return pos;
184 }
UsePosition * NextUsePosition(LifetimePosition start)

References v8::internal::UsePosition::next(), NextUsePosition(), NULL, and v8::internal::UsePosition::RequiresRegister().

Referenced by CanBeSpilled().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NextUsePosition()

UsePosition * v8::internal::LiveRange::NextUsePosition ( LifetimePosition  start)

Definition at line 145 of file lithium-allocator.cc.

145  {
146  UsePosition* use_pos = last_processed_use_;
147  if (use_pos == NULL) use_pos = first_pos();
148  while (use_pos != NULL && use_pos->pos().Value() < start.Value()) {
149  use_pos = use_pos->next();
150  }
151  last_processed_use_ = use_pos;
152  return use_pos;
153 }

References first_pos(), last_processed_use_, v8::internal::UsePosition::next(), NULL, v8::internal::UsePosition::pos(), and v8::internal::LifetimePosition::Value().

Referenced by NextRegisterPosition(), and NextUsePositionRegisterIsBeneficial().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NextUsePositionRegisterIsBeneficial()

UsePosition * v8::internal::LiveRange::NextUsePositionRegisterIsBeneficial ( LifetimePosition  start)

Definition at line 156 of file lithium-allocator.cc.

157  {
158  UsePosition* pos = NextUsePosition(start);
159  while (pos != NULL && !pos->RegisterIsBeneficial()) {
160  pos = pos->next();
161  }
162  return pos;
163 }

References v8::internal::UsePosition::next(), NextUsePosition(), NULL, and v8::internal::UsePosition::RegisterIsBeneficial().

+ Here is the call graph for this function:

◆ parent()

LiveRange* v8::internal::LiveRange::parent ( ) const
inline

Definition at line 198 of file lithium-allocator.h.

198 { return parent_; }

References parent_.

Referenced by IsChild().

+ Here is the caller graph for this function:

◆ PreviousUsePositionRegisterIsBeneficial()

UsePosition * v8::internal::LiveRange::PreviousUsePositionRegisterIsBeneficial ( LifetimePosition  start)

Definition at line 166 of file lithium-allocator.cc.

167  {
168  UsePosition* pos = first_pos();
169  UsePosition* prev = NULL;
170  while (pos != NULL && pos->pos().Value() < start.Value()) {
171  if (pos->RegisterIsBeneficial()) prev = pos;
172  pos = pos->next();
173  }
174  return prev;
175 }

References first_pos(), v8::internal::UsePosition::next(), NULL, v8::internal::UsePosition::pos(), v8::internal::UsePosition::RegisterIsBeneficial(), and v8::internal::LifetimePosition::Value().

+ Here is the call graph for this function:

◆ set_assigned_register()

void v8::internal::LiveRange::set_assigned_register ( int  reg,
Zone zone 
)

Definition at line 115 of file lithium-allocator.cc.

115  {
117  assigned_register_ = reg;
118  ConvertOperands(zone);
119 }

References assigned_register_, ConvertOperands(), DCHECK, HasRegisterAssigned(), and IsSpilled().

+ Here is the call graph for this function:

◆ SetSpillOperand()

void v8::internal::LiveRange::SetSpillOperand ( LOperand operand)

Definition at line 137 of file lithium-allocator.cc.

137  {
138  DCHECK(!operand->IsUnallocated());
140  DCHECK(spill_operand_->IsIgnored());
141  spill_operand_->ConvertTo(operand->kind(), operand->index());
142 }
void ConvertTo(Kind kind, int index)
Definition: lithium.h:51

References v8::internal::LOperand::ConvertTo(), DCHECK, v8::internal::LOperand::index(), v8::internal::LOperand::kind(), NULL, and spill_operand_.

+ Here is the call graph for this function:

◆ SetSpillStartIndex()

void v8::internal::LiveRange::SetSpillStartIndex ( int  start)
inline

Definition at line 270 of file lithium-allocator.h.

270  {
272  }

References v8::internal::Min(), and spill_start_index_.

+ Here is the call graph for this function:

◆ ShortenTo()

void v8::internal::LiveRange::ShortenTo ( LifetimePosition  start)

Definition at line 354 of file lithium-allocator.cc.

354  {
355  LAllocator::TraceAlloc("Shorten live range %d to [%d\n", id_, start.Value());
357  DCHECK(first_interval_->start().Value() <= start.Value());
358  DCHECK(start.Value() < first_interval_->end().Value());
359  first_interval_->set_start(start);
360 }

References DCHECK, v8::internal::UseInterval::end(), first_interval_, id_, NULL, v8::internal::UseInterval::set_start(), v8::internal::UseInterval::start(), and v8::internal::LifetimePosition::Value().

+ Here is the call graph for this function:

◆ ShouldBeAllocatedBefore()

bool v8::internal::LiveRange::ShouldBeAllocatedBefore ( const LiveRange other) const

Definition at line 340 of file lithium-allocator.cc.

340  {
341  LifetimePosition start = Start();
342  LifetimePosition other_start = other->Start();
343  if (start.Value() == other_start.Value()) {
344  UsePosition* pos = first_pos();
345  if (pos == NULL) return false;
346  UsePosition* other_pos = other->first_pos();
347  if (other_pos == NULL) return true;
348  return pos->pos().Value() < other_pos->pos().Value();
349  }
350  return start.Value() < other_start.Value();
351 }

References first_pos(), NULL, v8::internal::UsePosition::pos(), Start(), and v8::internal::LifetimePosition::Value().

+ Here is the call graph for this function:

◆ spill_start_index()

int v8::internal::LiveRange::spill_start_index ( ) const
inline

Definition at line 207 of file lithium-allocator.h.

207 { return spill_start_index_; }

References spill_start_index_.

◆ SplitAt()

void v8::internal::LiveRange::SplitAt ( LifetimePosition  position,
LiveRange result,
Zone zone 
)

Definition at line 248 of file lithium-allocator.cc.

250  {
251  DCHECK(Start().Value() < position.Value());
252  DCHECK(result->IsEmpty());
253  // Find the last interval that ends before the position. If the
254  // position is contained in one of the intervals in the chain, we
255  // split that interval and use the first part.
256  UseInterval* current = FirstSearchIntervalForPosition(position);
257 
258  // If the split position coincides with the beginning of a use interval
259  // we need to split use positons in a special way.
260  bool split_at_start = false;
261 
262  if (current->start().Value() == position.Value()) {
263  // When splitting at start we need to locate the previous use interval.
264  current = first_interval_;
265  }
266 
267  while (current != NULL) {
268  if (current->Contains(position)) {
269  current->SplitAt(position, zone);
270  break;
271  }
272  UseInterval* next = current->next();
273  if (next->start().Value() >= position.Value()) {
274  split_at_start = (next->start().Value() == position.Value());
275  break;
276  }
277  current = next;
278  }
279 
280  // Partition original use intervals to the two live ranges.
281  UseInterval* before = current;
282  UseInterval* after = before->next();
283  result->last_interval_ = (last_interval_ == before)
284  ? after // Only interval in the range after split.
285  : last_interval_; // Last interval of the original range.
286  result->first_interval_ = after;
287  last_interval_ = before;
288 
289  // Find the last use position before the split and the first use
290  // position after it.
291  UsePosition* use_after = first_pos_;
292  UsePosition* use_before = NULL;
293  if (split_at_start) {
294  // The split position coincides with the beginning of a use interval (the
295  // end of a lifetime hole). Use at this position should be attributed to
296  // the split child because split child owns use interval covering it.
297  while (use_after != NULL && use_after->pos().Value() < position.Value()) {
298  use_before = use_after;
299  use_after = use_after->next();
300  }
301  } else {
302  while (use_after != NULL && use_after->pos().Value() <= position.Value()) {
303  use_before = use_after;
304  use_after = use_after->next();
305  }
306  }
307 
308  // Partition original use positions to the two live ranges.
309  if (use_before != NULL) {
310  use_before->next_ = NULL;
311  } else {
312  first_pos_ = NULL;
313  }
314  result->first_pos_ = use_after;
315 
316  // Discard cached iteration state. It might be pointing
317  // to the use that no longer belongs to this live range.
320 
321  // Link the new live range in the chain before any of the other
322  // ranges linked from the range before the split.
323  result->parent_ = (parent_ == NULL) ? this : parent_;
324  result->kind_ = result->parent_->kind_;
325  result->next_ = next_;
326  next_ = result;
327 
328 #ifdef DEBUG
329  Verify();
330  result->Verify();
331 #endif
332 }
LiveRange * next() const
void SplitAt(LifetimePosition pos, Zone *zone)

References v8::internal::UseInterval::Contains(), current_interval_, DCHECK, first_interval_, first_pos_, FirstSearchIntervalForPosition(), IsEmpty(), kind_, last_interval_, last_processed_use_, v8::internal::UseInterval::next(), v8::internal::UsePosition::next(), next(), v8::internal::UsePosition::next_, next_, NULL, parent_, v8::internal::UsePosition::pos(), v8::internal::UseInterval::SplitAt(), v8::internal::UseInterval::start(), Start(), and v8::internal::LifetimePosition::Value().

+ Here is the call graph for this function:

◆ Start()

LifetimePosition v8::internal::LiveRange::Start ( ) const
inline

Definition at line 256 of file lithium-allocator.h.

256  {
257  DCHECK(!IsEmpty());
258  return first_interval()->start();
259  }

References DCHECK, first_interval(), IsEmpty(), and v8::internal::UseInterval::start().

Referenced by CanCover(), ConvertOperands(), ShouldBeAllocatedBefore(), and SplitAt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TopLevel()

LiveRange* v8::internal::LiveRange::TopLevel ( )
inline

Definition at line 199 of file lithium-allocator.h.

199 { return (parent_ == NULL) ? this : parent_; }

References NULL, and parent_.

Referenced by CreateAssignedOperand(), and MakeSpilled().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ LAllocator

friend class LAllocator
friend

Definition at line 323 of file lithium-allocator.h.

Member Data Documentation

◆ assigned_register_

int v8::internal::LiveRange::assigned_register_
private

◆ current_hint_operand_

LOperand* v8::internal::LiveRange::current_hint_operand_
private

Definition at line 319 of file lithium-allocator.h.

Referenced by AddUsePosition(), and current_hint_operand().

◆ current_interval_

UseInterval* v8::internal::LiveRange::current_interval_
mutableprivate

◆ first_interval_

UseInterval* v8::internal::LiveRange::first_interval_
private

◆ first_pos_

UsePosition* v8::internal::LiveRange::first_pos_
private

Definition at line 312 of file lithium-allocator.h.

Referenced by AddUsePosition(), first_pos(), FirstHint(), and SplitAt().

◆ id_

int v8::internal::LiveRange::id_
private

◆ kind_

RegisterKind v8::internal::LiveRange::kind_
private

Definition at line 308 of file lithium-allocator.h.

Referenced by Kind(), and SplitAt().

◆ kInvalidAssignment

const int v8::internal::LiveRange::kInvalidAssignment = 0x7fffffff
static

Definition at line 192 of file lithium-allocator.h.

Referenced by HasRegisterAssigned(), and MakeSpilled().

◆ last_interval_

UseInterval* v8::internal::LiveRange::last_interval_
private

Definition at line 310 of file lithium-allocator.h.

Referenced by AddUseInterval(), End(), EnsureInterval(), and SplitAt().

◆ last_processed_use_

UsePosition* v8::internal::LiveRange::last_processed_use_
private

Definition at line 317 of file lithium-allocator.h.

Referenced by NextUsePosition(), and SplitAt().

◆ next_

LiveRange* v8::internal::LiveRange::next_
private

Definition at line 314 of file lithium-allocator.h.

Referenced by next(), and SplitAt().

◆ parent_

LiveRange* v8::internal::LiveRange::parent_
private

Definition at line 313 of file lithium-allocator.h.

Referenced by parent(), SplitAt(), and TopLevel().

◆ spill_operand_

LOperand* v8::internal::LiveRange::spill_operand_
private

Definition at line 320 of file lithium-allocator.h.

Referenced by GetSpillOperand(), HasAllocatedSpillOperand(), and SetSpillOperand().

◆ spill_start_index_

int v8::internal::LiveRange::spill_start_index_
private

Definition at line 321 of file lithium-allocator.h.

Referenced by SetSpillStartIndex(), and spill_start_index().

◆ spilled_

bool v8::internal::LiveRange::spilled_
private

Definition at line 307 of file lithium-allocator.h.

Referenced by IsSpilled(), and MakeSpilled().


The documentation for this class was generated from the following files: