OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 class LCodeGen BASE_EMBEDDED { | 46 class LCodeGen BASE_EMBEDDED { |
47 public: | 47 public: |
48 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info, | 48 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info, |
49 Zone* zone) | 49 Zone* zone) |
50 : chunk_(chunk), | 50 : chunk_(chunk), |
51 masm_(assembler), | 51 masm_(assembler), |
52 info_(info), | 52 info_(info), |
53 current_block_(-1), | 53 current_block_(-1), |
54 current_instruction_(-1), | 54 current_instruction_(-1), |
55 instructions_(chunk->instructions()), | 55 instructions_(chunk->instructions()), |
56 deoptimizations_(4), | 56 deoptimizations_(4, zone), |
57 jump_table_(4), | 57 jump_table_(4, zone), |
58 deoptimization_literals_(8), | 58 deoptimization_literals_(8, zone), |
59 inlined_function_count_(0), | 59 inlined_function_count_(0), |
60 scope_(info->scope()), | 60 scope_(info->scope()), |
61 status_(UNUSED), | 61 status_(UNUSED), |
62 translations_(zone), | 62 translations_(zone), |
63 deferred_(8), | 63 deferred_(8, zone), |
64 osr_pc_offset_(-1), | 64 osr_pc_offset_(-1), |
65 last_lazy_deopt_pc_(0), | 65 last_lazy_deopt_pc_(0), |
66 safepoints_(zone), | 66 safepoints_(zone), |
| 67 zone_(zone), |
67 resolver_(this), | 68 resolver_(this), |
68 expected_safepoint_kind_(Safepoint::kSimple), | 69 expected_safepoint_kind_(Safepoint::kSimple) { |
69 zone_(zone) { | |
70 PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 70 PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
71 } | 71 } |
72 | 72 |
73 // Simple accessors. | 73 // Simple accessors. |
74 MacroAssembler* masm() const { return masm_; } | 74 MacroAssembler* masm() const { return masm_; } |
75 CompilationInfo* info() const { return info_; } | 75 CompilationInfo* info() const { return info_; } |
76 Isolate* isolate() const { return info_->isolate(); } | 76 Isolate* isolate() const { return info_->isolate(); } |
77 Factory* factory() const { return isolate()->factory(); } | 77 Factory* factory() const { return isolate()->factory(); } |
78 Heap* heap() const { return isolate()->heap(); } | 78 Heap* heap() const { return isolate()->heap(); } |
79 Zone* zone() const { return zone_; } | 79 Zone* zone() const { return zone_; } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 Register input, | 153 Register input, |
154 Register temporary, | 154 Register temporary, |
155 Register scratch); | 155 Register scratch); |
156 | 156 |
157 int GetStackSlotCount() const { return chunk()->spill_slot_count(); } | 157 int GetStackSlotCount() const { return chunk()->spill_slot_count(); } |
158 int GetParameterCount() const { return scope()->num_parameters(); } | 158 int GetParameterCount() const { return scope()->num_parameters(); } |
159 | 159 |
160 void Abort(const char* format, ...); | 160 void Abort(const char* format, ...); |
161 void Comment(const char* format, ...); | 161 void Comment(const char* format, ...); |
162 | 162 |
163 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code); } | 163 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); } |
164 | 164 |
165 // Code generation passes. Returns true if code generation should | 165 // Code generation passes. Returns true if code generation should |
166 // continue. | 166 // continue. |
167 bool GeneratePrologue(); | 167 bool GeneratePrologue(); |
168 bool GenerateBody(); | 168 bool GenerateBody(); |
169 bool GenerateDeferredCode(); | 169 bool GenerateDeferredCode(); |
170 bool GenerateJumpTable(); | 170 bool GenerateJumpTable(); |
171 bool GenerateSafepointTable(); | 171 bool GenerateSafepointTable(); |
172 | 172 |
173 enum SafepointMode { | 173 enum SafepointMode { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 Status status_; | 339 Status status_; |
340 TranslationBuffer translations_; | 340 TranslationBuffer translations_; |
341 ZoneList<LDeferredCode*> deferred_; | 341 ZoneList<LDeferredCode*> deferred_; |
342 int osr_pc_offset_; | 342 int osr_pc_offset_; |
343 int last_lazy_deopt_pc_; | 343 int last_lazy_deopt_pc_; |
344 | 344 |
345 // Builder that keeps track of safepoints in the code. The table | 345 // Builder that keeps track of safepoints in the code. The table |
346 // itself is emitted at the end of the generated code. | 346 // itself is emitted at the end of the generated code. |
347 SafepointTableBuilder safepoints_; | 347 SafepointTableBuilder safepoints_; |
348 | 348 |
| 349 Zone* zone_; |
| 350 |
349 // Compiler from a set of parallel moves to a sequential list of moves. | 351 // Compiler from a set of parallel moves to a sequential list of moves. |
350 LGapResolver resolver_; | 352 LGapResolver resolver_; |
351 | 353 |
352 Safepoint::Kind expected_safepoint_kind_; | 354 Safepoint::Kind expected_safepoint_kind_; |
353 | 355 |
354 Zone* zone_; | |
355 | |
356 class PushSafepointRegistersScope BASE_EMBEDDED { | 356 class PushSafepointRegistersScope BASE_EMBEDDED { |
357 public: | 357 public: |
358 explicit PushSafepointRegistersScope(LCodeGen* codegen) | 358 explicit PushSafepointRegistersScope(LCodeGen* codegen) |
359 : codegen_(codegen) { | 359 : codegen_(codegen) { |
360 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); | 360 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); |
361 codegen_->masm_->PushSafepointRegisters(); | 361 codegen_->masm_->PushSafepointRegisters(); |
362 codegen_->expected_safepoint_kind_ = Safepoint::kWithRegisters; | 362 codegen_->expected_safepoint_kind_ = Safepoint::kWithRegisters; |
363 } | 363 } |
364 | 364 |
365 ~PushSafepointRegistersScope() { | 365 ~PushSafepointRegistersScope() { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 LCodeGen* codegen_; | 405 LCodeGen* codegen_; |
406 Label entry_; | 406 Label entry_; |
407 Label exit_; | 407 Label exit_; |
408 Label* external_exit_; | 408 Label* external_exit_; |
409 int instruction_index_; | 409 int instruction_index_; |
410 }; | 410 }; |
411 | 411 |
412 } } // namespace v8::internal | 412 } } // namespace v8::internal |
413 | 413 |
414 #endif // V8_X64_LITHIUM_CODEGEN_X64_H_ | 414 #endif // V8_X64_LITHIUM_CODEGEN_X64_H_ |
OLD | NEW |