V8 Project
v8::internal::HOsrBuilder Class Reference

#include <hydrogen-osr.h>

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

Public Member Functions

 HOsrBuilder (HOptimizedGraphBuilder *builder)
 
HBasicBlock * BuildOsrLoopEntry (IterationStatement *statement)
 
void FinishGraph ()
 
void FinishOsrValues ()
 
int UnoptimizedFrameSlots () const
 
bool HasOsrEntryAt (IterationStatement *statement)
 
- 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)
 

Private Attributes

int unoptimized_frame_slots_
 
HOptimizedGraphBuilderbuilder_
 
HBasicBlock * osr_entry_
 
HBasicBlock * osr_loop_entry_
 
ZoneList< HUnknownOSRValue * > * osr_values_
 

Detailed Description

Definition at line 17 of file hydrogen-osr.h.

Constructor & Destructor Documentation

◆ HOsrBuilder()

v8::internal::HOsrBuilder::HOsrBuilder ( HOptimizedGraphBuilder builder)
inlineexplicit

Definition at line 19 of file hydrogen-osr.h.

21  builder_(builder),
24  osr_values_(NULL) { }
HBasicBlock * osr_loop_entry_
Definition: hydrogen-osr.h:48
HBasicBlock * osr_entry_
Definition: hydrogen-osr.h:47
HOptimizedGraphBuilder * builder_
Definition: hydrogen-osr.h:46
ZoneList< HUnknownOSRValue * > * osr_values_
Definition: hydrogen-osr.h:49
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

Member Function Documentation

◆ BuildOsrLoopEntry()

HBasicBlock * v8::internal::HOsrBuilder::BuildOsrLoopEntry ( IterationStatement statement)

Definition at line 17 of file hydrogen-osr.cc.

17  {
18  DCHECK(HasOsrEntryAt(statement));
19 
20  Zone* zone = builder_->zone();
21  HGraph* graph = builder_->graph();
22 
23  // only one OSR point per compile is allowed.
24  DCHECK(graph->osr() == NULL);
25 
26  // remember this builder as the one OSR builder in the graph.
27  graph->set_osr(this);
28 
29  HBasicBlock* non_osr_entry = graph->CreateBasicBlock();
30  osr_entry_ = graph->CreateBasicBlock();
31  HValue* true_value = graph->GetConstantTrue();
32  HBranch* test = builder_->New<HBranch>(true_value, ToBooleanStub::Types(),
33  non_osr_entry, osr_entry_);
35 
36  HBasicBlock* loop_predecessor = graph->CreateBasicBlock();
37  builder_->Goto(non_osr_entry, loop_predecessor);
38 
40  osr_entry_->set_osr_entry();
41  BailoutId osr_entry_id = statement->OsrEntryId();
42 
43  HEnvironment *environment = builder_->environment();
44  int first_expression_index = environment->first_expression_index();
45  int length = environment->length();
46  osr_values_ = new(zone) ZoneList<HUnknownOSRValue*>(length, zone);
47 
48  for (int i = 0; i < first_expression_index; ++i) {
49  HUnknownOSRValue* osr_value
50  = builder_->Add<HUnknownOSRValue>(environment, i);
51  environment->Bind(i, osr_value);
52  osr_values_->Add(osr_value, zone);
53  }
54 
55  if (first_expression_index != length) {
56  environment->Drop(length - first_expression_index);
57  for (int i = first_expression_index; i < length; ++i) {
58  HUnknownOSRValue* osr_value
59  = builder_->Add<HUnknownOSRValue>(environment, i);
60  environment->Push(osr_value);
61  osr_values_->Add(osr_value, zone);
62  }
63  }
64 
66  environment->local_count() + environment->push_count();
67 
68  // Keep a copy of the old environment, since the OSR values need it
69  // to figure out where exactly they are located in the unoptimized frame.
70  environment = environment->Copy();
71  builder_->current_block()->UpdateEnvironment(environment);
72 
73  builder_->Add<HSimulate>(osr_entry_id);
74  builder_->Add<HOsrEntry>(osr_entry_id);
75  HContext* context = builder_->Add<HContext>();
76  environment->BindContext(context);
77  builder_->Goto(loop_predecessor);
78  loop_predecessor->SetJoinId(statement->EntryId());
79  builder_->set_current_block(loop_predecessor);
80 
81  // Create the final loop entry
83  return osr_loop_entry_;
84 }
HEnvironment * environment() const
Definition: hydrogen.h:1059
void set_current_block(HBasicBlock *block)
Definition: hydrogen.h:1058
void Goto(HBasicBlock *from, HBasicBlock *target, FunctionState *state=NULL, bool add_simulate=true)
Definition: hydrogen.h:1080
HGraph * graph() const
Definition: hydrogen.h:1063
HBasicBlock * current_block() const
Definition: hydrogen.h:1057
void FinishCurrentBlock(HControlInstruction *last)
Definition: hydrogen.cc:1198
bool HasOsrEntryAt(IterationStatement *statement)
Definition: hydrogen-osr.cc:12
void Add(const T &element, AllocationPolicy allocator=AllocationPolicy())
Definition: list-inl.h:17
#define DCHECK(condition)
Definition: logging.h:205

References v8::internal::HGraphBuilder::Add(), v8::internal::List< T, AllocationPolicy >::Add(), builder_, v8::internal::HOptimizedGraphBuilder::BuildLoopEntry(), v8::internal::HGraphBuilder::current_block(), DCHECK, v8::internal::BreakableStatement::EntryId(), v8::internal::HGraphBuilder::environment(), v8::internal::HGraphBuilder::FinishCurrentBlock(), v8::internal::HGraphBuilder::Goto(), v8::internal::HGraphBuilder::graph(), HasOsrEntryAt(), v8::internal::HGraphBuilder::New(), NULL, osr_entry_, osr_loop_entry_, osr_values_, v8::internal::IterationStatement::OsrEntryId(), v8::internal::HGraphBuilder::set_current_block(), unoptimized_frame_slots_, and v8::internal::HGraphBuilder::zone().

Referenced by v8::internal::HOptimizedGraphBuilder::BuildLoopEntry().

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

◆ FinishGraph()

void v8::internal::HOsrBuilder::FinishGraph ( )

Definition at line 87 of file hydrogen-osr.cc.

87  {
88  // do nothing for now.
89 }

Referenced by v8::internal::HOptimizedGraphBuilder::BuildGraph().

+ Here is the caller graph for this function:

◆ FinishOsrValues()

void v8::internal::HOsrBuilder::FinishOsrValues ( )

Definition at line 92 of file hydrogen-osr.cc.

92  {
93  const ZoneList<HPhi*>* phis = osr_loop_entry_->phis();
94  for (int j = 0; j < phis->length(); j++) {
95  HPhi* phi = phis->at(j);
96  if (phi->HasMergedIndex()) {
97  osr_values_->at(phi->merged_index())->set_incoming_value(phi);
98  }
99  }
100 }
T & at(int i) const
Definition: list.h:69

References v8::internal::List< T, AllocationPolicy >::at(), osr_loop_entry_, and osr_values_.

+ Here is the call graph for this function:

◆ HasOsrEntryAt()

bool v8::internal::HOsrBuilder::HasOsrEntryAt ( IterationStatement statement)

Definition at line 12 of file hydrogen-osr.cc.

12  {
13  return statement->OsrEntryId() == builder_->current_info()->osr_ast_id();
14 }
BailoutId osr_ast_id() const
Definition: compiler.h:128
CompilationInfo * current_info() const
Definition: hydrogen.h:2167

References builder_, v8::internal::HOptimizedGraphBuilder::current_info(), v8::internal::CompilationInfo::osr_ast_id(), and v8::internal::IterationStatement::OsrEntryId().

Referenced by v8::internal::HOptimizedGraphBuilder::BuildLoopEntry(), and BuildOsrLoopEntry().

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

◆ UnoptimizedFrameSlots()

int v8::internal::HOsrBuilder::UnoptimizedFrameSlots ( ) const
inline

Definition at line 38 of file hydrogen-osr.h.

38  {
40  }

References unoptimized_frame_slots_.

Member Data Documentation

◆ builder_

HOptimizedGraphBuilder* v8::internal::HOsrBuilder::builder_
private

Definition at line 46 of file hydrogen-osr.h.

Referenced by BuildOsrLoopEntry(), and HasOsrEntryAt().

◆ osr_entry_

HBasicBlock* v8::internal::HOsrBuilder::osr_entry_
private

Definition at line 47 of file hydrogen-osr.h.

Referenced by BuildOsrLoopEntry().

◆ osr_loop_entry_

HBasicBlock* v8::internal::HOsrBuilder::osr_loop_entry_
private

Definition at line 48 of file hydrogen-osr.h.

Referenced by BuildOsrLoopEntry(), and FinishOsrValues().

◆ osr_values_

ZoneList<HUnknownOSRValue*>* v8::internal::HOsrBuilder::osr_values_
private

Definition at line 49 of file hydrogen-osr.h.

Referenced by BuildOsrLoopEntry(), and FinishOsrValues().

◆ unoptimized_frame_slots_

int v8::internal::HOsrBuilder::unoptimized_frame_slots_
private

Definition at line 45 of file hydrogen-osr.h.

Referenced by BuildOsrLoopEntry(), and UnoptimizedFrameSlots().


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