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

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

Powered by Google App Engine
This is Rietveld 408576698