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/compiler/unwinding-info-writer.h" | 10 #include "src/compiler/unwinding-info-writer.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // Emits a jump table. | 195 // Emits a jump table. |
196 void AssembleJumpTable(Label** targets, size_t target_count); | 196 void AssembleJumpTable(Label** targets, size_t target_count); |
197 | 197 |
198 // =========================================================================== | 198 // =========================================================================== |
199 // ================== Deoptimization table construction. ===================== | 199 // ================== Deoptimization table construction. ===================== |
200 // =========================================================================== | 200 // =========================================================================== |
201 | 201 |
202 void RecordCallPosition(Instruction* instr); | 202 void RecordCallPosition(Instruction* instr); |
203 void PopulateDeoptimizationData(Handle<Code> code); | 203 void PopulateDeoptimizationData(Handle<Code> code); |
204 int DefineDeoptimizationLiteral(Handle<Object> literal); | 204 int DefineDeoptimizationLiteral(Handle<Object> literal); |
205 FrameStateDescriptor* GetFrameStateDescriptor(Instruction* instr, | 205 DeoptimizationEntry const& GetDeoptimizationEntry(Instruction* instr, |
206 size_t frame_state_offset); | 206 size_t frame_state_offset); |
| 207 DeoptimizeReason GetDeoptimizationReason(int deoptimization_id) const; |
207 int BuildTranslation(Instruction* instr, int pc_offset, | 208 int BuildTranslation(Instruction* instr, int pc_offset, |
208 size_t frame_state_offset, | 209 size_t frame_state_offset, |
209 OutputFrameStateCombine state_combine); | 210 OutputFrameStateCombine state_combine); |
210 void BuildTranslationForFrameStateDescriptor( | 211 void BuildTranslationForFrameStateDescriptor( |
211 FrameStateDescriptor* descriptor, InstructionOperandIterator* iter, | 212 FrameStateDescriptor* descriptor, InstructionOperandIterator* iter, |
212 Translation* translation, OutputFrameStateCombine state_combine); | 213 Translation* translation, OutputFrameStateCombine state_combine); |
213 void TranslateStateValueDescriptor(StateValueDescriptor* desc, | 214 void TranslateStateValueDescriptor(StateValueDescriptor* desc, |
214 Translation* translation, | 215 Translation* translation, |
215 InstructionOperandIterator* iter); | 216 InstructionOperandIterator* iter); |
216 void TranslateFrameStateDescriptorOperands(FrameStateDescriptor* desc, | 217 void TranslateFrameStateDescriptorOperands(FrameStateDescriptor* desc, |
217 InstructionOperandIterator* iter, | 218 InstructionOperandIterator* iter, |
218 OutputFrameStateCombine combine, | 219 OutputFrameStateCombine combine, |
219 Translation* translation); | 220 Translation* translation); |
220 void AddTranslationForOperand(Translation* translation, Instruction* instr, | 221 void AddTranslationForOperand(Translation* translation, Instruction* instr, |
221 InstructionOperand* op, MachineType type); | 222 InstructionOperand* op, MachineType type); |
222 void EnsureSpaceForLazyDeopt(); | 223 void EnsureSpaceForLazyDeopt(); |
223 void MarkLazyDeoptSite(); | 224 void MarkLazyDeoptSite(); |
224 | 225 |
225 DeoptimizationExit* AddDeoptimizationExit(Instruction* instr, | 226 DeoptimizationExit* AddDeoptimizationExit(Instruction* instr, |
226 size_t frame_state_offset); | 227 size_t frame_state_offset); |
227 | 228 |
228 // =========================================================================== | 229 // =========================================================================== |
229 | 230 |
230 struct DeoptimizationState : ZoneObject { | 231 class DeoptimizationState final : public ZoneObject { |
231 public: | 232 public: |
| 233 DeoptimizationState(BailoutId bailout_id, int translation_id, int pc_offset, |
| 234 DeoptimizeReason reason) |
| 235 : bailout_id_(bailout_id), |
| 236 translation_id_(translation_id), |
| 237 pc_offset_(pc_offset), |
| 238 reason_(reason) {} |
| 239 |
232 BailoutId bailout_id() const { return bailout_id_; } | 240 BailoutId bailout_id() const { return bailout_id_; } |
233 int translation_id() const { return translation_id_; } | 241 int translation_id() const { return translation_id_; } |
234 int pc_offset() const { return pc_offset_; } | 242 int pc_offset() const { return pc_offset_; } |
235 | 243 DeoptimizeReason reason() const { return reason_; } |
236 DeoptimizationState(BailoutId bailout_id, int translation_id, int pc_offset) | |
237 : bailout_id_(bailout_id), | |
238 translation_id_(translation_id), | |
239 pc_offset_(pc_offset) {} | |
240 | 244 |
241 private: | 245 private: |
242 BailoutId bailout_id_; | 246 BailoutId bailout_id_; |
243 int translation_id_; | 247 int translation_id_; |
244 int pc_offset_; | 248 int pc_offset_; |
| 249 DeoptimizeReason reason_; |
245 }; | 250 }; |
246 | 251 |
247 struct HandlerInfo { | 252 struct HandlerInfo { |
248 bool caught_locally; | 253 bool caught_locally; |
249 Label* handler; | 254 Label* handler; |
250 int pc_offset; | 255 int pc_offset; |
251 }; | 256 }; |
252 | 257 |
253 friend class OutOfLineCode; | 258 friend class OutOfLineCode; |
254 | 259 |
(...skipping 20 matching lines...) Expand all Loading... |
275 OutOfLineCode* ools_; | 280 OutOfLineCode* ools_; |
276 int osr_pc_offset_; | 281 int osr_pc_offset_; |
277 SourcePositionTableBuilder source_position_table_builder_; | 282 SourcePositionTableBuilder source_position_table_builder_; |
278 }; | 283 }; |
279 | 284 |
280 } // namespace compiler | 285 } // namespace compiler |
281 } // namespace internal | 286 } // namespace internal |
282 } // namespace v8 | 287 } // namespace v8 |
283 | 288 |
284 #endif // V8_COMPILER_CODE_GENERATOR_H | 289 #endif // V8_COMPILER_CODE_GENERATOR_H |
OLD | NEW |