Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: src/deoptimizer.h

Issue 874323003: Externalize deoptimization reasons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: arm64 Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 virtual void EnterContext(Context* context) = 0; 80 virtual void EnterContext(Context* context) = 0;
81 81
82 virtual void VisitFunction(JSFunction* function) = 0; 82 virtual void VisitFunction(JSFunction* function) = 0;
83 83
84 // Function which is called after iteration of all optimized functions 84 // Function which is called after iteration of all optimized functions
85 // from given native context. 85 // from given native context.
86 virtual void LeaveContext(Context* context) = 0; 86 virtual void LeaveContext(Context* context) = 0;
87 }; 87 };
88 88
89 89
90 #define DEOPT_MESSAGES_LIST(V) \
91 V(kNoReason, "no reason") \
92 V(kConstantGlobalVariableAssignment, "Constant global variable assignment") \
93 V(kConversionOverflow, "conversion overflow") \
94 V(kDivisionByZero, "division by zero") \
95 V(kElementsKindUnhandledInKeyedLoadGenericStub, \
96 "ElementsKind unhandled in KeyedLoadGenericStub") \
97 V(kExpectedHeapNumber, "Expected heap number") \
98 V(kExpectedSmi, "Expected smi") \
99 V(kForcedDeoptToRuntime, "Forced deopt to runtime") \
100 V(kHole, "hole") \
101 V(kHoleyArrayDespitePackedElements_kindFeedback, \
102 "Holey array despite packed elements_kind feedback") \
103 V(kInstanceMigrationFailed, "instance migration failed") \
104 V(kInsufficientTypeFeedbackForCallWithArguments, \
105 "Insufficient type feedback for call with arguments") \
106 V(kInsufficientTypeFeedbackForCombinedTypeOfBinaryOperation, \
107 "Insufficient type feedback for combined type of binary operation") \
108 V(kInsufficientTypeFeedbackForGenericNamedAccess, \
109 "Insufficient type feedback for generic named access") \
110 V(kInsufficientTypeFeedbackForKeyedLoad, \
111 "Insufficient type feedback for keyed load") \
112 V(kInsufficientTypeFeedbackForKeyedStore, \
113 "Insufficient type feedback for keyed store") \
114 V(kInsufficientTypeFeedbackForLHSOfBinaryOperation, \
115 "Insufficient type feedback for LHS of binary operation") \
116 V(kInsufficientTypeFeedbackForRHSOfBinaryOperation, \
117 "Insufficient type feedback for RHS of binary operation") \
118 V(kKeyIsNegative, "key is negative") \
119 V(kLostPrecision, "lost precision") \
120 V(kLostPrecisionOrNaN, "lost precision or NaN") \
121 V(kMementoFound, "memento found") \
122 V(kMinusZero, "minus zero") \
123 V(kNaN, "NaN") \
124 V(kNegativeKeyEncountered, "Negative key encountered") \
125 V(kNegativeValue, "negative value") \
126 V(kNoCache, "no cache") \
127 V(kNonStrictElementsInKeyedLoadGenericStub, \
128 "non-strict elements in KeyedLoadGenericStub") \
129 V(kNotADateObject, "not a date object") \
130 V(kNotAHeapNumber, "not a heap number") \
131 V(kNotAHeapNumberUndefinedBoolean, "not a heap number/undefined/true/false") \
132 V(kNotAHeapNumberUndefined, "not a heap number/undefined") \
133 V(kNotAJavaScriptObject, "not a JavaScript object") \
134 V(kNotASmi, "not a Smi") \
135 V(kNotHeapNumber, "not heap number") \
136 V(kNull, "null") \
137 V(kOutOfBounds, "out of bounds") \
138 V(kOutsideOfRange, "Outside of range") \
139 V(kOverflow, "overflow") \
140 V(kReceiverWasAGlobalObject, "receiver was a global object") \
141 V(kSmi, "Smi") \
142 V(kTooManyArguments, "too many arguments") \
143 V(kTooManyUndetectableTypes, "Too many undetectable types") \
144 V(kTracingElementsTransitions, "Tracing elements transitions") \
145 V(kTypeMismatchBetweenFeedbackAndConstant, \
146 "Type mismatch between feedback and constant") \
147 V(kUndefined, "undefined") \
148 V(kUnexpectedCellContentsInConstantGlobalStore, \
149 "Unexpected cell contents in constant global store") \
150 V(kUnexpectedCellContentsInGlobalStore, \
151 "Unexpected cell contents in global store") \
152 V(kUnexpectedObject, "unexpected object") \
153 V(kUnexpectedRHSOfBinaryOperation, "Unexpected RHS of binary operation") \
154 V(kUnexpectedСellСontentsInGlobalStore, \
155 "Unexpected cell contents in global store") \
156 V(kUninitializedBoilerplateInFastClone, \
157 "Uninitialized boilerplate in fast clone") \
158 V(kUninitializedBoilerplateLiterals, "Uninitialized boilerplate literals") \
159 V(kUnknownMapInPolymorphicAccess, "Unknown map in polymorphic access") \
160 V(kUnknownMapInPolymorphicCall, "Unknown map in polymorphic call") \
161 V(kUnknownMapInPolymorphicElementAccess, \
162 "Unknown map in polymorphic element access") \
163 V(kUnknownMap, "Unknown map") \
164 V(kValueMismatch, "value mismatch") \
165 V(kWrongInstanceType, "wrong instance type") \
166 V(kWrongMap, "wrong map")
167
168
90 class Deoptimizer : public Malloced { 169 class Deoptimizer : public Malloced {
91 public: 170 public:
92 enum BailoutType { 171 enum BailoutType {
93 EAGER, 172 EAGER,
94 LAZY, 173 LAZY,
95 SOFT, 174 SOFT,
96 // This last bailout type is not really a bailout, but used by the 175 // This last bailout type is not really a bailout, but used by the
97 // debugger to deoptimize stack frames to allow inspection. 176 // debugger to deoptimize stack frames to allow inspection.
98 DEBUGGER, 177 DEBUGGER,
99 kBailoutTypesWithCodeEntry = SOFT + 1 178 kBailoutTypesWithCodeEntry = SOFT + 1
100 }; 179 };
101 180
181 #define DEOPT_MESSAGES_CONSTANTS(C, T) C,
182 enum DeoptReason {
183 DEOPT_MESSAGES_LIST(DEOPT_MESSAGES_CONSTANTS) kLastDeoptReason
184 };
185 #undef DEOPT_MESSAGES_CONSTANTS
186
187 static const char* GetDeoptReason(DeoptReason deopt_reason);
188
102 struct Reason { 189 struct Reason {
103 Reason(int r, const char* m, const char* d) 190 Reason(int r, const char* m, DeoptReason d)
104 : raw_position(r), mnemonic(m), detail(d) {} 191 : raw_position(r), mnemonic(m), deopt_reason(d) {}
105 192
106 bool operator==(const Reason& other) const { 193 bool operator==(const Reason& other) const {
107 return raw_position == other.raw_position && 194 return raw_position == other.raw_position &&
108 CStringEquals(mnemonic, other.mnemonic) && 195 CStringEquals(mnemonic, other.mnemonic) &&
109 CStringEquals(detail, other.detail); 196 deopt_reason == other.deopt_reason;
110 } 197 }
111 198
112 bool operator!=(const Reason& other) const { return !(*this == other); } 199 bool operator!=(const Reason& other) const { return !(*this == other); }
113 200
114 int raw_position; 201 int raw_position;
115 const char* mnemonic; 202 const char* mnemonic;
116 const char* detail; 203 DeoptReason deopt_reason;
117 }; 204 };
118 205
119 struct JumpTableEntry : public ZoneObject { 206 struct JumpTableEntry : public ZoneObject {
120 inline JumpTableEntry(Address entry, const Reason& the_reason, 207 inline JumpTableEntry(Address entry, const Reason& the_reason,
121 Deoptimizer::BailoutType type, bool frame) 208 Deoptimizer::BailoutType type, bool frame)
122 : label(), 209 : label(),
123 address(entry), 210 address(entry),
124 reason(the_reason), 211 reason(the_reason),
125 bailout_type(type), 212 bailout_type(type),
126 needs_frame(frame) {} 213 needs_frame(frame) {}
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 Object** parameters_; 1066 Object** parameters_;
980 Object** expression_stack_; 1067 Object** expression_stack_;
981 int source_position_; 1068 int source_position_;
982 1069
983 friend class Deoptimizer; 1070 friend class Deoptimizer;
984 }; 1071 };
985 1072
986 } } // namespace v8::internal 1073 } } // namespace v8::internal
987 1074
988 #endif // V8_DEOPTIMIZER_H_ 1075 #endif // V8_DEOPTIMIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698