OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_DEOPTIMIZER_H_ | 5 #ifndef V8_DEOPTIMIZER_H_ |
6 #define V8_DEOPTIMIZER_H_ | 6 #define V8_DEOPTIMIZER_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 }; | 177 }; |
178 | 178 |
179 #define DEOPT_MESSAGES_CONSTANTS(C, T) C, | 179 #define DEOPT_MESSAGES_CONSTANTS(C, T) C, |
180 enum DeoptReason { | 180 enum DeoptReason { |
181 DEOPT_MESSAGES_LIST(DEOPT_MESSAGES_CONSTANTS) kLastDeoptReason | 181 DEOPT_MESSAGES_LIST(DEOPT_MESSAGES_CONSTANTS) kLastDeoptReason |
182 }; | 182 }; |
183 #undef DEOPT_MESSAGES_CONSTANTS | 183 #undef DEOPT_MESSAGES_CONSTANTS |
184 | 184 |
185 static const char* GetDeoptReason(DeoptReason deopt_reason); | 185 static const char* GetDeoptReason(DeoptReason deopt_reason); |
186 | 186 |
187 struct Reason { | 187 struct DeoptInfo { |
188 Reason(int r, const char* m, DeoptReason d) | 188 DeoptInfo(int r, const char* m, DeoptReason d) |
189 : raw_position(r), mnemonic(m), deopt_reason(d) {} | 189 : raw_position(r), mnemonic(m), deopt_reason(d) {} |
190 | 190 |
191 bool operator==(const Reason& other) const { | 191 bool operator==(const DeoptInfo& other) const { |
192 return raw_position == other.raw_position && | 192 return raw_position == other.raw_position && |
193 CStringEquals(mnemonic, other.mnemonic) && | 193 CStringEquals(mnemonic, other.mnemonic) && |
194 deopt_reason == other.deopt_reason; | 194 deopt_reason == other.deopt_reason; |
195 } | 195 } |
196 | 196 |
197 bool operator!=(const Reason& other) const { return !(*this == other); } | 197 bool operator!=(const DeoptInfo& other) const { return !(*this == other); } |
198 | 198 |
199 int raw_position; | 199 int raw_position; |
200 const char* mnemonic; | 200 const char* mnemonic; |
201 DeoptReason deopt_reason; | 201 DeoptReason deopt_reason; |
202 }; | 202 }; |
203 | 203 |
| 204 static DeoptInfo GetDeoptInfo(Code* code, int bailout_id); |
| 205 |
204 struct JumpTableEntry : public ZoneObject { | 206 struct JumpTableEntry : public ZoneObject { |
205 inline JumpTableEntry(Address entry, const Reason& the_reason, | 207 inline JumpTableEntry(Address entry, const DeoptInfo& deopt_info, |
206 Deoptimizer::BailoutType type, bool frame) | 208 Deoptimizer::BailoutType type, bool frame) |
207 : label(), | 209 : label(), |
208 address(entry), | 210 address(entry), |
209 reason(the_reason), | 211 deopt_info(deopt_info), |
210 bailout_type(type), | 212 bailout_type(type), |
211 needs_frame(frame) {} | 213 needs_frame(frame) {} |
212 | 214 |
213 bool IsEquivalentTo(const JumpTableEntry& other) const { | 215 bool IsEquivalentTo(const JumpTableEntry& other) const { |
214 return address == other.address && bailout_type == other.bailout_type && | 216 return address == other.address && bailout_type == other.bailout_type && |
215 needs_frame == other.needs_frame && | 217 needs_frame == other.needs_frame && |
216 (!FLAG_trace_deopt || reason == other.reason); | 218 (!FLAG_trace_deopt || deopt_info == other.deopt_info); |
217 } | 219 } |
218 | 220 |
219 Label label; | 221 Label label; |
220 Address address; | 222 Address address; |
221 Reason reason; | 223 DeoptInfo deopt_info; |
222 Deoptimizer::BailoutType bailout_type; | 224 Deoptimizer::BailoutType bailout_type; |
223 bool needs_frame; | 225 bool needs_frame; |
224 }; | 226 }; |
225 | 227 |
226 static bool TraceEnabledFor(BailoutType deopt_type, | 228 static bool TraceEnabledFor(BailoutType deopt_type, |
227 StackFrame::Type frame_type); | 229 StackFrame::Type frame_type); |
228 static const char* MessageFor(BailoutType type); | 230 static const char* MessageFor(BailoutType type); |
229 | 231 |
230 int output_count() const { return output_count_; } | 232 int output_count() const { return output_count_; } |
231 | 233 |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 Object** parameters_; | 1066 Object** parameters_; |
1065 Object** expression_stack_; | 1067 Object** expression_stack_; |
1066 int source_position_; | 1068 int source_position_; |
1067 | 1069 |
1068 friend class Deoptimizer; | 1070 friend class Deoptimizer; |
1069 }; | 1071 }; |
1070 | 1072 |
1071 } } // namespace v8::internal | 1073 } } // namespace v8::internal |
1072 | 1074 |
1073 #endif // V8_DEOPTIMIZER_H_ | 1075 #endif // V8_DEOPTIMIZER_H_ |
OLD | NEW |