Home | History | Annotate | Download | only in src
      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_DEOPTIMIZE_REASON_H_
      6 #define V8_DEOPTIMIZE_REASON_H_
      7 
      8 #include "src/globals.h"
      9 
     10 namespace v8 {
     11 namespace internal {
     12 
     13 #define DEOPTIMIZE_REASON_LIST(V)                                            \
     14   V(AccessCheck, "Access check needed")                                      \
     15   V(NoReason, "no reason")                                                   \
     16   V(ConstantGlobalVariableAssignment, "Constant global variable assignment") \
     17   V(ConversionOverflow, "conversion overflow")                               \
     18   V(DivisionByZero, "division by zero")                                      \
     19   V(ExpectedHeapNumber, "Expected heap number")                              \
     20   V(ExpectedSmi, "Expected smi")                                             \
     21   V(ForcedDeoptToRuntime, "Forced deopt to runtime")                         \
     22   V(Hole, "hole")                                                            \
     23   V(InstanceMigrationFailed, "instance migration failed")                    \
     24   V(InsufficientTypeFeedbackForCall, "Insufficient type feedback for call")  \
     25   V(InsufficientTypeFeedbackForCallWithArguments,                            \
     26     "Insufficient type feedback for call with arguments")                    \
     27   V(FastPathFailed, "Falling off the fast path")                             \
     28   V(InsufficientTypeFeedbackForCombinedTypeOfBinaryOperation,                \
     29     "Insufficient type feedback for combined type of binary 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(InsufficientTypeFeedbackForLHSOfBinaryOperation,                         \
     35     "Insufficient type feedback for LHS of binary operation")                \
     36   V(InsufficientTypeFeedbackForRHSOfBinaryOperation,                         \
     37     "Insufficient type feedback for RHS of binary operation")                \
     38   V(KeyIsNegative, "key is negative")                                        \
     39   V(LostPrecision, "lost precision")                                         \
     40   V(LostPrecisionOrNaN, "lost precision or NaN")                             \
     41   V(MementoFound, "memento found")                                           \
     42   V(MinusZero, "minus zero")                                                 \
     43   V(NaN, "NaN")                                                              \
     44   V(NegativeKeyEncountered, "Negative key encountered")                      \
     45   V(NegativeValue, "negative value")                                         \
     46   V(NoCache, "no cache")                                                     \
     47   V(NotAHeapNumber, "not a heap number")                                     \
     48   V(NotAHeapNumberUndefined, "not a heap number/undefined")                  \
     49   V(NotAJavaScriptObject, "not a JavaScript object")                         \
     50   V(NotANumberOrOddball, "not a Number or Oddball")                          \
     51   V(NotASmi, "not a Smi")                                                    \
     52   V(OutOfBounds, "out of bounds")                                            \
     53   V(OutsideOfRange, "Outside of range")                                      \
     54   V(Overflow, "overflow")                                                    \
     55   V(Proxy, "proxy")                                                          \
     56   V(ReceiverWasAGlobalObject, "receiver was a global object")                \
     57   V(Smi, "Smi")                                                              \
     58   V(TooManyArguments, "too many arguments")                                  \
     59   V(TracingElementsTransitions, "Tracing elements transitions")              \
     60   V(TypeMismatchBetweenFeedbackAndConstant,                                  \
     61     "Type mismatch between feedback and constant")                           \
     62   V(UnexpectedCellContentsInConstantGlobalStore,                             \
     63     "Unexpected cell contents in constant global store")                     \
     64   V(UnexpectedCellContentsInGlobalStore,                                     \
     65     "Unexpected cell contents in global store")                              \
     66   V(UnexpectedObject, "unexpected object")                                   \
     67   V(UnexpectedRHSOfBinaryOperation, "Unexpected RHS of binary operation")    \
     68   V(UnknownMapInPolymorphicAccess, "Unknown map in polymorphic access")      \
     69   V(UnknownMapInPolymorphicCall, "Unknown map in polymorphic call")          \
     70   V(UnknownMapInPolymorphicElementAccess,                                    \
     71     "Unknown map in polymorphic element access")                             \
     72   V(UnknownMap, "Unknown map")                                               \
     73   V(ValueMismatch, "value mismatch")                                         \
     74   V(WrongInstanceType, "wrong instance type")                                \
     75   V(WrongMap, "wrong map")                                                   \
     76   V(UndefinedOrNullInForIn, "null or undefined in for-in")                   \
     77   V(UndefinedOrNullInToObject, "null or undefined in ToObject")
     78 
     79 enum class DeoptimizeReason : uint8_t {
     80 #define DEOPTIMIZE_REASON(Name, message) k##Name,
     81   DEOPTIMIZE_REASON_LIST(DEOPTIMIZE_REASON)
     82 #undef DEOPTIMIZE_REASON
     83 };
     84 
     85 std::ostream& operator<<(std::ostream&, DeoptimizeReason);
     86 
     87 size_t hash_value(DeoptimizeReason reason);
     88 
     89 char const* DeoptimizeReasonToString(DeoptimizeReason reason);
     90 
     91 }  // namespace internal
     92 }  // namespace v8
     93 
     94 #endif  // V8_DEOPTIMIZE_REASON_H_
     95