• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_DEOPTIMIZER_DEOPTIMIZE_REASON_H_
6 #define V8_DEOPTIMIZER_DEOPTIMIZE_REASON_H_
7 
8 #include "src/common/globals.h"
9 
10 namespace v8 {
11 namespace internal {
12 
13 #define DEOPTIMIZE_REASON_LIST(V)                                              \
14   V(ArrayBufferWasDetached, "array buffer was detached")                       \
15   V(BigIntTooBig, "BigInt too big")                                            \
16   V(CowArrayElementsChanged, "copy-on-write array's elements changed")         \
17   V(CouldNotGrowElements, "failed to grow elements store")                     \
18   V(DeoptimizeNow, "%_DeoptimizeNow")                                          \
19   V(DivisionByZero, "division by zero")                                        \
20   V(Hole, "hole")                                                              \
21   V(InstanceMigrationFailed, "instance migration failed")                      \
22   V(InsufficientTypeFeedbackForCall, "Insufficient type feedback for call")    \
23   V(InsufficientTypeFeedbackForConstruct,                                      \
24     "Insufficient type feedback for construct")                                \
25   V(InsufficientTypeFeedbackForForIn, "Insufficient type feedback for for-in") \
26   V(InsufficientTypeFeedbackForBinaryOperation,                                \
27     "Insufficient type feedback for binary operation")                         \
28   V(InsufficientTypeFeedbackForCompareOperation,                               \
29     "Insufficient type feedback for compare operation")                        \
30   V(InsufficientTypeFeedbackForGenericNamedAccess,                             \
31     "Insufficient type feedback for generic named access")                     \
32   V(InsufficientTypeFeedbackForGenericKeyedAccess,                             \
33     "Insufficient type feedback for generic keyed access")                     \
34   V(InsufficientTypeFeedbackForUnaryOperation,                                 \
35     "Insufficient type feedback for unary operation")                          \
36   V(LostPrecision, "lost precision")                                           \
37   V(LostPrecisionOrNaN, "lost precision or NaN")                               \
38   V(MinusZero, "minus zero")                                                   \
39   V(NaN, "NaN")                                                                \
40   V(NoCache, "no cache")                                                       \
41   V(NotABigInt, "not a BigInt")                                                \
42   V(NotAHeapNumber, "not a heap number")                                       \
43   V(NotAJavaScriptObject, "not a JavaScript object")                           \
44   V(NotAJavaScriptObjectOrNullOrUndefined,                                     \
45     "not a JavaScript object, Null or Undefined")                              \
46   V(NotANumberOrBoolean, "not a Number or Boolean")                            \
47   V(NotANumberOrOddball, "not a Number or Oddball")                            \
48   V(NotAnArrayIndex, "not an array index")                                     \
49   V(NotASmi, "not a Smi")                                                      \
50   V(NotAString, "not a String")                                                \
51   V(NotASymbol, "not a Symbol")                                                \
52   V(NotInt32, "not int32")                                                     \
53   V(OutOfBounds, "out of bounds")                                              \
54   V(Overflow, "overflow")                                                      \
55   V(Smi, "Smi")                                                                \
56   V(TransitionedToMonomorphicIC, "IC transitioned to monomorphic")             \
57   V(TransitionedToMegamorphicIC, "IC transitioned to megamorphic")             \
58   V(Unknown, "(unknown)")                                                      \
59   V(ValueMismatch, "value mismatch")                                           \
60   V(WrongCallTarget, "wrong call target")                                      \
61   V(WrongEnumIndices, "wrong enum indices")                                    \
62   V(WrongFeedbackCell, "wrong feedback cell")                                  \
63   V(WrongInstanceType, "wrong instance type")                                  \
64   V(WrongMap, "wrong map")                                                     \
65   V(MissingMap, "missing map")                                                 \
66   V(DeprecatedMap, "deprecated map")                                           \
67   V(WrongHandler, "wrong handler")                                             \
68   V(WrongName, "wrong name")                                                   \
69   V(WrongValue, "wrong value")                                                 \
70   V(NoInitialElement, "no initial element")
71 
72 enum class DeoptimizeReason : uint8_t {
73 #define DEOPTIMIZE_REASON(Name, message) k##Name,
74   DEOPTIMIZE_REASON_LIST(DEOPTIMIZE_REASON)
75 #undef DEOPTIMIZE_REASON
76 };
77 
78 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, DeoptimizeReason);
79 
80 size_t hash_value(DeoptimizeReason reason);
81 
82 V8_EXPORT_PRIVATE char const* DeoptimizeReasonToString(DeoptimizeReason reason);
83 
84 }  // namespace internal
85 }  // namespace v8
86 
87 #endif  // V8_DEOPTIMIZER_DEOPTIMIZE_REASON_H_
88