V8 Project
v8::internal::FullCodeGenerator Class Reference

#include <full-codegen.h>

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

Classes

class  AccumulatorValueContext
 
struct  BackEdgeEntry
 
struct  BailoutEntry
 
class  BASE_EMBEDDED
 
class  Breakable
 
class  EffectContext
 
class  Finally
 
class  ForIn
 
class  Iteration
 
class  NestedBlock
 
class  PcField
 
class  StackValueContext
 
class  StateField
 
class  TestContext
 
class  TryCatch
 
class  TryFinally
 
class  WithOrCatch
 

Public Types

enum  State { NO_REGISTERS , TOS_REG }
 

Public Member Functions

 FullCodeGenerator (MacroAssembler *masm, CompilationInfo *info)
 
void Initialize ()
 

Static Public Member Functions

static bool MakeCode (CompilationInfo *info)
 
static const char * State2String (State state)
 

Static Public Attributes

static const int kMaxBackEdgeWeight = 127
 

Private Types

typedef void(FullCodeGenerator::* InlineFunctionGenerator) (CallRuntime *expr)
 

Private Member Functions

void ClearAccumulator ()
 
bool ShouldInlineSmiCase (Token::Value op)
 
void DoTest (Expression *condition, Label *if_true, Label *if_false, Label *fall_through)
 
void DoTest (const TestContext *context)
 
void Split (Condition cc, Label *if_true, Label *if_false, Label *fall_through)
 
void GetVar (Register destination, Variable *var)
 
void SetVar (Variable *var, Register source, Register scratch0, Register scratch1)
 
MemOperand StackOperand (Variable *var)
 
MemOperand VarOperand (Variable *var, Register scratch)
 
void VisitForEffect (Expression *expr)
 
void VisitForAccumulatorValue (Expression *expr)
 
void VisitForStackValue (Expression *expr)
 
void VisitForControl (Expression *expr, Label *if_true, Label *if_false, Label *fall_through)
 
void VisitInDuplicateContext (Expression *expr)
 
void VisitDeclarations (ZoneList< Declaration * > *declarations)
 
void DeclareModules (Handle< FixedArray > descriptions)
 
void DeclareGlobals (Handle< FixedArray > pairs)
 
int DeclareGlobalsFlags ()
 
void AllocateModules (ZoneList< Declaration * > *declarations)
 
void EmitCreateIteratorResult (bool done)
 
bool TryLiteralCompare (CompareOperation *compare)
 
void EmitLiteralCompareTypeof (Expression *expr, Expression *sub_expr, Handle< String > check)
 
void EmitLiteralCompareNil (CompareOperation *expr, Expression *sub_expr, NilValue nil)
 
void PrepareForBailout (Expression *node, State state)
 
void PrepareForBailoutForId (BailoutId id, State state)
 
Handle< FixedArrayFeedbackVector ()
 
void EnsureSlotContainsAllocationSite (int slot)
 
void RecordJSReturnSite (Call *call)
 
void PrepareForBailoutBeforeSplit (Expression *expr, bool should_normalize, Label *if_true, Label *if_false)
 
void EmitDebugCheckDeclarationContext (Variable *variable)
 
void EmitBackEdgeBookkeeping (IterationStatement *stmt, Label *back_edge_target)
 
void RecordBackEdge (BailoutId osr_ast_id)
 
unsigned EmitBackEdgeTable ()
 
void EmitProfilingCounterDecrement (int delta)
 
void EmitProfilingCounterReset ()
 
void EmitUnwindBeforeReturn ()
 
void EmitReturnSequence ()
 
void EmitCall (Call *expr, CallICState::CallType=CallICState::FUNCTION)
 
void EmitCallWithLoadIC (Call *expr)
 
void EmitSuperCallWithLoadIC (Call *expr)
 
void EmitKeyedCallWithLoadIC (Call *expr, Expression *key)
 
InlineFunctionGenerator FindInlineFunctionGenerator (Runtime::FunctionId id)
 
void EmitInlineRuntimeCall (CallRuntime *expr)
 
void EmitGeneratorResume (Expression *generator, Expression *value, JSGeneratorObject::ResumeMode resume_mode)
 
void EmitLoadGlobalCheckExtensions (VariableProxy *proxy, TypeofState typeof_state, Label *slow)
 
MemOperand ContextSlotOperandCheckExtensions (Variable *var, Label *slow)
 
void EmitDynamicLookupFastCase (VariableProxy *proxy, TypeofState typeof_state, Label *slow, Label *done)
 
void EmitVariableLoad (VariableProxy *proxy)
 
void EmitAccessor (Expression *expression)
 
void EmitResolvePossiblyDirectEval (int arg_count)
 
void EmitNewClosure (Handle< SharedFunctionInfo > info, bool pretenure)
 
void EmitNamedPropertyLoad (Property *expr)
 
void EmitNamedSuperPropertyLoad (Property *expr)
 
void EmitKeyedPropertyLoad (Property *expr)
 
void EmitBinaryOp (BinaryOperation *expr, Token::Value op, OverwriteMode mode)
 
void EmitInlineSmiBinaryOp (BinaryOperation *expr, Token::Value op, OverwriteMode mode, Expression *left, Expression *right)
 
void EmitAssignment (Expression *expr)
 
void EmitVariableAssignment (Variable *var, Token::Value op)
 
void EmitStoreToStackLocalOrContextSlot (Variable *var, MemOperand location)
 
void EmitNamedPropertyAssignment (Assignment *expr)
 
void EmitNamedSuperPropertyAssignment (Assignment *expr)
 
void EmitKeyedPropertyAssignment (Assignment *expr)
 
void EmitLoadHomeObject (SuperReference *expr)
 
void CallIC (Handle< Code > code, TypeFeedbackId id=TypeFeedbackId::None())
 
void CallLoadIC (ContextualMode mode, TypeFeedbackId id=TypeFeedbackId::None())
 
void CallStoreIC (TypeFeedbackId id=TypeFeedbackId::None())
 
void SetFunctionPosition (FunctionLiteral *fun)
 
void SetReturnPosition (FunctionLiteral *fun)
 
void SetStatementPosition (Statement *stmt)
 
void SetExpressionPosition (Expression *expr)
 
void SetSourcePosition (int pos)
 
void EnterFinallyBlock ()
 
void ExitFinallyBlock ()
 
int loop_depth ()
 
void increment_loop_depth ()
 
void decrement_loop_depth ()
 
MacroAssemblermasm ()
 
const ExpressionContextcontext ()
 
void set_new_context (const ExpressionContext *context)
 
Handle< Scriptscript ()
 
bool is_eval ()
 
bool is_native ()
 
StrictMode strict_mode ()
 
FunctionLiteral * function ()
 
Scopescope ()
 
void StoreToFrameField (int frame_offset, Register value)
 
void LoadContextField (Register dst, int context_index)
 
void PushFunctionArgumentForContextAllocation ()
 
void VisitComma (BinaryOperation *expr)
 
void VisitLogicalExpression (BinaryOperation *expr)
 
void VisitArithmeticExpression (BinaryOperation *expr)
 
void VisitForTypeofValue (Expression *expr)
 
void Generate ()
 
void PopulateDeoptimizationData (Handle< Code > code)
 
void PopulateTypeFeedbackInfo (Handle< Code > code)
 
Handle< FixedArrayhandler_table ()
 
 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS ()
 
 DISALLOW_COPY_AND_ASSIGN (FullCodeGenerator)
 

Static Private Member Functions

static Register result_register ()
 
static Register context_register ()
 

Private Attributes

MacroAssemblermasm_
 
CompilationInfoinfo_
 
Scopescope_
 
Label return_label_
 
NestedStatementnesting_stack_
 
int loop_depth_
 
ZoneList< Handle< Object > > * globals_
 
Handle< FixedArraymodules_
 
int module_index_
 
const ExpressionContextcontext_
 
ZoneList< BailoutEntrybailout_entries_
 
ZoneList< BackEdgeEntryback_edges_
 
int ic_total_count_
 
Handle< FixedArrayhandler_table_
 
Handle< Cellprofiling_counter_
 
bool generate_debug_code_
 

Static Private Attributes

static const InlineFunctionGenerator kInlineFunctionGenerators []
 

Friends

class NestedStatement
 

Detailed Description

Definition at line 57 of file full-codegen.h.

Member Typedef Documentation

◆ InlineFunctionGenerator

typedef void(FullCodeGenerator::* v8::internal::FullCodeGenerator::InlineFunctionGenerator) (CallRuntime *expr)
private

Definition at line 296 of file full-codegen.h.

Member Enumeration Documentation

◆ State

Enumerator
NO_REGISTERS 
TOS_REG 

Definition at line 59 of file full-codegen.h.

Constructor & Destructor Documentation

◆ FullCodeGenerator()

v8::internal::FullCodeGenerator::FullCodeGenerator ( MacroAssembler masm,
CompilationInfo info 
)
inline

Definition at line 64 of file full-codegen.h.

65  : masm_(masm),
66  info_(info),
67  scope_(info->scope()),
69  loop_depth_(0),
70  globals_(NULL),
71  context_(NULL),
72  bailout_entries_(info->HasDeoptimizationSupport()
73  ? info->function()->ast_node_count() : 0,
74  info->zone()),
75  back_edges_(2, info->zone()),
76  ic_total_count_(0) {
77  DCHECK(!info->IsStub());
78  Initialize();
79  }
ZoneList< BailoutEntry > bailout_entries_
Definition: full-codegen.h:841
const ExpressionContext * context_
Definition: full-codegen.h:840
ZoneList< Handle< Object > > * globals_
Definition: full-codegen.h:837
NestedStatement * nesting_stack_
Definition: full-codegen.h:835
ZoneList< BackEdgeEntry > back_edges_
Definition: full-codegen.h:842
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
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, Initialize(), and v8::internal::CompilationInfo::IsStub().

+ Here is the call graph for this function:

Member Function Documentation

◆ AllocateModules()

void v8::internal::FullCodeGenerator::AllocateModules ( ZoneList< Declaration * > *  declarations)
private

Definition at line 586 of file full-codegen.cc.

586  {
588 
589  for (int i = 0; i < declarations->length(); i++) {
590  ModuleDeclaration* declaration = declarations->at(i)->AsModuleDeclaration();
591  if (declaration != NULL) {
592  ModuleLiteral* module = declaration->module()->AsModuleLiteral();
593  if (module != NULL) {
594  Comment cmnt(masm_, "[ Link nested modules");
595  Scope* scope = module->body()->scope();
596  Interface* interface = scope->interface();
597  DCHECK(interface->IsModule() && interface->IsFrozen());
598 
599  interface->Allocate(scope->module_var()->index());
600 
601  // Set up module context.
602  DCHECK(scope->interface()->Index() >= 0);
605  __ CallRuntime(Runtime::kPushModuleContext, 2);
607  context_register());
608 
610 
611  // Pop module context.
613  // Update local stack frame context field.
615  context_register());
616  }
617  }
618  }
619 }
static Register context_register()
void AllocateModules(ZoneList< Declaration * > *declarations)
void StoreToFrameField(int frame_offset, Register value)
void LoadContextField(Register dst, int context_index)
Variable * module_var() const
Definition: scopes.h:361
bool is_global_scope() const
Definition: scopes.h:267
ZoneList< Declaration * > * declarations()
Definition: scopes.h:327
Interface * interface() const
Definition: scopes.h:336
Handle< ScopeInfo > GetScopeInfo()
Definition: scopes.cc:746
static Smi * FromInt(int value)
Definition: objects-inl.h:1321
static const int kContextOffset
Definition: frames.h:162
#define __
static int Push(SpecialRPOStackFrame *stack, int depth, BasicBlock *child, int unvisited)
Definition: scheduler.cc:773

References __, v8::internal::List< T, AllocationPolicy >::at(), context_register(), DCHECK, v8::internal::Scope::declarations(), v8::internal::Smi::FromInt(), v8::internal::Scope::GetScopeInfo(), v8::internal::Interface::Index(), v8::internal::Variable::index(), v8::internal::Scope::interface(), v8::internal::Scope::is_global_scope(), v8::internal::StandardFrameConstants::kContextOffset, LoadContextField(), masm_, v8::internal::Scope::module_var(), NULL, v8::internal::Context::PREVIOUS_INDEX, v8::internal::compiler::Push(), scope(), scope_, and StoreToFrameField().

Referenced by VisitDeclarations().

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

◆ CallIC()

void v8::internal::FullCodeGenerator::CallIC ( Handle< Code code,
TypeFeedbackId  id = TypeFeedbackId::None() 
)
private

Referenced by CallLoadIC(), and CallStoreIC().

+ Here is the caller graph for this function:

◆ CallLoadIC()

void v8::internal::FullCodeGenerator::CallLoadIC ( ContextualMode  mode,
TypeFeedbackId  id = TypeFeedbackId::None() 
)
private

Definition at line 421 of file full-codegen.cc.

422  {
423  Handle<Code> ic = CodeFactory::LoadIC(isolate(), contextual_mode).code();
424  CallIC(ic, id);
425 }
void CallIC(Handle< Code > code, TypeFeedbackId id=TypeFeedbackId::None())

References CallIC().

+ Here is the call graph for this function:

◆ CallStoreIC()

void v8::internal::FullCodeGenerator::CallStoreIC ( TypeFeedbackId  id = TypeFeedbackId::None())
private

Definition at line 428 of file full-codegen.cc.

428  {
429  Handle<Code> ic = CodeFactory::StoreIC(isolate(), strict_mode()).code();
430  CallIC(ic, id);
431 }

References CallIC(), and strict_mode().

+ Here is the call graph for this function:

◆ ClearAccumulator()

void v8::internal::FullCodeGenerator::ClearAccumulator ( )
private

◆ context()

const ExpressionContext* v8::internal::FullCodeGenerator::context ( )
inlineprivate

Definition at line 602 of file full-codegen.h.

602 { return context_; }

References context_.

Referenced by v8::internal::FullCodeGenerator::TestContext::cast(), DoTest(), set_new_context(), VisitForAccumulatorValue(), VisitForControl(), VisitForEffect(), VisitForStackValue(), VisitInDuplicateContext(), and VisitLogicalExpression().

+ Here is the caller graph for this function:

◆ context_register()

static Register v8::internal::FullCodeGenerator::context_register ( )
staticprivate

Referenced by AllocateModules().

+ Here is the caller graph for this function:

◆ ContextSlotOperandCheckExtensions()

MemOperand v8::internal::FullCodeGenerator::ContextSlotOperandCheckExtensions ( Variable var,
Label *  slow 
)
private

◆ DeclareGlobals()

void v8::internal::FullCodeGenerator::DeclareGlobals ( Handle< FixedArray pairs)
private

Referenced by VisitDeclarations().

+ Here is the caller graph for this function:

◆ DeclareGlobalsFlags()

int v8::internal::FullCodeGenerator::DeclareGlobalsFlags ( )
private

Definition at line 795 of file full-codegen.cc.

References DCHECK, v8::internal::BitFieldBase< T, shift, size, U >::encode(), is_eval(), is_native(), v8::internal::BitFieldBase< T, shift, size, U >::is_valid(), and strict_mode().

+ Here is the call graph for this function:

◆ DeclareModules()

void v8::internal::FullCodeGenerator::DeclareModules ( Handle< FixedArray descriptions)
private

Referenced by VisitDeclarations().

+ Here is the caller graph for this function:

◆ decrement_loop_depth()

void v8::internal::FullCodeGenerator::decrement_loop_depth ( )
inlineprivate

Definition at line 594 of file full-codegen.h.

594  {
595  DCHECK(loop_depth_ > 0);
596  loop_depth_--;
597  }

References DCHECK, and loop_depth_.

◆ DEFINE_AST_VISITOR_SUBCLASS_MEMBERS()

v8::internal::FullCodeGenerator::DEFINE_AST_VISITOR_SUBCLASS_MEMBERS ( )
private

◆ DISALLOW_COPY_AND_ASSIGN()

v8::internal::FullCodeGenerator::DISALLOW_COPY_AND_ASSIGN ( FullCodeGenerator  )
private

◆ DoTest() [1/2]

void v8::internal::FullCodeGenerator::DoTest ( const TestContext context)
private

Definition at line 578 of file full-codegen.cc.

578  {
579  DoTest(context->condition(),
580  context->true_label(),
581  context->false_label(),
582  context->fall_through());
583 }
const ExpressionContext * context()
Definition: full-codegen.h:602
void DoTest(Expression *condition, Label *if_true, Label *if_false, Label *fall_through)

References context(), and DoTest().

+ Here is the call graph for this function:

◆ DoTest() [2/2]

void v8::internal::FullCodeGenerator::DoTest ( Expression condition,
Label *  if_true,
Label *  if_false,
Label *  fall_through 
)
private

Referenced by DoTest(), and VisitLogicalExpression().

+ Here is the caller graph for this function:

◆ EmitAccessor()

void v8::internal::FullCodeGenerator::EmitAccessor ( Expression expression)
private

◆ EmitAssignment()

void v8::internal::FullCodeGenerator::EmitAssignment ( Expression expr)
private

◆ EmitBackEdgeBookkeeping()

void v8::internal::FullCodeGenerator::EmitBackEdgeBookkeeping ( IterationStatement stmt,
Label *  back_edge_target 
)
private

◆ EmitBackEdgeTable()

unsigned v8::internal::FullCodeGenerator::EmitBackEdgeTable ( )
private

Definition at line 351 of file full-codegen.cc.

351  {
352  // The back edge table consists of a length (in number of entries)
353  // field, and then a sequence of entries. Each entry is a pair of AST id
354  // and code-relative pc offset.
355  masm()->Align(kPointerSize);
356  unsigned offset = masm()->pc_offset();
357  unsigned length = back_edges_.length();
358  __ dd(length);
359  for (unsigned i = 0; i < length; ++i) {
360  __ dd(back_edges_[i].id.ToInt());
361  __ dd(back_edges_[i].pc);
362  __ dd(back_edges_[i].loop_depth);
363  }
364  return offset;
365 }
const int kPointerSize
Definition: globals.h:129
const Register pc

References __, v8::internal::Assembler::Align(), back_edges_, v8::internal::kPointerSize, loop_depth(), masm(), v8::internal::pc, and v8::internal::AssemblerBase::pc_offset().

Referenced by MakeCode().

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

◆ EmitBinaryOp()

void v8::internal::FullCodeGenerator::EmitBinaryOp ( BinaryOperation *  expr,
Token::Value  op,
OverwriteMode  mode 
)
private

Referenced by VisitArithmeticExpression().

+ Here is the caller graph for this function:

◆ EmitCall()

void v8::internal::FullCodeGenerator::EmitCall ( Call *  expr,
CallICState::CallType  = CallICState::FUNCTION 
)
private

◆ EmitCallWithLoadIC()

void v8::internal::FullCodeGenerator::EmitCallWithLoadIC ( Call *  expr)
private

◆ EmitCreateIteratorResult()

void v8::internal::FullCodeGenerator::EmitCreateIteratorResult ( bool  done)
private

◆ EmitDebugCheckDeclarationContext()

void v8::internal::FullCodeGenerator::EmitDebugCheckDeclarationContext ( Variable variable)
private

◆ EmitDynamicLookupFastCase()

void v8::internal::FullCodeGenerator::EmitDynamicLookupFastCase ( VariableProxy *  proxy,
TypeofState  typeof_state,
Label *  slow,
Label *  done 
)
private

◆ EmitGeneratorResume()

void v8::internal::FullCodeGenerator::EmitGeneratorResume ( Expression generator,
Expression value,
JSGeneratorObject::ResumeMode  resume_mode 
)
private

◆ EmitInlineRuntimeCall()

void v8::internal::FullCodeGenerator::EmitInlineRuntimeCall ( CallRuntime *  expr)
private

Definition at line 896 of file full-codegen.cc.

896  {
897  const Runtime::Function* function = expr->function();
898  DCHECK(function != NULL);
899  DCHECK(function->intrinsic_type == Runtime::INLINE);
900  InlineFunctionGenerator generator =
902  ((*this).*(generator))(expr);
903 }
void(FullCodeGenerator::* InlineFunctionGenerator)(CallRuntime *expr)
Definition: full-codegen.h:296
FunctionLiteral * function()
Definition: full-codegen.h:609
InlineFunctionGenerator FindInlineFunctionGenerator(Runtime::FunctionId id)

References DCHECK, FindInlineFunctionGenerator(), function(), v8::internal::Runtime::INLINE, and NULL.

+ Here is the call graph for this function:

◆ EmitInlineSmiBinaryOp()

void v8::internal::FullCodeGenerator::EmitInlineSmiBinaryOp ( BinaryOperation *  expr,
Token::Value  op,
OverwriteMode  mode,
Expression left,
Expression right 
)
private

Referenced by VisitArithmeticExpression().

+ Here is the caller graph for this function:

◆ EmitKeyedCallWithLoadIC()

void v8::internal::FullCodeGenerator::EmitKeyedCallWithLoadIC ( Call *  expr,
Expression key 
)
private

◆ EmitKeyedPropertyAssignment()

void v8::internal::FullCodeGenerator::EmitKeyedPropertyAssignment ( Assignment *  expr)
private

◆ EmitKeyedPropertyLoad()

void v8::internal::FullCodeGenerator::EmitKeyedPropertyLoad ( Property *  expr)
private

◆ EmitLiteralCompareNil()

void v8::internal::FullCodeGenerator::EmitLiteralCompareNil ( CompareOperation *  expr,
Expression sub_expr,
NilValue  nil 
)
private

Referenced by TryLiteralCompare().

+ Here is the caller graph for this function:

◆ EmitLiteralCompareTypeof()

void v8::internal::FullCodeGenerator::EmitLiteralCompareTypeof ( Expression expr,
Expression sub_expr,
Handle< String check 
)
private

Referenced by TryLiteralCompare().

+ Here is the caller graph for this function:

◆ EmitLoadGlobalCheckExtensions()

void v8::internal::FullCodeGenerator::EmitLoadGlobalCheckExtensions ( VariableProxy *  proxy,
TypeofState  typeof_state,
Label *  slow 
)
private

◆ EmitLoadHomeObject()

void v8::internal::FullCodeGenerator::EmitLoadHomeObject ( SuperReference *  expr)
private

◆ EmitNamedPropertyAssignment()

void v8::internal::FullCodeGenerator::EmitNamedPropertyAssignment ( Assignment *  expr)
private

◆ EmitNamedPropertyLoad()

void v8::internal::FullCodeGenerator::EmitNamedPropertyLoad ( Property *  expr)
private

◆ EmitNamedSuperPropertyAssignment()

void v8::internal::FullCodeGenerator::EmitNamedSuperPropertyAssignment ( Assignment *  expr)
private

◆ EmitNamedSuperPropertyLoad()

void v8::internal::FullCodeGenerator::EmitNamedSuperPropertyLoad ( Property *  expr)
private

◆ EmitNewClosure()

void v8::internal::FullCodeGenerator::EmitNewClosure ( Handle< SharedFunctionInfo info,
bool  pretenure 
)
private

◆ EmitProfilingCounterDecrement()

void v8::internal::FullCodeGenerator::EmitProfilingCounterDecrement ( int  delta)
private

◆ EmitProfilingCounterReset()

void v8::internal::FullCodeGenerator::EmitProfilingCounterReset ( )
private

◆ EmitResolvePossiblyDirectEval()

void v8::internal::FullCodeGenerator::EmitResolvePossiblyDirectEval ( int  arg_count)
private

◆ EmitReturnSequence()

void v8::internal::FullCodeGenerator::EmitReturnSequence ( )
private

◆ EmitStoreToStackLocalOrContextSlot()

void v8::internal::FullCodeGenerator::EmitStoreToStackLocalOrContextSlot ( Variable var,
MemOperand  location 
)
private

◆ EmitSuperCallWithLoadIC()

void v8::internal::FullCodeGenerator::EmitSuperCallWithLoadIC ( Call *  expr)
private

◆ EmitUnwindBeforeReturn()

void v8::internal::FullCodeGenerator::EmitUnwindBeforeReturn ( )
private

Definition at line 1211 of file full-codegen.cc.

1211  {
1212  NestedStatement* current = nesting_stack_;
1213  int stack_depth = 0;
1214  int context_length = 0;
1215  while (current != NULL) {
1216  current = current->Exit(&stack_depth, &context_length);
1217  }
1218  __ Drop(stack_depth);
1219 }

References __, nesting_stack_, and NULL.

◆ EmitVariableAssignment()

void v8::internal::FullCodeGenerator::EmitVariableAssignment ( Variable var,
Token::Value  op 
)
private

◆ EmitVariableLoad()

void v8::internal::FullCodeGenerator::EmitVariableLoad ( VariableProxy *  proxy)
private

◆ EnsureSlotContainsAllocationSite()

void v8::internal::FullCodeGenerator::EnsureSlotContainsAllocationSite ( int  slot)
private

Definition at line 368 of file full-codegen.cc.

368  {
369  Handle<FixedArray> vector = FeedbackVector();
370  if (!vector->get(slot)->IsAllocationSite()) {
371  Handle<AllocationSite> allocation_site =
372  isolate()->factory()->NewAllocationSite();
373  vector->set(slot, *allocation_site);
374  }
375 }
Handle< FixedArray > FeedbackVector()
Definition: full-codegen.h:432

References FeedbackVector().

+ Here is the call graph for this function:

◆ EnterFinallyBlock()

void v8::internal::FullCodeGenerator::EnterFinallyBlock ( )
private

◆ ExitFinallyBlock()

void v8::internal::FullCodeGenerator::ExitFinallyBlock ( )
private

◆ FeedbackVector()

Handle<FixedArray> v8::internal::FullCodeGenerator::FeedbackVector ( )
inlineprivate

Definition at line 432 of file full-codegen.h.

432  {
433  return info_->feedback_vector();
434  }
Handle< TypeFeedbackVector > feedback_vector() const
Definition: compiler.h:239

References v8::internal::CompilationInfo::feedback_vector(), and info_.

Referenced by EnsureSlotContainsAllocationSite().

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

◆ FindInlineFunctionGenerator()

FullCodeGenerator::InlineFunctionGenerator v8::internal::FullCodeGenerator::FindInlineFunctionGenerator ( Runtime::FunctionId  id)
private

Definition at line 886 of file full-codegen.cc.

886  {
887  int lookup_index =
888  static_cast<int>(id) - static_cast<int>(Runtime::kFirstInlineFunction);
889  DCHECK(lookup_index >= 0);
890  DCHECK(static_cast<size_t>(lookup_index) <
892  return kInlineFunctionGenerators[lookup_index];
893 }
static const InlineFunctionGenerator kInlineFunctionGenerators[]
Definition: full-codegen.h:298
#define arraysize(array)
Definition: macros.h:86

References arraysize, DCHECK, v8::internal::Runtime::kFirstInlineFunction, and kInlineFunctionGenerators.

Referenced by EmitInlineRuntimeCall().

+ Here is the caller graph for this function:

◆ function()

FunctionLiteral* v8::internal::FullCodeGenerator::function ( )
inlineprivate

Definition at line 609 of file full-codegen.h.

609 { return info_->function(); }
FunctionLiteral * function() const
Definition: compiler.h:107

References v8::internal::CompilationInfo::function(), and info_.

Referenced by EmitInlineRuntimeCall().

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

◆ Generate()

void v8::internal::FullCodeGenerator::Generate ( )
private

Referenced by MakeCode().

+ Here is the caller graph for this function:

◆ GetVar()

void v8::internal::FullCodeGenerator::GetVar ( Register  destination,
Variable var 
)
private

◆ handler_table()

Handle<FixedArray> v8::internal::FullCodeGenerator::handler_table ( )
inlineprivate

Definition at line 642 of file full-codegen.h.

642 { return handler_table_; }
Handle< FixedArray > handler_table_
Definition: full-codegen.h:844

References handler_table_.

Referenced by MakeCode().

+ Here is the caller graph for this function:

◆ increment_loop_depth()

void v8::internal::FullCodeGenerator::increment_loop_depth ( )
inlineprivate

Definition at line 593 of file full-codegen.h.

593 { loop_depth_++; }

References loop_depth_.

◆ Initialize()

void v8::internal::FullCodeGenerator::Initialize ( )

Definition at line 401 of file full-codegen.cc.

401  {
402  InitializeAstVisitor(info_->zone());
403  // The generation of debug code must match between the snapshot code and the
404  // code that is generated later. This is assumed by the debugger when it is
405  // calculating PC offsets after generating a debug version of code. Therefore
406  // we disable the production of debug code in the full compiler if we are
407  // either generating a snapshot or we booted from a snapshot.
408  generate_debug_code_ = FLAG_debug_code &&
413 }
void set_emit_debug_code(bool value)
Definition: assembler.h:66
void set_predictable_code_size(bool value)
Definition: assembler.h:72
bool serializer_enabled() const
Definition: assembler.h:68
static bool HaveASnapshotToStartFrom()

References generate_debug_code_, v8::internal::Snapshot::HaveASnapshotToStartFrom(), info_, masm_, v8::internal::AssemblerBase::serializer_enabled(), v8::internal::AssemblerBase::set_emit_debug_code(), v8::internal::AssemblerBase::set_predictable_code_size(), and v8::internal::CompilationInfo::zone().

Referenced by FullCodeGenerator().

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

◆ is_eval()

bool v8::internal::FullCodeGenerator::is_eval ( )
inlineprivate

Definition at line 606 of file full-codegen.h.

606 { return info_->is_eval(); }

References info_, and v8::internal::CompilationInfo::is_eval().

Referenced by DeclareGlobalsFlags().

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

◆ is_native()

bool v8::internal::FullCodeGenerator::is_native ( )
inlineprivate

Definition at line 607 of file full-codegen.h.

607 { return info_->is_native(); }

References info_, and v8::internal::CompilationInfo::is_native().

Referenced by DeclareGlobalsFlags().

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

◆ LoadContextField()

void v8::internal::FullCodeGenerator::LoadContextField ( Register  dst,
int  context_index 
)
private

Referenced by AllocateModules().

+ Here is the caller graph for this function:

◆ loop_depth()

int v8::internal::FullCodeGenerator::loop_depth ( )
inlineprivate

Definition at line 592 of file full-codegen.h.

592 { return loop_depth_; }

References loop_depth_.

Referenced by EmitBackEdgeTable(), and RecordBackEdge().

+ Here is the caller graph for this function:

◆ MakeCode()

bool v8::internal::FullCodeGenerator::MakeCode ( CompilationInfo info)
static

Definition at line 304 of file full-codegen.cc.

304  {
305  Isolate* isolate = info->isolate();
306 
307  TimerEventScope<TimerEventCompileFullCode> timer(info->isolate());
308 
309  Handle<Script> script = info->script();
310  if (!script->IsUndefined() && !script->source()->IsUndefined()) {
311  int len = String::cast(script->source())->length();
312  isolate->counters()->total_full_codegen_source_size()->Increment(len);
313  }
314  CodeGenerator::MakeCodePrologue(info, "full");
315  const int kInitialBufferSize = 4 * KB;
316  MacroAssembler masm(info->isolate(), NULL, kInitialBufferSize);
317  if (info->will_serialize()) masm.enable_serializer();
318 
319  LOG_CODE_EVENT(isolate,
320  CodeStartLinePosInfoRecordEvent(masm.positions_recorder()));
321 
322  FullCodeGenerator cgen(&masm, info);
323  cgen.Generate();
324  if (cgen.HasStackOverflow()) {
325  DCHECK(!isolate->has_pending_exception());
326  return false;
327  }
328  unsigned table_offset = cgen.EmitBackEdgeTable();
329 
330  Code::Flags flags = Code::ComputeFlags(Code::FUNCTION);
331  Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&masm, flags, info);
332  code->set_optimizable(info->IsOptimizable() &&
333  !info->function()->dont_optimize() &&
334  info->function()->scope()->AllowsLazyCompilation());
335  cgen.PopulateDeoptimizationData(code);
336  cgen.PopulateTypeFeedbackInfo(code);
337  code->set_has_deoptimization_support(info->HasDeoptimizationSupport());
338  code->set_handler_table(*cgen.handler_table());
339  code->set_compiled_optimizable(info->IsOptimizable());
340  code->set_allow_osr_at_loop_nesting_level(0);
341  code->set_profiler_ticks(0);
342  code->set_back_edge_table_offset(table_offset);
343  CodeGenerator::PrintCode(code, info);
344  info->SetCode(code);
345  void* line_info = masm.positions_recorder()->DetachJITHandlerData();
346  LOG_CODE_EVENT(isolate, CodeEndLinePosInfoRecordEvent(*code, line_info));
347  return true;
348 }
PositionsRecorder * positions_recorder()
static void PrintCode(Handle< Code > code, CompilationInfo *info)
Definition: codegen.cc:163
static void MakeCodePrologue(CompilationInfo *info, const char *kind)
Definition: codegen.cc:97
static Handle< Code > MakeCodeEpilogue(MacroAssembler *masm, Code::Flags flags, CompilationInfo *info)
Definition: codegen.cc:139
static Flags ComputeFlags(Kind kind, InlineCacheState ic_state=UNINITIALIZED, ExtraICState extra_ic_state=kNoExtraICState, StubType type=NORMAL, CacheHolderFlag holder=kCacheOnReceiver)
Definition: objects-inl.h:4954
uint32_t Flags
Definition: objects.h:4929
FullCodeGenerator(MacroAssembler *masm, CompilationInfo *info)
Definition: full-codegen.h:64
#define LOG_CODE_EVENT(isolate, Call)
Definition: log.h:77
const int KB
Definition: globals.h:106

References v8::internal::Code::ComputeFlags(), v8::internal::Isolate::counters(), DCHECK, EmitBackEdgeTable(), v8::internal::AssemblerBase::enable_serializer(), v8::internal::anonymous_namespace{flags.cc}::flags, v8::internal::CompilationInfo::function(), Generate(), handler_table(), v8::internal::Isolate::has_pending_exception(), v8::internal::CompilationInfo::HasDeoptimizationSupport(), v8::internal::CompilationInfo::isolate(), v8::internal::CompilationInfo::IsOptimizable(), v8::internal::KB, LOG_CODE_EVENT, v8::internal::CodeGenerator::MakeCodeEpilogue(), v8::internal::CodeGenerator::MakeCodePrologue(), masm(), NULL, PopulateDeoptimizationData(), PopulateTypeFeedbackInfo(), v8::internal::Assembler::positions_recorder(), v8::internal::CodeGenerator::PrintCode(), script(), v8::internal::CompilationInfo::script(), v8::internal::CompilationInfo::SetCode(), and v8::internal::CompilationInfo::will_serialize().

Referenced by v8::internal::Compiler::BuildFunctionInfo(), v8::internal::CompileUnoptimizedCode(), and v8::internal::Compiler::EnsureDeoptimizationSupport().

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

◆ masm()

MacroAssembler* v8::internal::FullCodeGenerator::masm ( )
inlineprivate

Definition at line 599 of file full-codegen.h.

599 { return masm_; }

References masm_.

Referenced by EmitBackEdgeTable(), and MakeCode().

+ Here is the caller graph for this function:

◆ PopulateDeoptimizationData()

void v8::internal::FullCodeGenerator::PopulateDeoptimizationData ( Handle< Code code)
private

Definition at line 378 of file full-codegen.cc.

378  {
379  // Fill in the deoptimization information.
381  if (!info_->HasDeoptimizationSupport()) return;
382  int length = bailout_entries_.length();
383  Handle<DeoptimizationOutputData> data =
384  DeoptimizationOutputData::New(isolate(), length, TENURED);
385  for (int i = 0; i < length; i++) {
386  data->SetAstId(i, bailout_entries_[i].id);
387  data->SetPcAndState(i, Smi::FromInt(bailout_entries_[i].pc_and_state));
388  }
389  code->set_deoptimization_data(*data);
390 }
bool HasDeoptimizationSupport() const
Definition: compiler.h:294
static Handle< DeoptimizationOutputData > New(Isolate *isolate, int number_of_deopt_points, PretenureFlag pretenure)
Definition: objects.cc:7927

References bailout_entries_, DCHECK, v8::internal::Smi::FromInt(), v8::internal::CompilationInfo::HasDeoptimizationSupport(), info_, v8::internal::DeoptimizationOutputData::New(), and v8::internal::TENURED.

Referenced by MakeCode().

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

◆ PopulateTypeFeedbackInfo()

void v8::internal::FullCodeGenerator::PopulateTypeFeedbackInfo ( Handle< Code code)
private

Definition at line 393 of file full-codegen.cc.

393  {
394  Handle<TypeFeedbackInfo> info = isolate()->factory()->NewTypeFeedbackInfo();
395  info->set_ic_total_count(ic_total_count_);
396  DCHECK(!isolate()->heap()->InNewSpace(*info));
397  code->set_type_feedback_info(*info);
398 }

References DCHECK, and ic_total_count_.

Referenced by MakeCode().

+ Here is the caller graph for this function:

◆ PrepareForBailout()

void v8::internal::FullCodeGenerator::PrepareForBailout ( Expression node,
State  state 
)
private

Definition at line 416 of file full-codegen.cc.

416  {
417  PrepareForBailoutForId(node->id(), state);
418 }
void PrepareForBailoutForId(BailoutId id, State state)

References v8::internal::Expression::id(), and PrepareForBailoutForId().

Referenced by VisitForAccumulatorValue(), VisitForEffect(), and VisitForStackValue().

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

◆ PrepareForBailoutBeforeSplit()

void v8::internal::FullCodeGenerator::PrepareForBailoutBeforeSplit ( Expression expr,
bool  should_normalize,
Label *  if_true,
Label *  if_false 
)
private

◆ PrepareForBailoutForId()

void v8::internal::FullCodeGenerator::PrepareForBailoutForId ( BailoutId  id,
State  state 
)
private

Definition at line 451 of file full-codegen.cc.

451  {
452  // There's no need to prepare this code for bailouts from already optimized
453  // code or code that can't be optimized.
454  if (!info_->HasDeoptimizationSupport()) return;
455  unsigned pc_and_state =
457  DCHECK(Smi::IsValid(pc_and_state));
458 #ifdef DEBUG
459  for (int i = 0; i < bailout_entries_.length(); ++i) {
460  DCHECK(bailout_entries_[i].id != id);
461  }
462 #endif
463  BailoutEntry entry = { id, pc_and_state };
464  bailout_entries_.Add(entry, zone());
465 }
static bool IsValid(intptr_t value)
Definition: objects-inl.h:1334

References bailout_entries_, DCHECK, v8::internal::BitFieldBase< T, shift, size, U >::encode(), v8::internal::CompilationInfo::HasDeoptimizationSupport(), info_, v8::internal::Smi::IsValid(), masm_, and v8::internal::AssemblerBase::pc_offset().

Referenced by PrepareForBailout(), RecordJSReturnSite(), and VisitLogicalExpression().

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

◆ PushFunctionArgumentForContextAllocation()

void v8::internal::FullCodeGenerator::PushFunctionArgumentForContextAllocation ( )
private

◆ RecordBackEdge()

void v8::internal::FullCodeGenerator::RecordBackEdge ( BailoutId  osr_ast_id)
private

Definition at line 468 of file full-codegen.cc.

468  {
469  // The pc offset does not need to be encoded and packed together with a state.
470  DCHECK(masm_->pc_offset() > 0);
471  DCHECK(loop_depth() > 0);
472  uint8_t depth = Min(loop_depth(), Code::kMaxLoopNestingMarker);
473  BackEdgeEntry entry =
474  { ast_id, static_cast<unsigned>(masm_->pc_offset()), depth };
475  back_edges_.Add(entry, zone());
476 }
static const int kMaxLoopNestingMarker
Definition: objects.h:5346
static LifetimePosition Min(LifetimePosition a, LifetimePosition b)

References back_edges_, DCHECK, v8::internal::Code::kMaxLoopNestingMarker, loop_depth(), masm_, v8::internal::Min(), and v8::internal::AssemblerBase::pc_offset().

+ Here is the call graph for this function:

◆ RecordJSReturnSite()

void v8::internal::FullCodeGenerator::RecordJSReturnSite ( Call *  call)
private

Definition at line 434 of file full-codegen.cc.

434  {
435  // We record the offset of the function return so we can rebuild the frame
436  // if the function was inlined, i.e., this is the return address in the
437  // inlined function's frame.
438  //
439  // The state is ignored. We defensively set it to TOS_REG, which is the
440  // real state of the unoptimized code at the return site.
441  PrepareForBailoutForId(call->ReturnId(), TOS_REG);
442 #ifdef DEBUG
443  // In debug builds, mark the return so we can verify that this function
444  // was called.
445  DCHECK(!call->return_is_recorded_);
446  call->return_is_recorded_ = true;
447 #endif
448 }

References DCHECK, PrepareForBailoutForId(), and TOS_REG.

+ Here is the call graph for this function:

◆ result_register()

static Register v8::internal::FullCodeGenerator::result_register ( )
staticprivate

◆ scope()

Scope* v8::internal::FullCodeGenerator::scope ( )
inlineprivate

Definition at line 610 of file full-codegen.h.

610 { return scope_; }

References scope_.

Referenced by AllocateModules(), and v8::internal::FullCodeGenerator::NestedBlock::Exit().

+ Here is the caller graph for this function:

◆ script()

Handle<Script> v8::internal::FullCodeGenerator::script ( )
inlineprivate

Definition at line 605 of file full-codegen.h.

605 { return info_->script(); }
Handle< Script > script() const
Definition: compiler.h:113

References info_, and v8::internal::CompilationInfo::script().

Referenced by MakeCode().

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

◆ set_new_context()

void v8::internal::FullCodeGenerator::set_new_context ( const ExpressionContext context)
inlineprivate

Definition at line 603 of file full-codegen.h.

603 { context_ = context; }

References context(), and context_.

Referenced by v8::internal::FullCodeGenerator::BASE_EMBEDDED::ExpressionContext().

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

◆ SetExpressionPosition()

void v8::internal::FullCodeGenerator::SetExpressionPosition ( Expression expr)
private

Definition at line 840 of file full-codegen.cc.

840  {
841  if (!info_->is_debug()) {
842  CodeGenerator::RecordPositions(masm_, expr->position());
843  } else {
844  // Check if the expression will be breakable without adding a debug break
845  // slot.
846  BreakableStatementChecker checker(zone());
847  checker.Check(expr);
848  // Record a statement position right here if the expression is not
849  // breakable. For breakable expressions the actual recording of the
850  // position will be postponed to the breakable code (typically an IC).
851  // NOTE this will record a statement position for something which might
852  // not be a statement. As stepping in the debugger will only stop at
853  // statement positions this is used for e.g. the condition expression of
854  // a do while loop.
855  bool position_recorded = CodeGenerator::RecordPositions(
856  masm_, expr->position(), !checker.is_breakable());
857  // If the position recording did record a new position generate a debug
858  // break slot to make the statement breakable.
859  if (position_recorded) {
861  }
862  }
863 }
static bool RecordPositions(MacroAssembler *masm, int pos, bool right_here=false)
Definition: codegen.cc:225
static void GenerateSlot(MacroAssembler *masm)

References v8::internal::BreakableStatementChecker::Check(), v8::internal::DebugCodegen::GenerateSlot(), info_, v8::internal::BreakableStatementChecker::is_breakable(), v8::internal::CompilationInfo::is_debug(), masm_, v8::internal::AstNode::position(), and v8::internal::CodeGenerator::RecordPositions().

+ Here is the call graph for this function:

◆ SetFunctionPosition()

void v8::internal::FullCodeGenerator::SetFunctionPosition ( FunctionLiteral *  fun)
private

Definition at line 803 of file full-codegen.cc.

803  {
804  CodeGenerator::RecordPositions(masm_, fun->start_position());
805 }

References masm_, and v8::internal::CodeGenerator::RecordPositions().

+ Here is the call graph for this function:

◆ SetReturnPosition()

void v8::internal::FullCodeGenerator::SetReturnPosition ( FunctionLiteral *  fun)
private

Definition at line 808 of file full-codegen.cc.

808  {
809  CodeGenerator::RecordPositions(masm_, fun->end_position() - 1);
810 }

References masm_, and v8::internal::CodeGenerator::RecordPositions().

+ Here is the call graph for this function:

◆ SetSourcePosition()

void v8::internal::FullCodeGenerator::SetSourcePosition ( int  pos)
private

Definition at line 866 of file full-codegen.cc.

866  {
867  if (pos != RelocInfo::kNoPosition) {
868  masm_->positions_recorder()->RecordPosition(pos);
869  }
870 }
static const int kNoPosition
Definition: assembler.h:317

References v8::internal::RelocInfo::kNoPosition, masm_, and v8::internal::Assembler::positions_recorder().

Referenced by VisitArithmeticExpression().

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

◆ SetStatementPosition()

void v8::internal::FullCodeGenerator::SetStatementPosition ( Statement stmt)
private

Definition at line 813 of file full-codegen.cc.

813  {
814  if (!info_->is_debug()) {
815  CodeGenerator::RecordPositions(masm_, stmt->position());
816  } else {
817  // Check if the statement will be breakable without adding a debug break
818  // slot.
819  BreakableStatementChecker checker(zone());
820  checker.Check(stmt);
821  // Record the statement position right here if the statement is not
822  // breakable. For breakable statements the actual recording of the
823  // position will be postponed to the breakable code (typically an IC).
824  bool position_recorded = CodeGenerator::RecordPositions(
825  masm_, stmt->position(), !checker.is_breakable());
826  // If the position recording did record a new position generate a debug
827  // break slot to make the statement breakable.
828  if (position_recorded) {
830  }
831  }
832 }

References v8::internal::BreakableStatementChecker::Check(), v8::internal::DebugCodegen::GenerateSlot(), info_, v8::internal::BreakableStatementChecker::is_breakable(), v8::internal::CompilationInfo::is_debug(), masm_, v8::internal::AstNode::position(), and v8::internal::CodeGenerator::RecordPositions().

+ Here is the call graph for this function:

◆ SetVar()

void v8::internal::FullCodeGenerator::SetVar ( Variable var,
Register  source,
Register  scratch0,
Register  scratch1 
)
private

◆ ShouldInlineSmiCase()

bool v8::internal::FullCodeGenerator::ShouldInlineSmiCase ( Token::Value  op)
private

Definition at line 479 of file full-codegen.cc.

479  {
480  // Inline smi case inside loops, but not division and modulo which
481  // are too complicated and take up too much space.
482  if (op == Token::DIV ||op == Token::MOD) return false;
483  if (FLAG_always_inline_smi_code) return true;
484  return loop_depth_ > 0;
485 }

References v8::internal::DIV, and loop_depth_.

Referenced by VisitArithmeticExpression().

+ Here is the caller graph for this function:

◆ Split()

void v8::internal::FullCodeGenerator::Split ( Condition  cc,
Label *  if_true,
Label *  if_false,
Label *  fall_through 
)
private

◆ StackOperand()

MemOperand v8::internal::FullCodeGenerator::StackOperand ( Variable var)
private

◆ State2String()

static const char* v8::internal::FullCodeGenerator::State2String ( State  state)
inlinestatic

Definition at line 90 of file full-codegen.h.

90  {
91  switch (state) {
92  case NO_REGISTERS: return "NO_REGISTERS";
93  case TOS_REG: return "TOS_REG";
94  }
95  UNREACHABLE();
96  return NULL;
97  }
#define UNREACHABLE()
Definition: logging.h:30

References NO_REGISTERS, NULL, TOS_REG, and UNREACHABLE.

Referenced by v8::internal::Deoptimizer::DoComputeOutputFrames().

+ Here is the caller graph for this function:

◆ StoreToFrameField()

void v8::internal::FullCodeGenerator::StoreToFrameField ( int  frame_offset,
Register  value 
)
private

Referenced by AllocateModules().

+ Here is the caller graph for this function:

◆ strict_mode()

StrictMode v8::internal::FullCodeGenerator::strict_mode ( )
inlineprivate

Definition at line 608 of file full-codegen.h.

608 { return function()->strict_mode(); }

References strict_mode().

Referenced by CallStoreIC(), DeclareGlobalsFlags(), and strict_mode().

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

◆ TryLiteralCompare()

bool v8::internal::FullCodeGenerator::TryLiteralCompare ( CompareOperation *  compare)
private

Definition at line 1605 of file full-codegen.cc.

1605  {
1606  Expression* sub_expr;
1607  Handle<String> check;
1608  if (expr->IsLiteralCompareTypeof(&sub_expr, &check)) {
1609  EmitLiteralCompareTypeof(expr, sub_expr, check);
1610  return true;
1611  }
1612 
1613  if (expr->IsLiteralCompareUndefined(&sub_expr, isolate())) {
1614  EmitLiteralCompareNil(expr, sub_expr, kUndefinedValue);
1615  return true;
1616  }
1617 
1618  if (expr->IsLiteralCompareNull(&sub_expr)) {
1619  EmitLiteralCompareNil(expr, sub_expr, kNullValue);
1620  return true;
1621  }
1622 
1623  return false;
1624 }
void EmitLiteralCompareTypeof(Expression *expr, Expression *sub_expr, Handle< String > check)
void EmitLiteralCompareNil(CompareOperation *expr, Expression *sub_expr, NilValue nil)
@ kNullValue
Definition: v8.h:97
@ kUndefinedValue
Definition: v8.h:97

References EmitLiteralCompareNil(), EmitLiteralCompareTypeof(), v8::internal::kNullValue, and v8::internal::kUndefinedValue.

+ Here is the call graph for this function:

◆ VarOperand()

MemOperand v8::internal::FullCodeGenerator::VarOperand ( Variable var,
Register  scratch 
)
private

◆ VisitArithmeticExpression()

void v8::internal::FullCodeGenerator::VisitArithmeticExpression ( BinaryOperation *  expr)
private

Definition at line 1029 of file full-codegen.cc.

1029  {
1030  Token::Value op = expr->op();
1031  Comment cmnt(masm_, "[ ArithmeticExpression");
1032  Expression* left = expr->left();
1033  Expression* right = expr->right();
1035  left->ResultOverwriteAllowed()
1036  ? OVERWRITE_LEFT
1037  : (right->ResultOverwriteAllowed() ? OVERWRITE_RIGHT : NO_OVERWRITE);
1038 
1039  VisitForStackValue(left);
1040  VisitForAccumulatorValue(right);
1041 
1042  SetSourcePosition(expr->position());
1043  if (ShouldInlineSmiCase(op)) {
1044  EmitInlineSmiBinaryOp(expr, op, mode, left, right);
1045  } else {
1046  EmitBinaryOp(expr, op, mode);
1047  }
1048 }
void EmitBinaryOp(BinaryOperation *expr, Token::Value op, OverwriteMode mode)
void VisitForStackValue(Expression *expr)
Definition: full-codegen.h:376
void VisitForAccumulatorValue(Expression *expr)
Definition: full-codegen.h:370
void EmitInlineSmiBinaryOp(BinaryOperation *expr, Token::Value op, OverwriteMode mode, Expression *left, Expression *right)
bool ShouldInlineSmiCase(Token::Value op)
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 mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
@ NO_OVERWRITE
Definition: ic-state.h:58
@ OVERWRITE_RIGHT
Definition: ic-state.h:58
@ OVERWRITE_LEFT
Definition: ic-state.h:58

References EmitBinaryOp(), EmitInlineSmiBinaryOp(), masm_, mode(), v8::internal::NO_OVERWRITE, v8::internal::OVERWRITE_LEFT, v8::internal::OVERWRITE_RIGHT, v8::internal::Expression::ResultOverwriteAllowed(), SetSourcePosition(), ShouldInlineSmiCase(), VisitForAccumulatorValue(), and VisitForStackValue().

+ Here is the call graph for this function:

◆ VisitComma()

void v8::internal::FullCodeGenerator::VisitComma ( BinaryOperation *  expr)
private

Definition at line 953 of file full-codegen.cc.

953  {
954  Comment cmnt(masm_, "[ Comma");
955  VisitForEffect(expr->left());
956  VisitInDuplicateContext(expr->right());
957 }
void VisitForEffect(Expression *expr)
Definition: full-codegen.h:364
void VisitInDuplicateContext(Expression *expr)

References masm_, VisitForEffect(), and VisitInDuplicateContext().

+ Here is the call graph for this function:

◆ VisitDeclarations()

void v8::internal::FullCodeGenerator::VisitDeclarations ( ZoneList< Declaration * > *  declarations)
private

Definition at line 682 of file full-codegen.cc.

683  {
684  Handle<FixedArray> saved_modules = modules_;
685  int saved_module_index = module_index_;
686  ZoneList<Handle<Object> >* saved_globals = globals_;
687  ZoneList<Handle<Object> > inner_globals(10, zone());
688  globals_ = &inner_globals;
689 
690  if (scope_->num_modules() != 0) {
691  // This is a scope hosting modules. Allocate a descriptor array to pass
692  // to the runtime for initialization.
693  Comment cmnt(masm_, "[ Allocate modules");
695  modules_ =
696  isolate()->factory()->NewFixedArray(scope_->num_modules(), TENURED);
697  module_index_ = 0;
698 
699  // Generate code for allocating all modules, including nested ones.
700  // The allocated contexts are stored in internal variables in this scope.
701  AllocateModules(declarations);
702  }
703 
704  AstVisitor::VisitDeclarations(declarations);
705 
706  if (scope_->num_modules() != 0) {
707  // Initialize modules from descriptor array.
708  DCHECK(module_index_ == modules_->length());
710  modules_ = saved_modules;
711  module_index_ = saved_module_index;
712  }
713 
714  if (!globals_->is_empty()) {
715  // Invoke the platform-dependent code generator to do the actual
716  // declaration of the global functions and variables.
717  Handle<FixedArray> array =
718  isolate()->factory()->NewFixedArray(globals_->length(), TENURED);
719  for (int i = 0; i < globals_->length(); ++i)
720  array->set(i, *globals_->at(i));
721  DeclareGlobals(array);
722  }
723 
724  globals_ = saved_globals;
725 }
void DeclareGlobals(Handle< FixedArray > pairs)
void DeclareModules(Handle< FixedArray > descriptions)
Handle< FixedArray > modules_
Definition: full-codegen.h:838
int num_modules() const
Definition: scopes.h:358

References AllocateModules(), DCHECK, DeclareGlobals(), DeclareModules(), globals_, v8::internal::Scope::is_global_scope(), masm_, module_index_, modules_, v8::internal::Scope::num_modules(), scope_, and v8::internal::TENURED.

+ Here is the call graph for this function:

◆ VisitForAccumulatorValue()

void v8::internal::FullCodeGenerator::VisitForAccumulatorValue ( Expression expr)
inlineprivate

Definition at line 370 of file full-codegen.h.

370  {
371  AccumulatorValueContext context(this);
372  Visit(expr);
373  PrepareForBailout(expr, TOS_REG);
374  }
void PrepareForBailout(Expression *node, State state)

References context(), PrepareForBailout(), and TOS_REG.

Referenced by VisitArithmeticExpression(), VisitInDuplicateContext(), and VisitLogicalExpression().

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

◆ VisitForControl()

void v8::internal::FullCodeGenerator::VisitForControl ( Expression expr,
Label *  if_true,
Label *  if_false,
Label *  fall_through 
)
inlineprivate

Definition at line 382 of file full-codegen.h.

385  {
386  TestContext context(this, expr, if_true, if_false, fall_through);
387  Visit(expr);
388  // For test contexts, we prepare for bailout before branching, not at
389  // the end of the entire expression. This happens as part of visiting
390  // the expression.
391  }

References context().

Referenced by VisitInDuplicateContext(), and VisitLogicalExpression().

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

◆ VisitForEffect()

void v8::internal::FullCodeGenerator::VisitForEffect ( Expression expr)
inlineprivate

Definition at line 364 of file full-codegen.h.

364  {
365  EffectContext context(this);
366  Visit(expr);
368  }

References context(), NO_REGISTERS, and PrepareForBailout().

Referenced by VisitComma(), and VisitInDuplicateContext().

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

◆ VisitForStackValue()

void v8::internal::FullCodeGenerator::VisitForStackValue ( Expression expr)
inlineprivate

Definition at line 376 of file full-codegen.h.

376  {
377  StackValueContext context(this);
378  Visit(expr);
380  }

References context(), NO_REGISTERS, and PrepareForBailout().

Referenced by VisitArithmeticExpression(), and VisitInDuplicateContext().

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

◆ VisitForTypeofValue()

void v8::internal::FullCodeGenerator::VisitForTypeofValue ( Expression expr)
private

◆ VisitInDuplicateContext()

void v8::internal::FullCodeGenerator::VisitInDuplicateContext ( Expression expr)
private

Definition at line 938 of file full-codegen.cc.

938  {
939  if (context()->IsEffect()) {
940  VisitForEffect(expr);
941  } else if (context()->IsAccumulatorValue()) {
943  } else if (context()->IsStackValue()) {
944  VisitForStackValue(expr);
945  } else if (context()->IsTest()) {
946  const TestContext* test = TestContext::cast(context());
947  VisitForControl(expr, test->true_label(), test->false_label(),
948  test->fall_through());
949  }
950 }
static const TestContext * cast(const ExpressionContext *context)
Definition: full-codegen.h:778
void VisitForControl(Expression *expr, Label *if_true, Label *if_false, Label *fall_through)
Definition: full-codegen.h:382

References v8::internal::FullCodeGenerator::TestContext::cast(), context(), v8::internal::FullCodeGenerator::TestContext::fall_through(), v8::internal::FullCodeGenerator::TestContext::false_label(), v8::internal::FullCodeGenerator::TestContext::true_label(), VisitForAccumulatorValue(), VisitForControl(), VisitForEffect(), and VisitForStackValue().

Referenced by VisitComma(), and VisitLogicalExpression().

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

◆ VisitLogicalExpression()

void v8::internal::FullCodeGenerator::VisitLogicalExpression ( BinaryOperation *  expr)
private

Definition at line 960 of file full-codegen.cc.

960  {
961  bool is_logical_and = expr->op() == Token::AND;
962  Comment cmnt(masm_, is_logical_and ? "[ Logical AND" : "[ Logical OR");
963  Expression* left = expr->left();
964  Expression* right = expr->right();
965  BailoutId right_id = expr->RightId();
966  Label done;
967 
968  if (context()->IsTest()) {
969  Label eval_right;
970  const TestContext* test = TestContext::cast(context());
971  if (is_logical_and) {
972  VisitForControl(left, &eval_right, test->false_label(), &eval_right);
973  } else {
974  VisitForControl(left, test->true_label(), &eval_right, &eval_right);
975  }
977  __ bind(&eval_right);
978 
979  } else if (context()->IsAccumulatorValue()) {
981  // We want the value in the accumulator for the test, and on the stack in
982  // case we need it.
984  Label discard, restore;
985  if (is_logical_and) {
986  DoTest(left, &discard, &restore, &restore);
987  } else {
988  DoTest(left, &restore, &discard, &restore);
989  }
990  __ bind(&restore);
991  __ Pop(result_register());
992  __ jmp(&done);
993  __ bind(&discard);
994  __ Drop(1);
996 
997  } else if (context()->IsStackValue()) {
999  // We want the value in the accumulator for the test, and on the stack in
1000  // case we need it.
1001  __ Push(result_register());
1002  Label discard;
1003  if (is_logical_and) {
1004  DoTest(left, &discard, &done, &discard);
1005  } else {
1006  DoTest(left, &done, &discard, &discard);
1007  }
1008  __ bind(&discard);
1009  __ Drop(1);
1011 
1012  } else {
1013  DCHECK(context()->IsEffect());
1014  Label eval_right;
1015  if (is_logical_and) {
1016  VisitForControl(left, &eval_right, &done, &eval_right);
1017  } else {
1018  VisitForControl(left, &done, &eval_right, &eval_right);
1019  }
1021  __ bind(&eval_right);
1022  }
1023 
1024  VisitInDuplicateContext(right);
1025  __ bind(&done);
1026 }
static Register result_register()

References __, v8::internal::AND, v8::internal::FullCodeGenerator::TestContext::cast(), context(), DCHECK, DoTest(), v8::internal::FullCodeGenerator::TestContext::false_label(), masm_, NO_REGISTERS, PrepareForBailoutForId(), v8::internal::compiler::Push(), result_register(), v8::internal::FullCodeGenerator::TestContext::true_label(), VisitForAccumulatorValue(), VisitForControl(), and VisitInDuplicateContext().

+ Here is the call graph for this function:

Friends And Related Function Documentation

◆ NestedStatement

friend class NestedStatement
friend

Definition at line 848 of file full-codegen.h.

Member Data Documentation

◆ back_edges_

ZoneList<BackEdgeEntry> v8::internal::FullCodeGenerator::back_edges_
private

Definition at line 842 of file full-codegen.h.

Referenced by EmitBackEdgeTable(), and RecordBackEdge().

◆ bailout_entries_

ZoneList<BailoutEntry> v8::internal::FullCodeGenerator::bailout_entries_
private

Definition at line 841 of file full-codegen.h.

Referenced by PopulateDeoptimizationData(), and PrepareForBailoutForId().

◆ context_

const ExpressionContext* v8::internal::FullCodeGenerator::context_
private

Definition at line 840 of file full-codegen.h.

Referenced by context(), and set_new_context().

◆ generate_debug_code_

bool v8::internal::FullCodeGenerator::generate_debug_code_
private

Definition at line 846 of file full-codegen.h.

Referenced by Initialize().

◆ globals_

ZoneList<Handle<Object> >* v8::internal::FullCodeGenerator::globals_
private

Definition at line 837 of file full-codegen.h.

Referenced by VisitDeclarations().

◆ handler_table_

Handle<FixedArray> v8::internal::FullCodeGenerator::handler_table_
private

Definition at line 844 of file full-codegen.h.

Referenced by handler_table().

◆ ic_total_count_

int v8::internal::FullCodeGenerator::ic_total_count_
private

Definition at line 843 of file full-codegen.h.

Referenced by PopulateTypeFeedbackInfo().

◆ info_

◆ kInlineFunctionGenerators

const FullCodeGenerator::InlineFunctionGenerator v8::internal::FullCodeGenerator::kInlineFunctionGenerators
staticprivate
Initial value:
= {
}

Definition at line 298 of file full-codegen.h.

Referenced by FindInlineFunctionGenerator().

◆ kMaxBackEdgeWeight

const int v8::internal::FullCodeGenerator::kMaxBackEdgeWeight = 127
static

Definition at line 99 of file full-codegen.h.

◆ loop_depth_

int v8::internal::FullCodeGenerator::loop_depth_
private

◆ masm_

◆ module_index_

int v8::internal::FullCodeGenerator::module_index_
private

Definition at line 839 of file full-codegen.h.

Referenced by VisitDeclarations().

◆ modules_

Handle<FixedArray> v8::internal::FullCodeGenerator::modules_
private

Definition at line 838 of file full-codegen.h.

Referenced by VisitDeclarations().

◆ nesting_stack_

NestedStatement* v8::internal::FullCodeGenerator::nesting_stack_
private

◆ profiling_counter_

Handle<Cell> v8::internal::FullCodeGenerator::profiling_counter_
private

Definition at line 845 of file full-codegen.h.

◆ return_label_

Label v8::internal::FullCodeGenerator::return_label_
private

Definition at line 834 of file full-codegen.h.

◆ scope_

Scope* v8::internal::FullCodeGenerator::scope_
private

Definition at line 833 of file full-codegen.h.

Referenced by AllocateModules(), scope(), and VisitDeclarations().


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