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 10 matching lines...) Expand all Loading... |
21 class OutOfLineCode; | 21 class OutOfLineCode; |
22 | 22 |
23 struct BranchInfo { | 23 struct BranchInfo { |
24 FlagsCondition condition; | 24 FlagsCondition condition; |
25 Label* true_label; | 25 Label* true_label; |
26 Label* false_label; | 26 Label* false_label; |
27 bool fallthru; | 27 bool fallthru; |
28 }; | 28 }; |
29 | 29 |
30 | 30 |
| 31 class InstructionOperandIterator { |
| 32 public: |
| 33 InstructionOperandIterator(Instruction* instr, size_t pos) |
| 34 : instr_(instr), pos_(pos) {} |
| 35 |
| 36 Instruction* instruction() const { return instr_; } |
| 37 InstructionOperand* Advance() { return instr_->InputAt(pos_++); } |
| 38 |
| 39 private: |
| 40 Instruction* instr_; |
| 41 size_t pos_; |
| 42 }; |
| 43 |
| 44 |
31 // Generates native code for a sequence of instructions. | 45 // Generates native code for a sequence of instructions. |
32 class CodeGenerator final : public GapResolver::Assembler { | 46 class CodeGenerator final : public GapResolver::Assembler { |
33 public: | 47 public: |
34 explicit CodeGenerator(Frame* frame, Linkage* linkage, | 48 explicit CodeGenerator(Frame* frame, Linkage* linkage, |
35 InstructionSequence* code, CompilationInfo* info); | 49 InstructionSequence* code, CompilationInfo* info); |
36 | 50 |
37 // Generate native code. | 51 // Generate native code. |
38 Handle<Code> GenerateCode(); | 52 Handle<Code> GenerateCode(); |
39 | 53 |
40 InstructionSequence* code() const { return code_; } | 54 InstructionSequence* code() const { return code_; } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 143 |
130 void RecordCallPosition(Instruction* instr); | 144 void RecordCallPosition(Instruction* instr); |
131 void PopulateDeoptimizationData(Handle<Code> code); | 145 void PopulateDeoptimizationData(Handle<Code> code); |
132 int DefineDeoptimizationLiteral(Handle<Object> literal); | 146 int DefineDeoptimizationLiteral(Handle<Object> literal); |
133 FrameStateDescriptor* GetFrameStateDescriptor( | 147 FrameStateDescriptor* GetFrameStateDescriptor( |
134 Instruction* instr, size_t frame_access_state_offset); | 148 Instruction* instr, size_t frame_access_state_offset); |
135 int BuildTranslation(Instruction* instr, int pc_offset, | 149 int BuildTranslation(Instruction* instr, int pc_offset, |
136 size_t frame_access_state_offset, | 150 size_t frame_access_state_offset, |
137 OutputFrameStateCombine state_combine); | 151 OutputFrameStateCombine state_combine); |
138 void BuildTranslationForFrameStateDescriptor( | 152 void BuildTranslationForFrameStateDescriptor( |
139 FrameStateDescriptor* descriptor, Instruction* instr, | 153 FrameStateDescriptor* descriptor, InstructionOperandIterator* iter, |
140 Translation* translation, size_t frame_access_state_offset, | 154 Translation* translation, OutputFrameStateCombine state_combine); |
141 OutputFrameStateCombine state_combine); | 155 void TranslateStateValueDescriptor(StateValueDescriptor* desc, |
| 156 Translation* translation, |
| 157 InstructionOperandIterator* iter); |
| 158 void TranslateFrameStateDescriptorOperands(FrameStateDescriptor* desc, |
| 159 InstructionOperandIterator* iter, |
| 160 OutputFrameStateCombine combine, |
| 161 Translation* translation); |
142 void AddTranslationForOperand(Translation* translation, Instruction* instr, | 162 void AddTranslationForOperand(Translation* translation, Instruction* instr, |
143 InstructionOperand* op, MachineType type); | 163 InstructionOperand* op, MachineType type); |
144 void AddNopForSmiCodeInlining(); | 164 void AddNopForSmiCodeInlining(); |
145 void EnsureSpaceForLazyDeopt(); | 165 void EnsureSpaceForLazyDeopt(); |
146 void MarkLazyDeoptSite(); | 166 void MarkLazyDeoptSite(); |
147 | 167 |
148 // Converts the delta in the number of stack parameter passed from a tail | 168 // Converts the delta in the number of stack parameter passed from a tail |
149 // caller to the callee into the distance (in pointers) the SP must be | 169 // caller to the callee into the distance (in pointers) the SP must be |
150 // adjusted, taking frame elision and other relevant factors into | 170 // adjusted, taking frame elision and other relevant factors into |
151 // consideration. | 171 // consideration. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 JumpTable* jump_tables_; | 218 JumpTable* jump_tables_; |
199 OutOfLineCode* ools_; | 219 OutOfLineCode* ools_; |
200 int osr_pc_offset_; | 220 int osr_pc_offset_; |
201 }; | 221 }; |
202 | 222 |
203 } // namespace compiler | 223 } // namespace compiler |
204 } // namespace internal | 224 } // namespace internal |
205 } // namespace v8 | 225 } // namespace v8 |
206 | 226 |
207 #endif // V8_COMPILER_CODE_GENERATOR_H | 227 #endif // V8_COMPILER_CODE_GENERATOR_H |
OLD | NEW |