Revision f230a1cf deps/v8/src/x64/lithium-codegen-x64.h
deps/v8/src/x64/lithium-codegen-x64.h | ||
---|---|---|
32 | 32 |
|
33 | 33 |
#include "checks.h" |
34 | 34 |
#include "deoptimizer.h" |
35 |
#include "lithium-codegen.h" |
|
35 | 36 |
#include "safepoint-table.h" |
36 | 37 |
#include "scopes.h" |
37 | 38 |
#include "v8utils.h" |
... | ... | |
44 | 45 |
class LDeferredCode; |
45 | 46 |
class SafepointGenerator; |
46 | 47 |
|
47 |
class LCodeGen V8_FINAL BASE_EMBEDDED {
|
|
48 |
class LCodeGen: public LCodeGenBase {
|
|
48 | 49 |
public: |
49 | 50 |
LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info) |
50 |
: zone_(info->zone()), |
|
51 |
chunk_(static_cast<LPlatformChunk*>(chunk)), |
|
52 |
masm_(assembler), |
|
53 |
info_(info), |
|
54 |
current_block_(-1), |
|
55 |
current_instruction_(-1), |
|
56 |
instructions_(chunk->instructions()), |
|
51 |
: LCodeGenBase(chunk, assembler, info), |
|
57 | 52 |
deoptimizations_(4, info->zone()), |
58 | 53 |
jump_table_(4, info->zone()), |
59 | 54 |
deoptimization_literals_(8, info->zone()), |
60 | 55 |
inlined_function_count_(0), |
61 | 56 |
scope_(info->scope()), |
62 |
status_(UNUSED), |
|
63 | 57 |
translations_(info->zone()), |
64 | 58 |
deferred_(8, info->zone()), |
65 | 59 |
osr_pc_offset_(-1), |
66 |
last_lazy_deopt_pc_(0), |
|
67 | 60 |
frame_is_built_(false), |
68 | 61 |
safepoints_(info->zone()), |
69 | 62 |
resolver_(this), |
70 |
expected_safepoint_kind_(Safepoint::kSimple), |
|
71 |
old_position_(RelocInfo::kNoPosition) { |
|
63 |
expected_safepoint_kind_(Safepoint::kSimple) { |
|
72 | 64 |
PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
73 | 65 |
} |
74 | 66 |
|
75 |
// Simple accessors. |
|
76 |
MacroAssembler* masm() const { return masm_; } |
|
77 |
CompilationInfo* info() const { return info_; } |
|
78 |
Isolate* isolate() const { return info_->isolate(); } |
|
79 |
Factory* factory() const { return isolate()->factory(); } |
|
80 |
Heap* heap() const { return isolate()->heap(); } |
|
81 |
Zone* zone() const { return zone_; } |
|
82 |
|
|
83 | 67 |
int LookupDestination(int block_id) const { |
84 | 68 |
return chunk()->LookupDestination(block_id); |
85 | 69 |
} |
... | ... | |
146 | 130 |
#undef DECLARE_DO |
147 | 131 |
|
148 | 132 |
private: |
149 |
enum Status { |
|
150 |
UNUSED, |
|
151 |
GENERATING, |
|
152 |
DONE, |
|
153 |
ABORTED |
|
154 |
}; |
|
155 |
|
|
156 |
bool is_unused() const { return status_ == UNUSED; } |
|
157 |
bool is_generating() const { return status_ == GENERATING; } |
|
158 |
bool is_done() const { return status_ == DONE; } |
|
159 |
bool is_aborted() const { return status_ == ABORTED; } |
|
160 |
|
|
161 | 133 |
StrictModeFlag strict_mode_flag() const { |
162 | 134 |
return info()->is_classic_mode() ? kNonStrictMode : kStrictMode; |
163 | 135 |
} |
... | ... | |
166 | 138 |
Scope* scope() const { return scope_; } |
167 | 139 |
HGraph* graph() const { return chunk()->graph(); } |
168 | 140 |
|
169 |
int GetNextEmittedBlock() const;
|
|
141 |
XMMRegister double_scratch0() const { return xmm0; }
|
|
170 | 142 |
|
171 | 143 |
void EmitClassOfTest(Label* if_true, |
172 | 144 |
Label* if_false, |
... | ... | |
178 | 150 |
int GetStackSlotCount() const { return chunk()->spill_slot_count(); } |
179 | 151 |
|
180 | 152 |
void Abort(BailoutReason reason); |
181 |
void FPRINTF_CHECKING Comment(const char* format, ...); |
|
182 | 153 |
|
183 | 154 |
void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); } |
184 | 155 |
|
185 | 156 |
// Code generation passes. Returns true if code generation should |
186 | 157 |
// continue. |
187 | 158 |
bool GeneratePrologue(); |
188 |
bool GenerateBody(); |
|
189 | 159 |
bool GenerateDeferredCode(); |
190 | 160 |
bool GenerateJumpTable(); |
191 | 161 |
bool GenerateSafepointTable(); |
... | ... | |
211 | 181 |
|
212 | 182 |
void CallRuntime(const Runtime::Function* function, |
213 | 183 |
int num_arguments, |
214 |
LInstruction* instr); |
|
184 |
LInstruction* instr, |
|
185 |
SaveFPRegsMode save_doubles = kDontSaveFPRegs); |
|
215 | 186 |
|
216 | 187 |
void CallRuntime(Runtime::FunctionId id, |
217 | 188 |
int num_arguments, |
... | ... | |
284 | 255 |
void RecordSafepointWithRegisters(LPointerMap* pointers, |
285 | 256 |
int arguments, |
286 | 257 |
Safepoint::DeoptMode mode); |
287 |
void RecordPosition(int position); |
|
288 |
void RecordAndUpdatePosition(int position); |
|
258 |
void RecordAndWritePosition(int position) V8_OVERRIDE; |
|
289 | 259 |
|
290 | 260 |
static Condition TokenToCondition(Token::Value op, bool is_unsigned); |
291 | 261 |
void EmitGoto(int block); |
... | ... | |
340 | 310 |
int* offset, |
341 | 311 |
AllocationSiteMode mode); |
342 | 312 |
|
343 |
void EnsureSpaceForLazyDeopt(int space_needed); |
|
313 |
void EnsureSpaceForLazyDeopt(int space_needed) V8_OVERRIDE;
|
|
344 | 314 |
void DoLoadKeyedExternalArray(LLoadKeyed* instr); |
345 | 315 |
void DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr); |
346 | 316 |
void DoLoadKeyedFixedArray(LLoadKeyed* instr); |
... | ... | |
355 | 325 |
void MakeSureStackPagesMapped(int offset); |
356 | 326 |
#endif |
357 | 327 |
|
358 |
Zone* zone_; |
|
359 |
LPlatformChunk* const chunk_; |
|
360 |
MacroAssembler* const masm_; |
|
361 |
CompilationInfo* const info_; |
|
362 |
|
|
363 |
int current_block_; |
|
364 |
int current_instruction_; |
|
365 |
const ZoneList<LInstruction*>* instructions_; |
|
366 | 328 |
ZoneList<LEnvironment*> deoptimizations_; |
367 | 329 |
ZoneList<Deoptimizer::JumpTableEntry> jump_table_; |
368 | 330 |
ZoneList<Handle<Object> > deoptimization_literals_; |
369 | 331 |
int inlined_function_count_; |
370 | 332 |
Scope* const scope_; |
371 |
Status status_; |
|
372 | 333 |
TranslationBuffer translations_; |
373 | 334 |
ZoneList<LDeferredCode*> deferred_; |
374 | 335 |
int osr_pc_offset_; |
375 |
int last_lazy_deopt_pc_; |
|
376 | 336 |
bool frame_is_built_; |
377 | 337 |
|
378 | 338 |
// Builder that keeps track of safepoints in the code. The table |
... | ... | |
384 | 344 |
|
385 | 345 |
Safepoint::Kind expected_safepoint_kind_; |
386 | 346 |
|
387 |
int old_position_; |
|
388 |
|
|
389 | 347 |
class PushSafepointRegistersScope V8_FINAL BASE_EMBEDDED { |
390 | 348 |
public: |
391 | 349 |
explicit PushSafepointRegistersScope(LCodeGen* codegen) |
Also available in: Unified diff