Revision f230a1cf deps/v8/src/mips/lithium-codegen-mips.h
deps/v8/src/mips/lithium-codegen-mips.h | ||
---|---|---|
31 | 31 |
#include "deoptimizer.h" |
32 | 32 |
#include "mips/lithium-gap-resolver-mips.h" |
33 | 33 |
#include "mips/lithium-mips.h" |
34 |
#include "lithium-codegen.h" |
|
34 | 35 |
#include "safepoint-table.h" |
35 | 36 |
#include "scopes.h" |
36 | 37 |
#include "v8utils.h" |
... | ... | |
42 | 43 |
class LDeferredCode; |
43 | 44 |
class SafepointGenerator; |
44 | 45 |
|
45 |
class LCodeGen V8_FINAL BASE_EMBEDDED {
|
|
46 |
class LCodeGen: public LCodeGenBase {
|
|
46 | 47 |
public: |
47 | 48 |
LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info) |
48 |
: zone_(info->zone()), |
|
49 |
chunk_(static_cast<LPlatformChunk*>(chunk)), |
|
50 |
masm_(assembler), |
|
51 |
info_(info), |
|
52 |
current_block_(-1), |
|
53 |
current_instruction_(-1), |
|
54 |
instructions_(chunk->instructions()), |
|
49 |
: LCodeGenBase(chunk, assembler, info), |
|
55 | 50 |
deoptimizations_(4, info->zone()), |
56 | 51 |
deopt_jump_table_(4, info->zone()), |
57 | 52 |
deoptimization_literals_(8, info->zone()), |
58 | 53 |
inlined_function_count_(0), |
59 | 54 |
scope_(info->scope()), |
60 |
status_(UNUSED), |
|
61 | 55 |
translations_(info->zone()), |
62 | 56 |
deferred_(8, info->zone()), |
63 | 57 |
osr_pc_offset_(-1), |
64 |
last_lazy_deopt_pc_(0), |
|
65 | 58 |
frame_is_built_(false), |
66 | 59 |
safepoints_(info->zone()), |
67 | 60 |
resolver_(this), |
68 |
expected_safepoint_kind_(Safepoint::kSimple), |
|
69 |
old_position_(RelocInfo::kNoPosition) { |
|
61 |
expected_safepoint_kind_(Safepoint::kSimple) { |
|
70 | 62 |
PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
71 | 63 |
} |
72 | 64 |
|
73 | 65 |
|
74 |
// Simple accessors. |
|
75 |
MacroAssembler* masm() const { return masm_; } |
|
76 |
CompilationInfo* info() const { return info_; } |
|
77 |
Isolate* isolate() const { return info_->isolate(); } |
|
78 |
Factory* factory() const { return isolate()->factory(); } |
|
79 |
Heap* heap() const { return isolate()->heap(); } |
|
80 |
Zone* zone() const { return zone_; } |
|
81 |
|
|
82 | 66 |
int LookupDestination(int block_id) const { |
83 | 67 |
return chunk()->LookupDestination(block_id); |
84 | 68 |
} |
... | ... | |
177 | 161 |
#undef DECLARE_DO |
178 | 162 |
|
179 | 163 |
private: |
180 |
enum Status { |
|
181 |
UNUSED, |
|
182 |
GENERATING, |
|
183 |
DONE, |
|
184 |
ABORTED |
|
185 |
}; |
|
186 |
|
|
187 |
bool is_unused() const { return status_ == UNUSED; } |
|
188 |
bool is_generating() const { return status_ == GENERATING; } |
|
189 |
bool is_done() const { return status_ == DONE; } |
|
190 |
bool is_aborted() const { return status_ == ABORTED; } |
|
191 |
|
|
192 | 164 |
StrictModeFlag strict_mode_flag() const { |
193 | 165 |
return info()->is_classic_mode() ? kNonStrictMode : kStrictMode; |
194 | 166 |
} |
195 | 167 |
|
196 |
LPlatformChunk* chunk() const { return chunk_; } |
|
197 | 168 |
Scope* scope() const { return scope_; } |
198 |
HGraph* graph() const { return chunk()->graph(); } |
|
199 | 169 |
|
200 | 170 |
Register scratch0() { return kLithiumScratchReg; } |
201 | 171 |
Register scratch1() { return kLithiumScratchReg2; } |
202 | 172 |
DoubleRegister double_scratch0() { return kLithiumScratchDouble; } |
203 | 173 |
|
204 |
int GetNextEmittedBlock() const; |
|
205 | 174 |
LInstruction* GetNextInstruction(); |
206 | 175 |
|
207 | 176 |
void EmitClassOfTest(Label* if_true, |
... | ... | |
214 | 183 |
int GetStackSlotCount() const { return chunk()->spill_slot_count(); } |
215 | 184 |
|
216 | 185 |
void Abort(BailoutReason reason); |
217 |
void FPRINTF_CHECKING Comment(const char* format, ...); |
|
218 | 186 |
|
219 | 187 |
void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); } |
220 | 188 |
|
221 | 189 |
// Code generation passes. Returns true if code generation should |
222 | 190 |
// continue. |
223 | 191 |
bool GeneratePrologue(); |
224 |
bool GenerateBody(); |
|
225 | 192 |
bool GenerateDeferredCode(); |
226 | 193 |
bool GenerateDeoptJumpTable(); |
227 | 194 |
bool GenerateSafepointTable(); |
... | ... | |
245 | 212 |
|
246 | 213 |
void CallRuntime(const Runtime::Function* function, |
247 | 214 |
int num_arguments, |
248 |
LInstruction* instr); |
|
215 |
LInstruction* instr, |
|
216 |
SaveFPRegsMode save_doubles = kDontSaveFPRegs); |
|
249 | 217 |
|
250 | 218 |
void CallRuntime(Runtime::FunctionId id, |
251 | 219 |
int num_arguments, |
... | ... | |
254 | 222 |
CallRuntime(function, num_arguments, instr); |
255 | 223 |
} |
256 | 224 |
|
225 |
void LoadContextFromDeferred(LOperand* context); |
|
257 | 226 |
void CallRuntimeFromDeferred(Runtime::FunctionId id, |
258 | 227 |
int argc, |
259 |
LInstruction* instr); |
|
228 |
LInstruction* instr, |
|
229 |
LOperand* context); |
|
260 | 230 |
|
261 | 231 |
enum A1State { |
262 | 232 |
A1_UNINITIALIZED, |
... | ... | |
324 | 294 |
void RecordSafepointWithRegistersAndDoubles(LPointerMap* pointers, |
325 | 295 |
int arguments, |
326 | 296 |
Safepoint::DeoptMode mode); |
327 |
void RecordPosition(int position); |
|
328 |
void RecordAndUpdatePosition(int position);
|
|
297 |
|
|
298 |
void RecordAndWritePosition(int position) V8_OVERRIDE;
|
|
329 | 299 |
|
330 | 300 |
static Condition TokenToCondition(Token::Value op, bool is_unsigned); |
331 | 301 |
void EmitGoto(int block); |
... | ... | |
404 | 374 |
LEnvironment* environment); |
405 | 375 |
|
406 | 376 |
|
407 |
void EnsureSpaceForLazyDeopt();
|
|
377 |
void EnsureSpaceForLazyDeopt(int space_needed) V8_OVERRIDE;
|
|
408 | 378 |
void DoLoadKeyedExternalArray(LLoadKeyed* instr); |
409 | 379 |
void DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr); |
410 | 380 |
void DoLoadKeyedFixedArray(LLoadKeyed* instr); |
... | ... | |
412 | 382 |
void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr); |
413 | 383 |
void DoStoreKeyedFixedArray(LStoreKeyed* instr); |
414 | 384 |
|
415 |
Zone* zone_; |
|
416 |
LPlatformChunk* const chunk_; |
|
417 |
MacroAssembler* const masm_; |
|
418 |
CompilationInfo* const info_; |
|
419 |
|
|
420 |
int current_block_; |
|
421 |
int current_instruction_; |
|
422 |
const ZoneList<LInstruction*>* instructions_; |
|
423 | 385 |
ZoneList<LEnvironment*> deoptimizations_; |
424 | 386 |
ZoneList<Deoptimizer::JumpTableEntry> deopt_jump_table_; |
425 | 387 |
ZoneList<Handle<Object> > deoptimization_literals_; |
426 | 388 |
int inlined_function_count_; |
427 | 389 |
Scope* const scope_; |
428 |
Status status_; |
|
429 | 390 |
TranslationBuffer translations_; |
430 | 391 |
ZoneList<LDeferredCode*> deferred_; |
431 | 392 |
int osr_pc_offset_; |
432 |
int last_lazy_deopt_pc_; |
|
433 | 393 |
bool frame_is_built_; |
434 | 394 |
|
435 | 395 |
// Builder that keeps track of safepoints in the code. The table |
... | ... | |
441 | 401 |
|
442 | 402 |
Safepoint::Kind expected_safepoint_kind_; |
443 | 403 |
|
444 |
int old_position_; |
|
445 |
|
|
446 | 404 |
class PushSafepointRegistersScope V8_FINAL BASE_EMBEDDED { |
447 | 405 |
public: |
448 | 406 |
PushSafepointRegistersScope(LCodeGen* codegen, |
Also available in: Unified diff