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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // This last bailout type is not really a bailout, but used by the | 97 // This last bailout type is not really a bailout, but used by the |
98 // debugger to deoptimize stack frames to allow inspection. | 98 // debugger to deoptimize stack frames to allow inspection. |
99 DEBUGGER | 99 DEBUGGER |
100 }; | 100 }; |
101 | 101 |
102 static const int kBailoutTypesWithCodeEntry = SOFT + 1; | 102 static const int kBailoutTypesWithCodeEntry = SOFT + 1; |
103 | 103 |
104 struct Reason { | 104 struct Reason { |
105 Reason(int r, const char* m, const char* d) | 105 Reason(int r, const char* m, const char* d) |
106 : raw_position(r), mnemonic(m), detail(d) {} | 106 : raw_position(r), mnemonic(m), detail(d) {} |
| 107 |
| 108 bool operator==(const Reason& other) const { |
| 109 return raw_position == other.raw_position && |
| 110 CStringEquals(mnemonic, other.mnemonic) && |
| 111 CStringEquals(detail, other.detail); |
| 112 } |
| 113 |
| 114 bool operator!=(const Reason& other) const { return !(*this == other); } |
| 115 |
107 int raw_position; | 116 int raw_position; |
108 const char* mnemonic; | 117 const char* mnemonic; |
109 const char* detail; | 118 const char* detail; |
110 }; | 119 }; |
111 | 120 |
112 struct JumpTableEntry : public ZoneObject { | 121 struct JumpTableEntry : public ZoneObject { |
113 inline JumpTableEntry(Address entry, const Reason& the_reason, | 122 inline JumpTableEntry(Address entry, const Reason& the_reason, |
114 Deoptimizer::BailoutType type, bool frame) | 123 Deoptimizer::BailoutType type, bool frame) |
115 : label(), | 124 : label(), |
116 address(entry), | 125 address(entry), |
117 reason(the_reason), | 126 reason(the_reason), |
118 bailout_type(type), | 127 bailout_type(type), |
119 needs_frame(frame) {} | 128 needs_frame(frame) {} |
| 129 |
| 130 bool IsEquivalentTo(const JumpTableEntry& other) const { |
| 131 return address == other.address && bailout_type == other.bailout_type && |
| 132 needs_frame == other.needs_frame && |
| 133 (!FLAG_trace_deopt || reason == other.reason); |
| 134 } |
| 135 |
120 Label label; | 136 Label label; |
121 Address address; | 137 Address address; |
122 Reason reason; | 138 Reason reason; |
123 Deoptimizer::BailoutType bailout_type; | 139 Deoptimizer::BailoutType bailout_type; |
124 bool needs_frame; | 140 bool needs_frame; |
125 }; | 141 }; |
126 | 142 |
127 static bool TraceEnabledFor(BailoutType deopt_type, | 143 static bool TraceEnabledFor(BailoutType deopt_type, |
128 StackFrame::Type frame_type); | 144 StackFrame::Type frame_type); |
129 static const char* MessageFor(BailoutType type); | 145 static const char* MessageFor(BailoutType type); |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 Object** parameters_; | 981 Object** parameters_; |
966 Object** expression_stack_; | 982 Object** expression_stack_; |
967 int source_position_; | 983 int source_position_; |
968 | 984 |
969 friend class Deoptimizer; | 985 friend class Deoptimizer; |
970 }; | 986 }; |
971 | 987 |
972 } } // namespace v8::internal | 988 } } // namespace v8::internal |
973 | 989 |
974 #endif // V8_DEOPTIMIZER_H_ | 990 #endif // V8_DEOPTIMIZER_H_ |
OLD | NEW |