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

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: minor change 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
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/deoptimizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(kUninitializedBoilerplateInFastClone, \
155 "Uninitialized boilerplate in fast clone") \
156 V(kUninitializedBoilerplateLiterals, "Uninitialized boilerplate literals") \
157 V(kUnknownMapInPolymorphicAccess, "Unknown map in polymorphic access") \
158 V(kUnknownMapInPolymorphicCall, "Unknown map in polymorphic call") \
159 V(kUnknownMapInPolymorphicElementAccess, \
160 "Unknown map in polymorphic element access") \
161 V(kUnknownMap, "Unknown map") \
162 V(kValueMismatch, "value mismatch") \
163 V(kWrongInstanceType, "wrong instance type") \
164 V(kWrongMap, "wrong map")
165
166
90 class Deoptimizer : public Malloced { 167 class Deoptimizer : public Malloced {
91 public: 168 public:
92 enum BailoutType { 169 enum BailoutType {
93 EAGER, 170 EAGER,
94 LAZY, 171 LAZY,
95 SOFT, 172 SOFT,
96 // This last bailout type is not really a bailout, but used by the 173 // This last bailout type is not really a bailout, but used by the
97 // debugger to deoptimize stack frames to allow inspection. 174 // debugger to deoptimize stack frames to allow inspection.
98 DEBUGGER, 175 DEBUGGER,
99 kBailoutTypesWithCodeEntry = SOFT + 1 176 kBailoutTypesWithCodeEntry = SOFT + 1
100 }; 177 };
101 178
179 #define DEOPT_MESSAGES_CONSTANTS(C, T) C,
180 enum DeoptReason {
181 DEOPT_MESSAGES_LIST(DEOPT_MESSAGES_CONSTANTS) kLastDeoptReason
182 };
183 #undef DEOPT_MESSAGES_CONSTANTS
184
185 static const char* GetDeoptReason(DeoptReason deopt_reason);
186
102 struct Reason { 187 struct Reason {
103 Reason(int r, const char* m, const char* d) 188 Reason(int r, const char* m, DeoptReason d)
104 : raw_position(r), mnemonic(m), detail(d) {} 189 : raw_position(r), mnemonic(m), deopt_reason(d) {}
105 190
106 bool operator==(const Reason& other) const { 191 bool operator==(const Reason& other) const {
107 return raw_position == other.raw_position && 192 return raw_position == other.raw_position &&
108 CStringEquals(mnemonic, other.mnemonic) && 193 CStringEquals(mnemonic, other.mnemonic) &&
109 CStringEquals(detail, other.detail); 194 deopt_reason == other.deopt_reason;
110 } 195 }
111 196
112 bool operator!=(const Reason& other) const { return !(*this == other); } 197 bool operator!=(const Reason& other) const { return !(*this == other); }
113 198
114 int raw_position; 199 int raw_position;
115 const char* mnemonic; 200 const char* mnemonic;
116 const char* detail; 201 DeoptReason deopt_reason;
117 }; 202 };
118 203
119 struct JumpTableEntry : public ZoneObject { 204 struct JumpTableEntry : public ZoneObject {
120 inline JumpTableEntry(Address entry, const Reason& the_reason, 205 inline JumpTableEntry(Address entry, const Reason& the_reason,
121 Deoptimizer::BailoutType type, bool frame) 206 Deoptimizer::BailoutType type, bool frame)
122 : label(), 207 : label(),
123 address(entry), 208 address(entry),
124 reason(the_reason), 209 reason(the_reason),
125 bailout_type(type), 210 bailout_type(type),
126 needs_frame(frame) {} 211 needs_frame(frame) {}
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 Object** parameters_; 1064 Object** parameters_;
980 Object** expression_stack_; 1065 Object** expression_stack_;
981 int source_position_; 1066 int source_position_;
982 1067
983 friend class Deoptimizer; 1068 friend class Deoptimizer;
984 }; 1069 };
985 1070
986 } } // namespace v8::internal 1071 } } // namespace v8::internal
987 1072
988 #endif // V8_DEOPTIMIZER_H_ 1073 #endif // V8_DEOPTIMIZER_H_
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698