V8 Project
v8::internal::State Class Reference
+ Inheritance diagram for v8::internal::State:
+ Collaboration diagram for v8::internal::State:

Public Member Functions

 State (Zone *zone)
 
StateProcess (HInstruction *instr, Zone *zone)
 
- 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 Member Functions

static StateMerge (State *succ_state, HBasicBlock *succ_block, State *pred_state, HBasicBlock *pred_block, Zone *zone)
 
static StateFinish (State *state, HBasicBlock *block, Zone *zone)
 

Private Types

enum  Mode { NORMAL , COLLECT_CONSECUTIVE_SIMULATES }
 

Private Member Functions

 State (const State &other)
 
bool HasRememberedSimulates () const
 
void Remember (HSimulate *sim)
 
void FlushSimulates ()
 
void RemoveSimulates ()
 
StateCopy (HBasicBlock *succ_block, HBasicBlock *pred_block, Zone *zone)
 
StateMerge (HBasicBlock *succ_block, State *pred_state, HBasicBlock *pred_block, Zone *zone)
 

Private Attributes

Zonezone_
 
ZoneList< HSimulate * > mergelist_
 
bool first_
 
Mode mode_
 

Detailed Description

Definition at line 12 of file hydrogen-removable-simulates.cc.

Member Enumeration Documentation

◆ Mode

Enumerator
NORMAL 
COLLECT_CONSECUTIVE_SIMULATES 

Definition at line 117 of file hydrogen-removable-simulates.cc.

Constructor & Destructor Documentation

◆ State() [1/2]

v8::internal::State::State ( Zone zone)
inlineexplicit

Definition at line 14 of file hydrogen-removable-simulates.cc.

Referenced by Copy().

+ Here is the caller graph for this function:

◆ State() [2/2]

v8::internal::State::State ( const State other)
inlineexplicitprivate

Definition at line 111 of file hydrogen-removable-simulates.cc.

112  : zone_(other.zone_),
113  mergelist_(other.mergelist_, other.zone_),
114  first_(other.first_),
115  mode_(other.mode_) { }

Member Function Documentation

◆ Copy()

State* v8::internal::State::Copy ( HBasicBlock *  succ_block,
HBasicBlock *  pred_block,
Zone zone 
)
inlineprivate

Definition at line 137 of file hydrogen-removable-simulates.cc.

137  {
138  State* copy = new(zone) State(*this);
139  if (FLAG_trace_removable_simulates) {
140  PrintF("[copy state %p from B%d to new state %p for B%d]\n",
141  reinterpret_cast<void*>(this), pred_block->block_id(),
142  reinterpret_cast<void*>(copy), succ_block->block_id());
143  }
144  return copy;
145  }
void PrintF(const char *format,...)
Definition: utils.cc:80

References v8::internal::PrintF(), and State().

Referenced by Merge().

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

◆ Finish()

static State* v8::internal::State::Finish ( State state,
HBasicBlock *  block,
Zone zone 
)
inlinestatic

Definition at line 96 of file hydrogen-removable-simulates.cc.

96  {
97  if (FLAG_trace_removable_simulates) {
98  PrintF("[preparing state %p for B%d]\n", reinterpret_cast<void*>(state),
99  block->block_id());
100  }
101  // For our current local analysis, we should not remember simulates across
102  // block boundaries.
103  DCHECK(!state->HasRememberedSimulates());
104  // Nasty heuristic: Never remove the first simulate in a block. This
105  // just so happens to have a beneficial effect on register allocation.
106  state->first_ = true;
107  return state;
108  }
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, first_, HasRememberedSimulates(), and v8::internal::PrintF().

Referenced by v8::internal::HFlowEngine< State, Effects >::AnalyzeDominatedBlocks().

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

◆ FlushSimulates()

void v8::internal::State::FlushSimulates ( )
inlineprivate

Definition at line 125 of file hydrogen-removable-simulates.cc.

125  {
126  if (HasRememberedSimulates()) {
127  mergelist_.RemoveLast()->MergeWith(&mergelist_);
128  }
129  }

References HasRememberedSimulates(), and mergelist_.

Referenced by Process().

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

◆ HasRememberedSimulates()

bool v8::internal::State::HasRememberedSimulates ( ) const
inlineprivate

Definition at line 119 of file hydrogen-removable-simulates.cc.

119 { return !mergelist_.is_empty(); }

References mergelist_.

Referenced by Finish(), FlushSimulates(), Merge(), and RemoveSimulates().

+ Here is the caller graph for this function:

◆ Merge() [1/2]

State* v8::internal::State::Merge ( HBasicBlock *  succ_block,
State pred_state,
HBasicBlock *  pred_block,
Zone zone 
)
inlineprivate

Definition at line 147 of file hydrogen-removable-simulates.cc.

150  {
151  // For our current local analysis, we should not remember simulates across
152  // block boundaries.
153  DCHECK(!pred_state->HasRememberedSimulates());
155  if (FLAG_trace_removable_simulates) {
156  PrintF("[merge state %p from B%d into %p for B%d]\n",
157  reinterpret_cast<void*>(pred_state), pred_block->block_id(),
158  reinterpret_cast<void*>(this), succ_block->block_id());
159  }
160  return this;
161  }

References DCHECK, HasRememberedSimulates(), and v8::internal::PrintF().

+ Here is the call graph for this function:

◆ Merge() [2/2]

static State* v8::internal::State::Merge ( State succ_state,
HBasicBlock *  succ_block,
State pred_state,
HBasicBlock *  pred_block,
Zone zone 
)
inlinestatic

Definition at line 86 of file hydrogen-removable-simulates.cc.

90  {
91  return (succ_state == NULL)
92  ? pred_state->Copy(succ_block, pred_block, zone)
93  : succ_state->Merge(succ_block, pred_state, pred_block, zone);
94  }
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

References Copy(), Merge(), and NULL.

Referenced by v8::internal::HFlowEngine< State, Effects >::AnalyzeDominatedBlocks(), and Merge().

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

◆ Process()

State* v8::internal::State::Process ( HInstruction instr,
Zone zone 
)
inline

Definition at line 17 of file hydrogen-removable-simulates.cc.

17  {
18  if (FLAG_trace_removable_simulates) {
19  PrintF("[%s with state %p in B%d: #%d %s]\n",
20  mode_ == NORMAL ? "processing" : "collecting",
21  reinterpret_cast<void*>(this), instr->block()->block_id(),
22  instr->id(), instr->Mnemonic());
23  }
24  // Forward-merge "trains" of simulates after an instruction with observable
25  // side effects to keep live ranges short.
27  if (instr->IsSimulate()) {
28  HSimulate* current_simulate = HSimulate::cast(instr);
29  if (current_simulate->is_candidate_for_removal() &&
30  !current_simulate->ast_id().IsNone()) {
31  Remember(current_simulate);
32  return this;
33  }
34  }
36  mode_ = NORMAL;
37  }
38  // Ensure there's a non-foldable HSimulate before an HEnterInlined to avoid
39  // folding across HEnterInlined.
40  DCHECK(!(instr->IsEnterInlined() &&
41  HSimulate::cast(instr->previous())->is_candidate_for_removal()));
42  if (instr->IsLeaveInlined() || instr->IsReturn()) {
43  // Never fold simulates from inlined environments into simulates in the
44  // outer environment. Simply remove all accumulated simulates without
45  // merging. This is safe because simulates after instructions with side
46  // effects are never added to the merge list. The same reasoning holds for
47  // return instructions.
49  return this;
50  }
51  if (instr->IsControlInstruction()) {
52  // Merge the accumulated simulates at the end of the block.
54  return this;
55  }
56  if (instr->IsCapturedObject()) {
57  // Do not merge simulates across captured objects - captured objects
58  // change environments during environment replay, and such changes
59  // would not be reflected in the simulate.
61  return this;
62  }
63  // Skip the non-simulates and the first simulate.
64  if (!instr->IsSimulate()) return this;
65  if (first_) {
66  first_ = false;
67  return this;
68  }
69  HSimulate* current_simulate = HSimulate::cast(instr);
70  if (!current_simulate->is_candidate_for_removal()) {
71  Remember(current_simulate);
73  } else if (current_simulate->ast_id().IsNone()) {
74  DCHECK(current_simulate->next()->IsEnterInlined());
76  } else if (current_simulate->previous()->HasObservableSideEffects()) {
77  Remember(current_simulate);
79  } else {
80  Remember(current_simulate);
81  }
82 
83  return this;
84  }

References v8::internal::HValue::block(), COLLECT_CONSECUTIVE_SIMULATES, DCHECK, first_, FlushSimulates(), v8::internal::HValue::id(), v8::internal::HValue::Mnemonic(), mode_, NORMAL, v8::internal::HInstruction::previous(), v8::internal::PrintF(), Remember(), and RemoveSimulates().

Referenced by v8::internal::HFlowEngine< State, Effects >::AnalyzeDominatedBlocks(), and v8::internal::HFlowEngine< State, Effects >::AnalyzeOneBlock().

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

◆ Remember()

void v8::internal::State::Remember ( HSimulate *  sim)
inlineprivate

Definition at line 121 of file hydrogen-removable-simulates.cc.

121  {
122  mergelist_.Add(sim, zone_);
123  }
void Add(const T &element, AllocationPolicy allocator=AllocationPolicy())
Definition: list-inl.h:17

References v8::internal::List< T, AllocationPolicy >::Add(), mergelist_, and zone_.

Referenced by Process().

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

◆ RemoveSimulates()

void v8::internal::State::RemoveSimulates ( )
inlineprivate

Definition at line 131 of file hydrogen-removable-simulates.cc.

131  {
132  while (HasRememberedSimulates()) {
133  mergelist_.RemoveLast()->DeleteAndReplaceWith(NULL);
134  }
135  }

References HasRememberedSimulates(), mergelist_, and NULL.

Referenced by Process().

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

Member Data Documentation

◆ first_

bool v8::internal::State::first_
private

Definition at line 165 of file hydrogen-removable-simulates.cc.

Referenced by Finish(), and Process().

◆ mergelist_

ZoneList<HSimulate*> v8::internal::State::mergelist_
private

◆ mode_

Mode v8::internal::State::mode_
private

Definition at line 166 of file hydrogen-removable-simulates.cc.

Referenced by Process().

◆ zone_

Zone* v8::internal::State::zone_
private

Definition at line 163 of file hydrogen-removable-simulates.cc.

Referenced by Remember().


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