28 #ifndef V8_X64_LITHIUM_CODEGEN_X64_H_
29 #define V8_X64_LITHIUM_CODEGEN_X64_H_
44 class SafepointGenerator;
49 : zone_(info->zone()),
54 current_instruction_(-1),
56 deoptimizations_(4, info->zone()),
57 jump_table_(4, info->zone()),
58 deoptimization_literals_(8, info->zone()),
59 inlined_function_count_(0),
60 scope_(info->scope()),
62 translations_(info->zone()),
63 deferred_(8, info->zone()),
65 last_lazy_deopt_pc_(0),
66 safepoints_(info->zone()),
68 expected_safepoint_kind_(Safepoint::kSimple) {
69 PopulateDeoptimizationLiteralsWithInlinedFunctions();
77 Heap*
heap()
const {
return isolate()->heap(); }
88 Operand ToOperand(
LOperand* op)
const;
105 void DoDeferredRandom(
LRandom* instr);
117 void DoGap(
LGap* instr);
121 Translation* translation,
122 int* arguments_index,
123 int* arguments_count);
126 #define DECLARE_DO(type) void Do##type(L##type* node);
138 bool is_unused()
const {
return status_ == UNUSED; }
139 bool is_generating()
const {
return status_ == GENERATING; }
140 bool is_done()
const {
return status_ ==
DONE; }
141 bool is_aborted()
const {
return status_ == ABORTED; }
147 LPlatformChunk* chunk()
const {
return chunk_; }
148 Scope* scope()
const {
return scope_; }
149 HGraph* graph()
const {
return chunk_->graph(); }
151 int GetNextEmittedBlock(
int block);
153 void EmitClassOfTest(Label* if_true,
155 Handle<String> class_name,
160 int GetStackSlotCount()
const {
return chunk()->spill_slot_count(); }
161 int GetParameterCount()
const {
return scope()->num_parameters(); }
163 void Abort(
const char* reason);
164 void Comment(
const char* format, ...);
166 void AddDeferredCode(LDeferredCode*
code) { deferred_.Add(code, zone()); }
170 bool GeneratePrologue();
172 bool GenerateDeferredCode();
173 bool GenerateJumpTable();
174 bool GenerateSafepointTable();
177 RECORD_SIMPLE_SAFEPOINT,
178 RECORD_SAFEPOINT_WITH_REGISTERS
181 void CallCodeGeneric(Handle<Code> code,
182 RelocInfo::Mode mode,
184 SafepointMode safepoint_mode,
188 void CallCode(Handle<Code> code,
189 RelocInfo::Mode mode,
190 LInstruction* instr);
192 void CallRuntime(
const Runtime::Function*
function,
194 LInstruction* instr);
198 LInstruction* instr) {
200 CallRuntime(
function, num_arguments, instr);
205 LInstruction* instr);
214 void CallKnownFunction(Handle<JSFunction>
function,
221 void RecordSafepointWithLazyDeopt(LInstruction* instr,
222 SafepointMode safepoint_mode,
224 void RegisterEnvironmentForDeoptimization(LEnvironment* environment,
225 Safepoint::DeoptMode mode);
226 void DeoptimizeIf(
Condition cc, LEnvironment* environment);
228 void AddToTranslation(Translation* translation,
233 int arguments_count);
234 void PopulateDeoptimizationData(Handle<Code> code);
235 int DefineDeoptimizationLiteral(Handle<Object> literal);
237 void PopulateDeoptimizationLiteralsWithInlinedFunctions();
240 XMMRegister ToDoubleRegister(
int index)
const;
241 Operand BuildFastArrayOperand(
242 LOperand* elements_pointer,
246 uint32_t additional_index = 0);
249 void EmitIntegerMathAbs(LUnaryMathOperation* instr);
250 void DoMathAbs(LUnaryMathOperation* instr);
251 void DoMathFloor(LUnaryMathOperation* instr);
252 void DoMathRound(LUnaryMathOperation* instr);
253 void DoMathSqrt(LUnaryMathOperation* instr);
254 void DoMathPowHalf(LUnaryMathOperation* instr);
255 void DoMathLog(LUnaryMathOperation* instr);
256 void DoMathTan(LUnaryMathOperation* instr);
257 void DoMathCos(LUnaryMathOperation* instr);
258 void DoMathSin(LUnaryMathOperation* instr);
261 void RecordSafepoint(LPointerMap* pointers,
262 Safepoint::Kind kind,
264 Safepoint::DeoptMode mode);
265 void RecordSafepoint(LPointerMap* pointers, Safepoint::DeoptMode mode);
266 void RecordSafepoint(Safepoint::DeoptMode mode);
267 void RecordSafepointWithRegisters(LPointerMap* pointers,
269 Safepoint::DeoptMode mode);
270 void RecordPosition(
int position);
273 void EmitGoto(
int block);
274 void EmitBranch(
int left_block,
int right_block,
Condition cc);
275 void EmitNumberUntagD(Register input,
277 bool deoptimize_on_undefined,
278 bool deoptimize_on_minus_zero,
282 void DeoptIfTaggedButNotSmi(LEnvironment* environment,
289 Condition EmitTypeofIs(Label* true_label,
292 Handle<String> type_name);
298 Label* is_not_object,
306 Label* is_not_string);
310 void EmitIsConstructCall(Register temp);
312 void EmitLoadFieldOrConstantFunction(Register result,
320 void EmitPushTaggedOperand(LOperand* operand);
324 void EmitDeepCopy(Handle<JSObject>
object,
329 struct JumpTableEntry {
330 explicit inline JumpTableEntry(
Address entry)
337 void EnsureSpaceForLazyDeopt(
int space_needed);
340 LPlatformChunk*
const chunk_;
341 MacroAssembler*
const masm_;
342 CompilationInfo*
const info_;
345 int current_instruction_;
346 const ZoneList<LInstruction*>* instructions_;
347 ZoneList<LEnvironment*> deoptimizations_;
348 ZoneList<JumpTableEntry> jump_table_;
349 ZoneList<Handle<Object> > deoptimization_literals_;
350 int inlined_function_count_;
353 TranslationBuffer translations_;
354 ZoneList<LDeferredCode*> deferred_;
356 int last_lazy_deopt_pc_;
360 SafepointTableBuilder safepoints_;
363 LGapResolver resolver_;
365 Safepoint::Kind expected_safepoint_kind_;
369 explicit PushSafepointRegistersScope(LCodeGen* codegen)
370 : codegen_(codegen) {
371 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple);
372 codegen_->masm_->PushSafepointRegisters();
373 codegen_->expected_safepoint_kind_ = Safepoint::kWithRegisters;
376 ~PushSafepointRegistersScope() {
377 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kWithRegisters);
378 codegen_->masm_->PopSafepointRegisters();
379 codegen_->expected_safepoint_kind_ = Safepoint::kSimple;
386 friend class LDeferredCode;
387 friend class LEnvironment;
388 friend class SafepointGenerator;
393 class LDeferredCode:
public ZoneObject {
397 external_exit_(
NULL),
398 instruction_index_(codegen->current_instruction_) {
399 codegen->AddDeferredCode(
this);
408 Label*
exit() {
return external_exit_ !=
NULL ? external_exit_ : &exit_; }
412 LCodeGen*
codegen()
const {
return codegen_; }
419 Label* external_exit_;
420 int instruction_index_;
425 #endif // V8_X64_LITHIUM_CODEGEN_X64_H_
void SetExit(Label *exit)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 instructions(ARM only)") DEFINE_bool(enable_vfp2
MacroAssembler * masm() const
LDeferredCode(LCodeGen *codegen)
static const Function * FunctionForId(FunctionId id)
#define ASSERT(condition)
LCodeGen * codegen() const
MacroAssembler * masm() const
int instruction_index() const
bool is_uint32(int64_t x)
#define LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
LCodeGen(LChunk *chunk, MacroAssembler *assembler, CompilationInfo *info)
Isolate * isolate() const
virtual LInstruction * instr()=0
virtual void Generate()=0
CompilationInfo * info() const
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of MIPS FPU instructions if NULL
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
Register ToRegister(int num)
Factory * factory() const