deoptimize-reason.h 6.37 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_DEOPTIMIZE_REASON_H_
#define V8_DEOPTIMIZE_REASON_H_

#include "src/globals.h"

namespace v8 {
namespace internal {

13 14 15
#define DEOPTIMIZE_REASON_LIST(V)                                              \
  V(AccessCheck, "Access check needed")                                        \
  V(NoReason, "no reason")                                                     \
16
  V(ArrayBufferWasNeutered, "array buffer was neutered")                       \
17 18
  V(ConstantGlobalVariableAssignment, "Constant global variable assignment")   \
  V(ConversionOverflow, "conversion overflow")                                 \
19
  V(CowArrayElementsChanged, "copy-on-write array's elements changed")         \
20 21 22 23 24 25 26 27 28 29 30 31 32
  V(DivisionByZero, "division by zero")                                        \
  V(ExpectedHeapNumber, "Expected heap number")                                \
  V(ExpectedSmi, "Expected smi")                                               \
  V(ForcedDeoptToRuntime, "Forced deopt to runtime")                           \
  V(Hole, "hole")                                                              \
  V(InstanceMigrationFailed, "instance migration failed")                      \
  V(InsufficientTypeFeedbackForCall, "Insufficient type feedback for call")    \
  V(InsufficientTypeFeedbackForCallWithArguments,                              \
    "Insufficient type feedback for call with arguments")                      \
  V(InsufficientTypeFeedbackForConstruct,                                      \
    "Insufficient type feedback for construct")                                \
  V(FastPathFailed, "Falling off the fast path")                               \
  V(InsufficientTypeFeedbackForForIn, "Insufficient type feedback for for-in") \
33 34 35 36
  V(InsufficientTypeFeedbackForBinaryOperation,                                \
    "Insufficient type feedback for binary operation")                         \
  V(InsufficientTypeFeedbackForCompareOperation,                               \
    "Insufficient type feedback for compare operation")                        \
37 38 39 40
  V(InsufficientTypeFeedbackForGenericNamedAccess,                             \
    "Insufficient type feedback for generic named access")                     \
  V(InsufficientTypeFeedbackForGenericKeyedAccess,                             \
    "Insufficient type feedback for generic keyed access")                     \
41 42
  V(InsufficientTypeFeedbackForUnaryOperation,                                 \
    "Insufficient type feedback for unary operation")                          \
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
  V(KeyIsNegative, "key is negative")                                          \
  V(LostPrecision, "lost precision")                                           \
  V(LostPrecisionOrNaN, "lost precision or NaN")                               \
  V(MementoFound, "memento found")                                             \
  V(MinusZero, "minus zero")                                                   \
  V(NaN, "NaN")                                                                \
  V(NegativeKeyEncountered, "Negative key encountered")                        \
  V(NegativeValue, "negative value")                                           \
  V(NoCache, "no cache")                                                       \
  V(NotAHeapNumber, "not a heap number")                                       \
  V(NotAHeapNumberUndefined, "not a heap number/undefined")                    \
  V(NotAJavaScriptObject, "not a JavaScript object")                           \
  V(NotANumberOrOddball, "not a Number or Oddball")                            \
  V(NotASmi, "not a Smi")                                                      \
  V(NotASymbol, "not a Symbol")                                                \
  V(OutOfBounds, "out of bounds")                                              \
  V(OutsideOfRange, "Outside of range")                                        \
  V(Overflow, "overflow")                                                      \
  V(Proxy, "proxy")                                                            \
62
  V(ReceiverNotAGlobalProxy, "receiver was not a global proxy")                \
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
  V(ReceiverWasAGlobalObject, "receiver was a global object")                  \
  V(Smi, "Smi")                                                                \
  V(TooManyArguments, "too many arguments")                                    \
  V(TracingElementsTransitions, "Tracing elements transitions")                \
  V(TypeMismatchBetweenFeedbackAndConstant,                                    \
    "Type mismatch between feedback and constant")                             \
  V(UnexpectedCellContentsInConstantGlobalStore,                               \
    "Unexpected cell contents in constant global store")                       \
  V(UnexpectedCellContentsInGlobalStore,                                       \
    "Unexpected cell contents in global store")                                \
  V(UnexpectedObject, "unexpected object")                                     \
  V(UnknownMapInPolymorphicAccess, "Unknown map in polymorphic access")        \
  V(UnknownMapInPolymorphicCall, "Unknown map in polymorphic call")            \
  V(UnknownMapInPolymorphicElementAccess,                                      \
    "Unknown map in polymorphic element access")                               \
  V(UnknownMap, "Unknown map")                                                 \
  V(ValueMismatch, "value mismatch")                                           \
  V(WrongInstanceType, "wrong instance type")                                  \
  V(WrongMap, "wrong map")                                                     \
82
  V(WrongName, "wrong name")                                                   \
83
  V(UndefinedOrNullInForIn, "null or undefined in for-in")                     \
84 85 86 87 88 89 90 91 92 93 94 95
  V(UndefinedOrNullInToObject, "null or undefined in ToObject")

enum class DeoptimizeReason : uint8_t {
#define DEOPTIMIZE_REASON(Name, message) k##Name,
  DEOPTIMIZE_REASON_LIST(DEOPTIMIZE_REASON)
#undef DEOPTIMIZE_REASON
};

std::ostream& operator<<(std::ostream&, DeoptimizeReason);

size_t hash_value(DeoptimizeReason reason);

96
char const* DeoptimizeReasonToString(DeoptimizeReason reason);
97 98 99 100 101

}  // namespace internal
}  // namespace v8

#endif  // V8_DEOPTIMIZE_REASON_H_