| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_COMPILER_CODE_GENERATOR_H_ | 5 #ifndef V8_COMPILER_CODE_GENERATOR_H_ |
| 6 #define V8_COMPILER_CODE_GENERATOR_H_ | 6 #define V8_COMPILER_CODE_GENERATOR_H_ |
| 7 | 7 |
| 8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
| 9 #include "src/compiler/instruction.h" | 9 #include "src/compiler/instruction.h" |
| 10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 InstructionSequence* code, CompilationInfo* info); | 34 InstructionSequence* code, CompilationInfo* info); |
| 35 | 35 |
| 36 // Generate native code. | 36 // Generate native code. |
| 37 Handle<Code> GenerateCode(); | 37 Handle<Code> GenerateCode(); |
| 38 | 38 |
| 39 InstructionSequence* code() const { return code_; } | 39 InstructionSequence* code() const { return code_; } |
| 40 Frame* frame() const { return frame_; } | 40 Frame* frame() const { return frame_; } |
| 41 Isolate* isolate() const { return info_->isolate(); } | 41 Isolate* isolate() const { return info_->isolate(); } |
| 42 Linkage* linkage() const { return linkage_; } | 42 Linkage* linkage() const { return linkage_; } |
| 43 | 43 |
| 44 Label* GetLabel(BasicBlock::RpoNumber rpo) { return &labels_[rpo.ToSize()]; } | 44 Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; } |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 MacroAssembler* masm() { return &masm_; } | 47 MacroAssembler* masm() { return &masm_; } |
| 48 GapResolver* resolver() { return &resolver_; } | 48 GapResolver* resolver() { return &resolver_; } |
| 49 SafepointTableBuilder* safepoints() { return &safepoints_; } | 49 SafepointTableBuilder* safepoints() { return &safepoints_; } |
| 50 Zone* zone() const { return code()->zone(); } | 50 Zone* zone() const { return code()->zone(); } |
| 51 CompilationInfo* info() const { return info_; } | 51 CompilationInfo* info() const { return info_; } |
| 52 | 52 |
| 53 // Checks if {block} will appear directly after {current_block_} when | 53 // Checks if {block} will appear directly after {current_block_} when |
| 54 // assembling code, in which case, a fall-through can be used. | 54 // assembling code, in which case, a fall-through can be used. |
| 55 bool IsNextInAssemblyOrder(BasicBlock::RpoNumber block) const; | 55 bool IsNextInAssemblyOrder(RpoNumber block) const; |
| 56 | 56 |
| 57 // Record a safepoint with the given pointer map. | 57 // Record a safepoint with the given pointer map. |
| 58 void RecordSafepoint(PointerMap* pointers, Safepoint::Kind kind, | 58 void RecordSafepoint(PointerMap* pointers, Safepoint::Kind kind, |
| 59 int arguments, Safepoint::DeoptMode deopt_mode); | 59 int arguments, Safepoint::DeoptMode deopt_mode); |
| 60 | 60 |
| 61 // Assemble code for the specified instruction. | 61 // Assemble code for the specified instruction. |
| 62 void AssembleInstruction(Instruction* instr); | 62 void AssembleInstruction(Instruction* instr); |
| 63 void AssembleSourcePosition(SourcePositionInstruction* instr); | 63 void AssembleSourcePosition(SourcePositionInstruction* instr); |
| 64 void AssembleGap(GapInstruction* gap); | 64 void AssembleGap(GapInstruction* gap); |
| 65 | 65 |
| 66 // =========================================================================== | 66 // =========================================================================== |
| 67 // ============= Architecture-specific code generation methods. ============== | 67 // ============= Architecture-specific code generation methods. ============== |
| 68 // =========================================================================== | 68 // =========================================================================== |
| 69 | 69 |
| 70 void AssembleArchInstruction(Instruction* instr); | 70 void AssembleArchInstruction(Instruction* instr); |
| 71 void AssembleArchJump(BasicBlock::RpoNumber target); | 71 void AssembleArchJump(RpoNumber target); |
| 72 void AssembleArchBranch(Instruction* instr, BranchInfo* branch); | 72 void AssembleArchBranch(Instruction* instr, BranchInfo* branch); |
| 73 void AssembleArchBoolean(Instruction* instr, FlagsCondition condition); | 73 void AssembleArchBoolean(Instruction* instr, FlagsCondition condition); |
| 74 void AssembleArchLookupSwitch(Instruction* instr); | 74 void AssembleArchLookupSwitch(Instruction* instr); |
| 75 void AssembleArchTableSwitch(Instruction* instr); | 75 void AssembleArchTableSwitch(Instruction* instr); |
| 76 | 76 |
| 77 void AssembleDeoptimizerCall(int deoptimization_id); | 77 void AssembleDeoptimizerCall(int deoptimization_id); |
| 78 | 78 |
| 79 // Generates an architecture-specific, descriptor-specific prologue | 79 // Generates an architecture-specific, descriptor-specific prologue |
| 80 // to set up a stack frame. | 80 // to set up a stack frame. |
| 81 void AssemblePrologue(); | 81 void AssemblePrologue(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 int pc_offset; | 151 int pc_offset; |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 friend class OutOfLineCode; | 154 friend class OutOfLineCode; |
| 155 | 155 |
| 156 Frame* const frame_; | 156 Frame* const frame_; |
| 157 Linkage* const linkage_; | 157 Linkage* const linkage_; |
| 158 InstructionSequence* const code_; | 158 InstructionSequence* const code_; |
| 159 CompilationInfo* const info_; | 159 CompilationInfo* const info_; |
| 160 Label* const labels_; | 160 Label* const labels_; |
| 161 BasicBlock::RpoNumber current_block_; | 161 RpoNumber current_block_; |
| 162 SourcePosition current_source_position_; | 162 SourcePosition current_source_position_; |
| 163 MacroAssembler masm_; | 163 MacroAssembler masm_; |
| 164 GapResolver resolver_; | 164 GapResolver resolver_; |
| 165 SafepointTableBuilder safepoints_; | 165 SafepointTableBuilder safepoints_; |
| 166 ZoneVector<HandlerInfo> handlers_; | 166 ZoneVector<HandlerInfo> handlers_; |
| 167 ZoneDeque<DeoptimizationState*> deoptimization_states_; | 167 ZoneDeque<DeoptimizationState*> deoptimization_states_; |
| 168 ZoneDeque<Handle<Object>> deoptimization_literals_; | 168 ZoneDeque<Handle<Object>> deoptimization_literals_; |
| 169 TranslationBuffer translations_; | 169 TranslationBuffer translations_; |
| 170 int last_lazy_deopt_pc_; | 170 int last_lazy_deopt_pc_; |
| 171 JumpTable* jump_tables_; | 171 JumpTable* jump_tables_; |
| 172 OutOfLineCode* ools_; | 172 OutOfLineCode* ools_; |
| 173 int osr_pc_offset_; | 173 int osr_pc_offset_; |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 } // namespace compiler | 176 } // namespace compiler |
| 177 } // namespace internal | 177 } // namespace internal |
| 178 } // namespace v8 | 178 } // namespace v8 |
| 179 | 179 |
| 180 #endif // V8_COMPILER_CODE_GENERATOR_H | 180 #endif // V8_COMPILER_CODE_GENERATOR_H |
| OLD | NEW |