bailout-reason.h 8.23 KB
Newer Older
1 2 3 4
// Copyright 2014 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.

5 6
#ifndef V8_CODEGEN_BAILOUT_REASON_H_
#define V8_CODEGEN_BAILOUT_REASON_H_
7

8 9
#include <cstdint>

10 11 12
namespace v8 {
namespace internal {

13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
#define ABORT_MESSAGES_LIST(V)                                                \
  V(kNoReason, "no reason")                                                   \
                                                                              \
  V(k32BitValueInRegisterIsNotZeroExtended,                                   \
    "32 bit value in register is not zero-extended")                          \
  V(kAPICallReturnedInvalidObject, "API call returned invalid object")        \
  V(kAllocatingNonEmptyPackedArray, "Allocating non-empty packed array")      \
  V(kAllocationIsNotDoubleAligned, "Allocation is not double aligned")        \
  V(kExpectedOptimizationSentinel,                                            \
    "Expected optimized code cell or optimization sentinel")                  \
  V(kExpectedUndefinedOrCell, "Expected undefined or cell in register")       \
  V(kExpectedFeedbackVector, "Expected feedback vector")                      \
  V(kExpectedBaselineData, "Expected baseline data")                          \
  V(kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry,                     \
    "The function_data field should be a BytecodeArray on interpreter entry") \
  V(kInputStringTooLong, "Input string too long")                             \
  V(kInvalidBytecode, "Invalid bytecode")                                     \
  V(kInvalidBytecodeAdvance, "Cannot advance current bytecode, ")             \
  V(kInvalidHandleScopeLevel, "Invalid HandleScope level")                    \
  V(kInvalidJumpTableIndex, "Invalid jump table index")                       \
  V(kInvalidParametersAndRegistersInGenerator,                                \
    "invalid parameters and registers in generator")                          \
  V(kMissingBytecodeArray, "Missing bytecode array from function")            \
  V(kObjectNotTagged, "The object is not tagged")                             \
  V(kObjectTagged, "The object is tagged")                                    \
  V(kOffsetOutOfRange, "Offset out of range")                                 \
  V(kOperandIsASmi, "Operand is a smi")                                       \
  V(kOperandIsASmiAndNotABoundFunction,                                       \
    "Operand is a smi and not a bound function")                              \
  V(kOperandIsASmiAndNotAConstructor,                                         \
    "Operand is a smi and not a constructor")                                 \
  V(kOperandIsASmiAndNotAFunction, "Operand is a smi and not a function")     \
  V(kOperandIsASmiAndNotAGeneratorObject,                                     \
    "Operand is a smi and not a generator object")                            \
47
  V(kOperandIsCleared, "Operand is cleared")                                  \
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
  V(kOperandIsNotABoundFunction, "Operand is not a bound function")           \
  V(kOperandIsNotAConstructor, "Operand is not a constructor")                \
  V(kOperandIsNotAFixedArray, "Operand is not a fixed array")                 \
  V(kOperandIsNotAFunction, "Operand is not a function")                      \
  V(kOperandIsNotACallableFunction, "Operand is not a callable function")     \
  V(kOperandIsNotAGeneratorObject, "Operand is not a generator object")       \
  V(kOperandIsNotACodeT, "Operand is not a CodeT")                            \
  V(kOperandIsNotASmi, "Operand is not a smi")                                \
  V(kPromiseAlreadySettled, "Promise already settled")                        \
  V(kReceivedInvalidReturnAddress, "Received invalid return address")         \
  V(kRegisterDidNotMatchExpectedRoot, "Register did not match expected root") \
  V(kReturnAddressNotFoundInFrame, "Return address not found in frame")       \
  V(kShouldNotDirectlyEnterOsrFunction,                                       \
    "Should not directly enter OSR-compiled function")                        \
  V(kStackAccessBelowStackPointer, "Stack access below stack pointer")        \
  V(kStackFrameTypesMustMatch, "Stack frame types must match")                \
  V(kUnalignedCellInWriteBarrier, "Unaligned cell in write barrier")          \
  V(kUnexpectedAdditionalPopValue, "Unexpected additional pop value")         \
  V(kUnexpectedElementsKindInArrayConstructor,                                \
    "Unexpected ElementsKind in array constructor")                           \
  V(kUnexpectedFPCRMode, "Unexpected FPCR mode.")                             \
  V(kUnexpectedFunctionIDForInvokeIntrinsic,                                  \
    "Unexpected runtime function id for the InvokeIntrinsic bytecode")        \
  V(kUnexpectedInitialMapForArrayFunction,                                    \
    "Unexpected initial map for Array function")                              \
  V(kUnexpectedLevelAfterReturnFromApiCall,                                   \
    "Unexpected level after return from api call")                            \
  V(kUnexpectedNegativeValue, "Unexpected negative value")                    \
  V(kUnexpectedReturnFromFrameDropper,                                        \
    "Unexpectedly returned from dropping frames")                             \
  V(kUnexpectedReturnFromThrow, "Unexpectedly returned from a throw")         \
  V(kUnexpectedReturnFromWasmTrap,                                            \
    "Should not return after throwing a wasm trap")                           \
  V(kUnexpectedStackPointer, "The stack pointer is not the expected value")   \
  V(kUnexpectedValue, "Unexpected value")                                     \
  V(kUnsupportedModuleOperation, "Unsupported module operation")              \
  V(kUnsupportedNonPrimitiveCompare, "Unsupported non-primitive compare")     \
  V(kWrongAddressOrValuePassedToRecordWrite,                                  \
    "Wrong address or value passed to RecordWrite")                           \
  V(kWrongArgumentCountForInvokeIntrinsic,                                    \
    "Wrong number of arguments for intrinsic")                                \
  V(kWrongFunctionCodeStart, "Wrong value in code start register passed")     \
  V(kWrongFunctionContext, "Wrong context passed to function")                \
  V(kUnexpectedThreadInWasmSet, "thread_in_wasm flag was already set")        \
92
  V(kUnexpectedThreadInWasmUnset, "thread_in_wasm flag was not set")
93 94 95 96 97 98 99 100 101 102

#define BAILOUT_MESSAGES_LIST(V)                                            \
  V(kNoReason, "no reason")                                                 \
                                                                            \
  V(kBailedOutDueToDependencyChange, "Bailed out due to dependency change") \
  V(kCodeGenerationFailed, "Code generation failed")                        \
  V(kCyclicObjectStateDetectedInEscapeAnalysis,                             \
    "Cyclic object state detected by escape analysis")                      \
  V(kFunctionBeingDebugged, "Function is being debugged")                   \
  V(kGraphBuildingFailed, "Optimized graph construction failed")            \
103
  V(kFunctionTooBig, "Function is too big to be optimized")                 \
104 105 106 107 108
  V(kLiveEdit, "LiveEdit")                                                  \
  V(kNativeFunctionLiteral, "Native function literal")                      \
  V(kNotEnoughVirtualRegistersRegalloc,                                     \
    "Not enough virtual registers (regalloc)")                              \
  V(kOptimizationDisabled, "Optimization disabled")                         \
109
  V(kNeverOptimize, "Optimization is always disabled")
110 111

#define ERROR_MESSAGES_CONSTANTS(C, T) C,
112
enum class BailoutReason : uint8_t {
113
  BAILOUT_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS) kLastErrorMessage
114 115
};

116
enum class AbortReason : uint8_t {
117
  ABORT_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS) kLastErrorMessage
118 119 120 121
};
#undef ERROR_MESSAGES_CONSTANTS

const char* GetBailoutReason(BailoutReason reason);
122
const char* GetAbortReason(AbortReason reason);
123
bool IsValidAbortReason(int reason_id);
bmeurer's avatar
bmeurer committed
124 125 126

}  // namespace internal
}  // namespace v8
127

128
#endif  // V8_CODEGEN_BAILOUT_REASON_H_