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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // debugger to deoptimize stack frames to allow inspection. | 174 // debugger to deoptimize stack frames to allow inspection. |
175 DEBUGGER, | 175 DEBUGGER, |
176 kBailoutTypesWithCodeEntry = SOFT + 1 | 176 kBailoutTypesWithCodeEntry = SOFT + 1 |
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 | |
185 static const char* GetDeoptReason(DeoptReason deopt_reason); | 184 static const char* GetDeoptReason(DeoptReason deopt_reason); |
186 | 185 |
187 struct DeoptInfo { | 186 struct DeoptInfo { |
188 DeoptInfo(int r, const char* m, DeoptReason d) | 187 DeoptInfo(int r, const char* m, DeoptReason d) |
189 : raw_position(r), mnemonic(m), deopt_reason(d) {} | 188 : raw_position(r), mnemonic(m), deopt_reason(d) {} |
190 | 189 |
191 bool operator==(const DeoptInfo& other) const { | |
192 return raw_position == other.raw_position && | |
193 CStringEquals(mnemonic, other.mnemonic) && | |
194 deopt_reason == other.deopt_reason; | |
195 } | |
196 | |
197 bool operator!=(const DeoptInfo& other) const { return !(*this == other); } | |
198 | |
199 int raw_position; | 190 int raw_position; |
200 const char* mnemonic; | 191 const char* mnemonic; |
201 DeoptReason deopt_reason; | 192 DeoptReason deopt_reason; |
202 }; | 193 }; |
203 | 194 |
204 static DeoptInfo GetDeoptInfo(Code* code, int bailout_id); | 195 static DeoptInfo GetDeoptInfo(Code* code, int bailout_id); |
205 | 196 |
206 struct JumpTableEntry : public ZoneObject { | 197 struct JumpTableEntry : public ZoneObject { |
207 inline JumpTableEntry(Address entry, const DeoptInfo& deopt_info, | 198 inline JumpTableEntry(Address entry, const DeoptInfo& deopt_info, |
208 Deoptimizer::BailoutType type, bool frame) | 199 Deoptimizer::BailoutType type, bool frame) |
209 : label(), | 200 : label(), |
210 address(entry), | 201 address(entry), |
211 deopt_info(deopt_info), | 202 deopt_info(deopt_info), |
212 bailout_type(type), | 203 bailout_type(type), |
213 needs_frame(frame) {} | 204 needs_frame(frame) {} |
214 | 205 |
215 bool IsEquivalentTo(const JumpTableEntry& other) const { | 206 bool IsEquivalentTo(const JumpTableEntry& other) const { |
216 return address == other.address && bailout_type == other.bailout_type && | 207 return address == other.address && bailout_type == other.bailout_type && |
217 needs_frame == other.needs_frame && | 208 needs_frame == other.needs_frame; |
218 (!FLAG_trace_deopt || deopt_info == other.deopt_info); | |
219 } | 209 } |
220 | 210 |
221 Label label; | 211 Label label; |
222 Address address; | 212 Address address; |
223 DeoptInfo deopt_info; | 213 DeoptInfo deopt_info; |
224 Deoptimizer::BailoutType bailout_type; | 214 Deoptimizer::BailoutType bailout_type; |
225 bool needs_frame; | 215 bool needs_frame; |
226 }; | 216 }; |
227 | 217 |
228 static bool TraceEnabledFor(BailoutType deopt_type, | 218 static bool TraceEnabledFor(BailoutType deopt_type, |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 Object** parameters_; | 1056 Object** parameters_; |
1067 Object** expression_stack_; | 1057 Object** expression_stack_; |
1068 int source_position_; | 1058 int source_position_; |
1069 | 1059 |
1070 friend class Deoptimizer; | 1060 friend class Deoptimizer; |
1071 }; | 1061 }; |
1072 | 1062 |
1073 } } // namespace v8::internal | 1063 } } // namespace v8::internal |
1074 | 1064 |
1075 #endif // V8_DEOPTIMIZER_H_ | 1065 #endif // V8_DEOPTIMIZER_H_ |
OLD | NEW |