5 #ifndef V8_FULL_CODEGEN_H_
6 #define V8_FULL_CODEGEN_H_
33 InitializeAstVisitor(zone);
43 #define DECLARE_VISIT(type) virtual void Visit##type(type* node);
73 ? info->
function()->ast_node_count() : 0,
102 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87
103 static const int kCodeSizeMultiplier = 105;
104 static const int kBootCodeSizeMultiplier = 100;
105 #elif V8_TARGET_ARCH_X64
106 static const int kCodeSizeMultiplier = 170;
107 static const int kBootCodeSizeMultiplier = 140;
108 #elif V8_TARGET_ARCH_ARM
109 static const int kCodeSizeMultiplier = 149;
110 static const int kBootCodeSizeMultiplier = 110;
111 #elif V8_TARGET_ARCH_ARM64
113 static const int kCodeSizeMultiplier = 149;
114 static const int kBootCodeSizeMultiplier = 110;
115 #elif V8_TARGET_ARCH_MIPS
116 static const int kCodeSizeMultiplier = 149;
117 static const int kBootCodeSizeMultiplier = 120;
118 #elif V8_TARGET_ARCH_MIPS64
119 static const int kCodeSizeMultiplier = 149;
120 static const int kBootCodeSizeMultiplier = 120;
122 #error Unsupported target architecture.
140 DCHECK_EQ(
this, codegen_->nesting_stack_);
141 codegen_->nesting_stack_ = previous_;
314 Label* fall_through);
319 #if V8_TARGET_ARCH_MIPS
325 Label* fall_through);
326 #elif V8_TARGET_ARCH_MIPS64
332 Label* fall_through);
337 Label* fall_through);
385 Label* fall_through) {
447 bool should_normalize,
459 Label* back_edge_target);
478 void EmitCall(Call* expr, CallICState::CallType = CallICState::FUNCTION);
488 #define EMIT_INLINE_RUNTIME_CALL(name, x, y) \
489 void Emit##name(CallRuntime* expr);
491 #undef EMIT_INLINE_RUNTIME_CALL
628 #define DECLARE_VISIT(type) virtual void Visit##type(type* node);
663 codegen_->set_new_context(old_);
685 virtual void Plug(Label* materialize_true,
686 Label* materialize_false)
const = 0;
696 Label* materialize_false,
699 Label** fall_through)
const = 0;
711 virtual bool IsTest()
const {
return false; }
730 virtual void Plug(Label* materialize_true, Label* materialize_false)
const;
737 Label* materialize_false,
740 Label** fall_through)
const;
751 virtual void Plug(Label* materialize_true, Label* materialize_false)
const;
758 Label* materialize_false,
761 Label** fall_through)
const;
790 virtual void Plug(Label* materialize_true, Label* materialize_false)
const;
797 Label* materialize_false,
801 virtual bool IsTest()
const {
return true; }
817 virtual void Plug(Label* materialize_true, Label* materialize_false)
const;
824 Label* materialize_false,
827 Label** fall_through)
const;
857 ObjectLiteral::Accessors,
858 ZoneAllocationPolicy> {
868 if (it->second ==
NULL) it->second =
new(
zone_) ObjectLiteral::Accessors();
919 Code* replacement_code);
923 Code* unoptimized_code);
934 Code* unoptimized_code,
939 static bool Verify(
Isolate* isolate,
Code* unoptimized_code);
Iterator lookup(Literal *literal)
AccessorTable(Zone *zone)
static const int kLoopDepthOffset
static const int kTableLengthSize
uint32_t pc_offset(uint32_t index)
static const int kEntrySize
static void RemoveStackCheck(Handle< Code > code, uint32_t pc_offset)
uint32_t loop_depth(uint32_t index)
static void PatchAt(Code *unoptimized_code, Address pc, BackEdgeState target_state, Code *replacement_code)
BackEdgeTable(Code *code, DisallowHeapAllocation *required)
static void Patch(Isolate *isolate, Code *unoptimized_code)
Address entry_at(uint32_t index)
static void Revert(Isolate *isolate, Code *unoptimized_code)
static const int kAstIdOffset
static const int kPcOffsetOffset
Address instruction_start_
BailoutId ast_id(uint32_t index)
static BackEdgeState GetBackEdgeState(Isolate *isolate, Code *unoptimized_code, Address pc_after)
static void AddStackCheck(Handle< Code > code, uint32_t pc_offset)
Address pc(uint32_t index)
DISALLOW_COPY_AND_ASSIGN(BreakableStatementChecker)
void Check(Statement *stmt)
BreakableStatementChecker(Zone *zone)
DEFINE_AST_VISITOR_SUBCLASS_MEMBERS()
byte * instruction_start()
unsigned back_edge_table_offset()
Handle< Script > script() const
FunctionLiteral * function() const
Handle< TypeFeedbackVector > feedback_vector() const
virtual void Plug(Label *materialize_true, Label *materialize_false) const
virtual void PlugTOS() const
virtual void Plug(Variable *var) const
virtual void DropAndPlug(int count, Register reg) const
virtual bool IsAccumulatorValue() const
virtual void PrepareTest(Label *materialize_true, Label *materialize_false, Label **if_true, Label **if_false, Label **fall_through) const
virtual void Plug(bool flag) const
virtual void Plug(Heap::RootListIndex) const
AccumulatorValueContext(FullCodeGenerator *codegen)
virtual void Plug(Handle< Object > lit) const
virtual bool IsTest() const
virtual bool IsAccumulatorValue() const
virtual void Plug(Heap::RootListIndex index) const =0
virtual ~NestedStatement()
const ExpressionContext * old_
virtual ~ExpressionContext()
virtual bool IsStackValue() const
NestedStatement(FullCodeGenerator *codegen)
virtual bool IsEffect() const
DISALLOW_COPY_AND_ASSIGN(NestedStatement)
virtual void Plug(Handle< Object > lit) const =0
virtual bool IsContinueTarget(Statement *target)
virtual bool IsBreakTarget(Statement *target)
FullCodeGenerator * codegen_
virtual void PrepareTest(Label *materialize_true, Label *materialize_false, Label **if_true, Label **if_false, Label **fall_through) const =0
virtual void Plug(bool flag) const =0
FullCodeGenerator * codegen() const
ExpressionContext(FullCodeGenerator *codegen)
virtual NestedStatement * Exit(int *stack_depth, int *context_length)
virtual void Plug(Variable *var) const =0
virtual void PlugTOS() const =0
virtual void Plug(Label *materialize_true, Label *materialize_false) const =0
Isolate * isolate() const
NestedStatement * previous_
virtual Iteration * AsIteration()
virtual void Plug(Register reg) const =0
virtual Breakable * AsBreakable()
MacroAssembler * masm() const
virtual void DropAndPlug(int count, Register reg) const =0
BreakableStatement * statement_
BreakableStatement * statement()
virtual Breakable * AsBreakable()
virtual bool IsBreakTarget(Statement *target)
Breakable(FullCodeGenerator *codegen, BreakableStatement *statement)
virtual void Plug(Variable *var) const
virtual void Plug(Heap::RootListIndex) const
virtual void PrepareTest(Label *materialize_true, Label *materialize_false, Label **if_true, Label **if_false, Label **fall_through) const
virtual void PlugTOS() const
virtual bool IsEffect() const
virtual void DropAndPlug(int count, Register reg) const
virtual void Plug(bool flag) const
EffectContext(FullCodeGenerator *codegen)
virtual void Plug(Handle< Object > lit) const
virtual void Plug(Label *materialize_true, Label *materialize_false) const
virtual NestedStatement * Exit(int *stack_depth, int *context_length)
Finally(FullCodeGenerator *codegen)
static const int kElementCount
ForIn(FullCodeGenerator *codegen, ForInStatement *statement)
virtual NestedStatement * Exit(int *stack_depth, int *context_length)
static const int kElementCount
virtual Iteration * AsIteration()
virtual bool IsContinueTarget(Statement *target)
Iteration(FullCodeGenerator *codegen, IterationStatement *statement)
virtual NestedStatement * Exit(int *stack_depth, int *context_length)
NestedBlock(FullCodeGenerator *codegen, Block *block)
virtual void Plug(Heap::RootListIndex) const
virtual void Plug(Handle< Object > lit) const
virtual void Plug(Variable *var) const
virtual bool IsStackValue() const
virtual void PrepareTest(Label *materialize_true, Label *materialize_false, Label **if_true, Label **if_false, Label **fall_through) const
virtual void PlugTOS() const
StackValueContext(FullCodeGenerator *codegen)
virtual void DropAndPlug(int count, Register reg) const
virtual void Plug(bool flag) const
virtual void Plug(Label *materialize_true, Label *materialize_false) const
Label * true_label() const
virtual void Plug(Handle< Object > lit) const
virtual void Plug(Label *materialize_true, Label *materialize_false) const
virtual void PrepareTest(Label *materialize_true, Label *materialize_false, Label **if_true, Label **if_false, Label **fall_through) const
virtual void DropAndPlug(int count, Register reg) const
static const TestContext * cast(const ExpressionContext *context)
Label * false_label() const
virtual void Plug(bool flag) const
virtual bool IsTest() const
virtual void Plug(Heap::RootListIndex) const
virtual void PlugTOS() const
virtual void Plug(Variable *var) const
Expression * condition() const
TestContext(FullCodeGenerator *codegen, Expression *condition, Label *true_label, Label *false_label, Label *fall_through)
Label * fall_through() const
virtual NestedStatement * Exit(int *stack_depth, int *context_length)
TryCatch(FullCodeGenerator *codegen)
virtual NestedStatement * Exit(int *stack_depth, int *context_length)
TryFinally(FullCodeGenerator *codegen, Label *finally_entry)
virtual NestedStatement * Exit(int *stack_depth, int *context_length)
WithOrCatch(FullCodeGenerator *codegen)
static const int kMaxBackEdgeWeight
void(FullCodeGenerator::* InlineFunctionGenerator)(CallRuntime *expr)
ZoneList< BailoutEntry > bailout_entries_
void VisitArithmeticExpression(BinaryOperation *expr)
void EmitAccessor(Expression *expression)
void Split(Condition cc, Label *if_true, Label *if_false, Label *fall_through)
void EmitBinaryOp(BinaryOperation *expr, Token::Value op, OverwriteMode mode)
void EmitLiteralCompareTypeof(Expression *expr, Expression *sub_expr, Handle< String > check)
void VisitDeclarations(ZoneList< Declaration * > *declarations)
void PrepareForBailoutForId(BailoutId id, State state)
void EmitNewClosure(Handle< SharedFunctionInfo > info, bool pretenure)
void GetVar(Register destination, Variable *var)
const ExpressionContext * context_
static Register context_register()
ZoneList< Handle< Object > > * globals_
void VisitForControl(Expression *expr, Label *if_true, Label *if_false, Label *fall_through)
void PushFunctionArgumentForContextAllocation()
void CallLoadIC(ContextualMode mode, TypeFeedbackId id=TypeFeedbackId::None())
bool generate_debug_code_
void RecordBackEdge(BailoutId osr_ast_id)
void VisitLogicalExpression(BinaryOperation *expr)
MemOperand StackOperand(Variable *var)
void EmitVariableLoad(VariableProxy *proxy)
static bool MakeCode(CompilationInfo *info)
void EmitReturnSequence()
void SetVar(Variable *var, Register source, Register scratch0, Register scratch1)
MemOperand ContextSlotOperandCheckExtensions(Variable *var, Label *slow)
void EmitKeyedPropertyAssignment(Assignment *expr)
void DeclareGlobals(Handle< FixedArray > pairs)
void EmitResolvePossiblyDirectEval(int arg_count)
void VisitForStackValue(Expression *expr)
void EmitKeyedCallWithLoadIC(Call *expr, Expression *key)
void EmitProfilingCounterReset()
void EmitKeyedPropertyLoad(Property *expr)
void AllocateModules(ZoneList< Declaration * > *declarations)
void PopulateDeoptimizationData(Handle< Code > code)
DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator)
void EmitDebugCheckDeclarationContext(Variable *variable)
DEFINE_AST_VISITOR_SUBCLASS_MEMBERS()
void EmitUnwindBeforeReturn()
NestedStatement * nesting_stack_
FunctionLiteral * function()
void EmitNamedSuperPropertyLoad(Property *expr)
Handle< Cell > profiling_counter_
bool TryLiteralCompare(CompareOperation *compare)
void increment_loop_depth()
void SetStatementPosition(Statement *stmt)
Handle< FixedArray > FeedbackVector()
void StoreToFrameField(int frame_offset, Register value)
void LoadContextField(Register dst, int context_index)
void set_new_context(const ExpressionContext *context)
const ExpressionContext * context()
void EmitNamedPropertyLoad(Property *expr)
void EmitBackEdgeBookkeeping(IterationStatement *stmt, Label *back_edge_target)
void DoTest(Expression *condition, Label *if_true, Label *if_false, Label *fall_through)
void PopulateTypeFeedbackInfo(Handle< Code > code)
void VisitForAccumulatorValue(Expression *expr)
void PrepareForBailout(Expression *node, State state)
void CallStoreIC(TypeFeedbackId id=TypeFeedbackId::None())
MemOperand VarOperand(Variable *var, Register scratch)
void DeclareModules(Handle< FixedArray > descriptions)
void EmitGeneratorResume(Expression *generator, Expression *value, JSGeneratorObject::ResumeMode resume_mode)
void VisitForEffect(Expression *expr)
void EmitAssignment(Expression *expr)
void EmitCall(Call *expr, CallICState::CallType=CallICState::FUNCTION)
void SetFunctionPosition(FunctionLiteral *fun)
int DeclareGlobalsFlags()
void EmitLoadHomeObject(SuperReference *expr)
void VisitComma(BinaryOperation *expr)
void EmitStoreToStackLocalOrContextSlot(Variable *var, MemOperand location)
static const char * State2String(State state)
void SetExpressionPosition(Expression *expr)
void decrement_loop_depth()
void EmitInlineSmiBinaryOp(BinaryOperation *expr, Token::Value op, OverwriteMode mode, Expression *left, Expression *right)
void EmitLiteralCompareNil(CompareOperation *expr, Expression *sub_expr, NilValue nil)
void EmitVariableAssignment(Variable *var, Token::Value op)
void CallIC(Handle< Code > code, TypeFeedbackId id=TypeFeedbackId::None())
void EmitCreateIteratorResult(bool done)
ZoneList< BackEdgeEntry > back_edges_
void EmitLoadGlobalCheckExtensions(VariableProxy *proxy, TypeofState typeof_state, Label *slow)
void EmitCallWithLoadIC(Call *expr)
void EnsureSlotContainsAllocationSite(int slot)
void PrepareForBailoutBeforeSplit(Expression *expr, bool should_normalize, Label *if_true, Label *if_false)
Handle< FixedArray > modules_
Handle< Script > script()
unsigned EmitBackEdgeTable()
void EmitInlineRuntimeCall(CallRuntime *expr)
FullCodeGenerator(MacroAssembler *masm, CompilationInfo *info)
void SetSourcePosition(int pos)
void EmitSuperCallWithLoadIC(Call *expr)
void EmitNamedSuperPropertyAssignment(Assignment *expr)
InlineFunctionGenerator FindInlineFunctionGenerator(Runtime::FunctionId id)
void EmitNamedPropertyAssignment(Assignment *expr)
Handle< FixedArray > handler_table_
static const InlineFunctionGenerator kInlineFunctionGenerators[]
void RecordJSReturnSite(Call *call)
static Register result_register()
void VisitForTypeofValue(Expression *expr)
void EmitDynamicLookupFastCase(VariableProxy *proxy, TypeofState typeof_state, Label *slow, Label *done)
bool ShouldInlineSmiCase(Token::Value op)
Handle< FixedArray > handler_table()
void SetReturnPosition(FunctionLiteral *fun)
void EmitProfilingCounterDecrement(int delta)
void VisitInDuplicateContext(Expression *expr)
static uint32_t & uint32_at(Address addr)
Iterator find(Literal *key, bool insert=false, ZoneAllocationPolicy allocator=ZoneAllocationPolicy())
static TypeFeedbackId None()
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
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 pairs(ARM only)") DEFINE_BOOL(enable_unaligned_accesses
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 EMIT_INLINE_RUNTIME_CALL(name, x, y)
#define DECLARE_VISIT(type)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
kFeedbackVectorOffset flag
Debugger support for the V8 JavaScript engine.
#define INLINE_FUNCTION_LIST(F)