1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef V8_LITHIUM_CODEGEN_H_
6 #define V8_LITHIUM_CODEGEN_H_
18 class LCodeGenBase BASE_EMBEDDED {
20 LCodeGenBase(LChunk* chunk,
21 MacroAssembler* assembler,
22 CompilationInfo* info);
23 virtual ~LCodeGenBase() {}
26 MacroAssembler* masm() const { return masm_; }
27 CompilationInfo* info() const { return info_; }
28 Isolate* isolate() const { return info_->isolate(); }
29 Factory* factory() const { return isolate()->factory(); }
30 Heap* heap() const { return isolate()->heap(); }
31 Zone* zone() const { return zone_; }
32 LPlatformChunk* chunk() const { return chunk_; }
33 HGraph* graph() const;
35 void FPRINTF_CHECKING Comment(const char* format, ...);
38 virtual void GenerateBodyInstructionPre(LInstruction* instr) {}
39 virtual void GenerateBodyInstructionPost(LInstruction* instr) {}
41 virtual void EnsureSpaceForLazyDeopt(int space_needed) = 0;
42 virtual void RecordAndWritePosition(int position) = 0;
44 int GetNextEmittedBlock() const;
46 void RegisterWeakObjectsInOptimizedCode(Handle<Code> code);
48 // Check that an environment assigned via AssignEnvironment is actually being
49 // used. Redundant assignments keep things alive longer than necessary, and
50 // consequently lead to worse code, so it's important to minimize this.
51 void CheckEnvironmentUsage();
61 LPlatformChunk* const chunk_;
62 MacroAssembler* const masm_;
63 CompilationInfo* const info_;
67 int current_instruction_;
68 const ZoneList<LInstruction*>* instructions_;
69 int last_lazy_deopt_pc_;
71 bool is_unused() const { return status_ == UNUSED; }
72 bool is_generating() const { return status_ == GENERATING; }
73 bool is_done() const { return status_ == DONE; }
74 bool is_aborted() const { return status_ == ABORTED; }
78 } } // namespace v8::internal
80 #endif // V8_LITHIUM_CODEGEN_H_