namespace internal {
namespace compiler {
+class Linkage;
+
// Generates native code for a sequence of instructions.
class CodeGenerator FINAL : public GapResolver::Assembler {
public:
- explicit CodeGenerator(InstructionSequence* code);
+ explicit CodeGenerator(Frame* frame, Linkage* linkage,
+ InstructionSequence* code, CompilationInfo* info);
// Generate native code.
Handle<Code> GenerateCode();
InstructionSequence* code() const { return code_; }
- Frame* frame() const { return code()->frame(); }
- Graph* graph() const { return code()->graph(); }
+ Frame* frame() const { return frame_; }
Isolate* isolate() const { return zone()->isolate(); }
- Linkage* linkage() const { return code()->linkage(); }
- Schedule* schedule() const { return code()->schedule(); }
+ Linkage* linkage() const { return linkage_; }
private:
MacroAssembler* masm() { return &masm_; }
GapResolver* resolver() { return &resolver_; }
SafepointTableBuilder* safepoints() { return &safepoints_; }
Zone* zone() const { return code()->zone(); }
+ CompilationInfo* info() const { return info_; }
// Checks if {block} will appear directly after {current_block_} when
// assembling code, in which case, a fall-through can be used.
- bool IsNextInAssemblyOrder(const BasicBlock* block) const {
- return block->rpo_number_ == (current_block_->rpo_number_ + 1) &&
- block->deferred_ == current_block_->deferred_;
- }
+ bool IsNextInAssemblyOrder(BasicBlock::RpoNumber block) const;
// Record a safepoint with the given pointer map.
void RecordSafepoint(PointerMap* pointers, Safepoint::Kind kind,
Translation* translation, size_t frame_state_offset,
OutputFrameStateCombine state_combine);
void AddTranslationForOperand(Translation* translation, Instruction* instr,
- InstructionOperand* op);
+ InstructionOperand* op, MachineType type);
void AddNopForSmiCodeInlining();
void EnsureSpaceForLazyDeopt();
void MarkLazyDeoptSite();
int pc_offset_;
};
- InstructionSequence* code_;
- BasicBlock* current_block_;
+ Frame* const frame_;
+ Linkage* const linkage_;
+ InstructionSequence* const code_;
+ CompilationInfo* const info_;
+ BasicBlock::RpoNumber current_block_;
SourcePosition current_source_position_;
MacroAssembler masm_;
GapResolver resolver_;