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" |
11 #include "src/macro-assembler.h" | 11 #include "src/macro-assembler.h" |
12 #include "src/safepoint-table.h" | 12 #include "src/safepoint-table.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 namespace compiler { | 16 namespace compiler { |
17 | 17 |
18 // Forward declarations. | 18 // Forward declarations. |
| 19 class DeoptimizationExit; |
19 class FrameAccessState; | 20 class FrameAccessState; |
20 class Linkage; | 21 class Linkage; |
21 class OutOfLineCode; | 22 class OutOfLineCode; |
22 | 23 |
23 struct BranchInfo { | 24 struct BranchInfo { |
24 FlagsCondition condition; | 25 FlagsCondition condition; |
25 Label* true_label; | 26 Label* true_label; |
26 Label* false_label; | 27 Label* false_label; |
27 bool fallthru; | 28 bool fallthru; |
28 }; | 29 }; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // Emits a jump table. | 138 // Emits a jump table. |
138 void AssembleJumpTable(Label** targets, size_t target_count); | 139 void AssembleJumpTable(Label** targets, size_t target_count); |
139 | 140 |
140 // =========================================================================== | 141 // =========================================================================== |
141 // ================== Deoptimization table construction. ===================== | 142 // ================== Deoptimization table construction. ===================== |
142 // =========================================================================== | 143 // =========================================================================== |
143 | 144 |
144 void RecordCallPosition(Instruction* instr); | 145 void RecordCallPosition(Instruction* instr); |
145 void PopulateDeoptimizationData(Handle<Code> code); | 146 void PopulateDeoptimizationData(Handle<Code> code); |
146 int DefineDeoptimizationLiteral(Handle<Object> literal); | 147 int DefineDeoptimizationLiteral(Handle<Object> literal); |
147 FrameStateDescriptor* GetFrameStateDescriptor( | 148 FrameStateDescriptor* GetFrameStateDescriptor(Instruction* instr, |
148 Instruction* instr, size_t frame_access_state_offset); | 149 size_t frame_state_offset); |
149 int BuildTranslation(Instruction* instr, int pc_offset, | 150 int BuildTranslation(Instruction* instr, int pc_offset, |
150 size_t frame_access_state_offset, | 151 size_t frame_state_offset, |
151 OutputFrameStateCombine state_combine); | 152 OutputFrameStateCombine state_combine); |
152 void BuildTranslationForFrameStateDescriptor( | 153 void BuildTranslationForFrameStateDescriptor( |
153 FrameStateDescriptor* descriptor, InstructionOperandIterator* iter, | 154 FrameStateDescriptor* descriptor, InstructionOperandIterator* iter, |
154 Translation* translation, OutputFrameStateCombine state_combine); | 155 Translation* translation, OutputFrameStateCombine state_combine); |
155 void TranslateStateValueDescriptor(StateValueDescriptor* desc, | 156 void TranslateStateValueDescriptor(StateValueDescriptor* desc, |
156 Translation* translation, | 157 Translation* translation, |
157 InstructionOperandIterator* iter); | 158 InstructionOperandIterator* iter); |
158 void TranslateFrameStateDescriptorOperands(FrameStateDescriptor* desc, | 159 void TranslateFrameStateDescriptorOperands(FrameStateDescriptor* desc, |
159 InstructionOperandIterator* iter, | 160 InstructionOperandIterator* iter, |
160 OutputFrameStateCombine combine, | 161 OutputFrameStateCombine combine, |
161 Translation* translation); | 162 Translation* translation); |
162 void AddTranslationForOperand(Translation* translation, Instruction* instr, | 163 void AddTranslationForOperand(Translation* translation, Instruction* instr, |
163 InstructionOperand* op, MachineType type); | 164 InstructionOperand* op, MachineType type); |
164 void AddNopForSmiCodeInlining(); | 165 void AddNopForSmiCodeInlining(); |
165 void EnsureSpaceForLazyDeopt(); | 166 void EnsureSpaceForLazyDeopt(); |
166 void MarkLazyDeoptSite(); | 167 void MarkLazyDeoptSite(); |
167 | 168 |
| 169 DeoptimizationExit* AddDeoptimizationExit(Instruction* instr, |
| 170 size_t frame_state_offset); |
| 171 |
168 // Converts the delta in the number of stack parameter passed from a tail | 172 // Converts the delta in the number of stack parameter passed from a tail |
169 // caller to the callee into the distance (in pointers) the SP must be | 173 // caller to the callee into the distance (in pointers) the SP must be |
170 // adjusted, taking frame elision and other relevant factors into | 174 // adjusted, taking frame elision and other relevant factors into |
171 // consideration. | 175 // consideration. |
172 int TailCallFrameStackSlotDelta(int stack_param_delta); | 176 int TailCallFrameStackSlotDelta(int stack_param_delta); |
173 | 177 |
174 // =========================================================================== | 178 // =========================================================================== |
175 | 179 |
176 struct DeoptimizationState : ZoneObject { | 180 struct DeoptimizationState : ZoneObject { |
177 public: | 181 public: |
(...skipping 25 matching lines...) Expand all Loading... |
203 InstructionSequence* const code_; | 207 InstructionSequence* const code_; |
204 CompilationInfo* const info_; | 208 CompilationInfo* const info_; |
205 Label* const labels_; | 209 Label* const labels_; |
206 Label return_label_; | 210 Label return_label_; |
207 RpoNumber current_block_; | 211 RpoNumber current_block_; |
208 SourcePosition current_source_position_; | 212 SourcePosition current_source_position_; |
209 MacroAssembler masm_; | 213 MacroAssembler masm_; |
210 GapResolver resolver_; | 214 GapResolver resolver_; |
211 SafepointTableBuilder safepoints_; | 215 SafepointTableBuilder safepoints_; |
212 ZoneVector<HandlerInfo> handlers_; | 216 ZoneVector<HandlerInfo> handlers_; |
| 217 ZoneDeque<DeoptimizationExit*> deoptimization_exits_; |
213 ZoneDeque<DeoptimizationState*> deoptimization_states_; | 218 ZoneDeque<DeoptimizationState*> deoptimization_states_; |
214 ZoneDeque<Handle<Object>> deoptimization_literals_; | 219 ZoneDeque<Handle<Object>> deoptimization_literals_; |
215 size_t inlined_function_count_; | 220 size_t inlined_function_count_; |
216 TranslationBuffer translations_; | 221 TranslationBuffer translations_; |
217 int last_lazy_deopt_pc_; | 222 int last_lazy_deopt_pc_; |
218 JumpTable* jump_tables_; | 223 JumpTable* jump_tables_; |
219 OutOfLineCode* ools_; | 224 OutOfLineCode* ools_; |
220 int osr_pc_offset_; | 225 int osr_pc_offset_; |
221 }; | 226 }; |
222 | 227 |
223 } // namespace compiler | 228 } // namespace compiler |
224 } // namespace internal | 229 } // namespace internal |
225 } // namespace v8 | 230 } // namespace v8 |
226 | 231 |
227 #endif // V8_COMPILER_CODE_GENERATOR_H | 232 #endif // V8_COMPILER_CODE_GENERATOR_H |
OLD | NEW |