• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 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_CODEGEN_BAILOUT_REASON_H_
6 #define V8_CODEGEN_BAILOUT_REASON_H_
7 
8 #include <cstdint>
9 
10 namespace v8 {
11 namespace internal {
12 
13 #define ABORT_MESSAGES_LIST(V)                                                \
14   V(kNoReason, "no reason")                                                   \
15                                                                               \
16   V(k32BitValueInRegisterIsNotZeroExtended,                                   \
17     "32 bit value in register is not zero-extended")                          \
18   V(kAPICallReturnedInvalidObject, "API call returned invalid object")        \
19   V(kAllocatingNonEmptyPackedArray, "Allocating non-empty packed array")      \
20   V(kAllocationIsNotDoubleAligned, "Allocation is not double aligned")        \
21   V(kExpectedOptimizationSentinel,                                            \
22     "Expected optimized code cell or optimization sentinel")                  \
23   V(kExpectedUndefinedOrCell, "Expected undefined or cell in register")       \
24   V(kExpectedFeedbackVector, "Expected feedback vector")                      \
25   V(kExpectedBaselineData, "Expected baseline data")                          \
26   V(kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry,                     \
27     "The function_data field should be a BytecodeArray on interpreter entry") \
28   V(kInputStringTooLong, "Input string too long")                             \
29   V(kInvalidBytecode, "Invalid bytecode")                                     \
30   V(kInvalidBytecodeAdvance, "Cannot advance current bytecode, ")             \
31   V(kInvalidHandleScopeLevel, "Invalid HandleScope level")                    \
32   V(kInvalidJumpTableIndex, "Invalid jump table index")                       \
33   V(kInvalidParametersAndRegistersInGenerator,                                \
34     "invalid parameters and registers in generator")                          \
35   V(kMissingBytecodeArray, "Missing bytecode array from function")            \
36   V(kObjectNotTagged, "The object is not tagged")                             \
37   V(kObjectTagged, "The object is tagged")                                    \
38   V(kOffsetOutOfRange, "Offset out of range")                                 \
39   V(kOperandIsASmi, "Operand is a smi")                                       \
40   V(kOperandIsASmiAndNotABoundFunction,                                       \
41     "Operand is a smi and not a bound function")                              \
42   V(kOperandIsASmiAndNotAConstructor,                                         \
43     "Operand is a smi and not a constructor")                                 \
44   V(kOperandIsASmiAndNotAFunction, "Operand is a smi and not a function")     \
45   V(kOperandIsASmiAndNotAGeneratorObject,                                     \
46     "Operand is a smi and not a generator object")                            \
47   V(kOperandIsCleared, "Operand is cleared")                                  \
48   V(kOperandIsNotABoundFunction, "Operand is not a bound function")           \
49   V(kOperandIsNotAConstructor, "Operand is not a constructor")                \
50   V(kOperandIsNotAFixedArray, "Operand is not a fixed array")                 \
51   V(kOperandIsNotAFunction, "Operand is not a function")                      \
52   V(kOperandIsNotACallableFunction, "Operand is not a callable function")     \
53   V(kOperandIsNotAGeneratorObject, "Operand is not a generator object")       \
54   V(kOperandIsNotACodeT, "Operand is not a CodeT")                            \
55   V(kOperandIsNotASmi, "Operand is not a smi")                                \
56   V(kPromiseAlreadySettled, "Promise already settled")                        \
57   V(kReceivedInvalidReturnAddress, "Received invalid return address")         \
58   V(kRegisterDidNotMatchExpectedRoot, "Register did not match expected root") \
59   V(kReturnAddressNotFoundInFrame, "Return address not found in frame")       \
60   V(kShouldNotDirectlyEnterOsrFunction,                                       \
61     "Should not directly enter OSR-compiled function")                        \
62   V(kStackAccessBelowStackPointer, "Stack access below stack pointer")        \
63   V(kStackFrameTypesMustMatch, "Stack frame types must match")                \
64   V(kUnalignedCellInWriteBarrier, "Unaligned cell in write barrier")          \
65   V(kUnexpectedAdditionalPopValue, "Unexpected additional pop value")         \
66   V(kUnexpectedElementsKindInArrayConstructor,                                \
67     "Unexpected ElementsKind in array constructor")                           \
68   V(kUnexpectedFPCRMode, "Unexpected FPCR mode.")                             \
69   V(kUnexpectedFunctionIDForInvokeIntrinsic,                                  \
70     "Unexpected runtime function id for the InvokeIntrinsic bytecode")        \
71   V(kUnexpectedInitialMapForArrayFunction,                                    \
72     "Unexpected initial map for Array function")                              \
73   V(kUnexpectedLevelAfterReturnFromApiCall,                                   \
74     "Unexpected level after return from api call")                            \
75   V(kUnexpectedNegativeValue, "Unexpected negative value")                    \
76   V(kUnexpectedReturnFromFrameDropper,                                        \
77     "Unexpectedly returned from dropping frames")                             \
78   V(kUnexpectedReturnFromThrow, "Unexpectedly returned from a throw")         \
79   V(kUnexpectedReturnFromWasmTrap,                                            \
80     "Should not return after throwing a wasm trap")                           \
81   V(kUnexpectedStackPointer, "The stack pointer is not the expected value")   \
82   V(kUnexpectedValue, "Unexpected value")                                     \
83   V(kUnsupportedModuleOperation, "Unsupported module operation")              \
84   V(kUnsupportedNonPrimitiveCompare, "Unsupported non-primitive compare")     \
85   V(kWrongAddressOrValuePassedToRecordWrite,                                  \
86     "Wrong address or value passed to RecordWrite")                           \
87   V(kWrongArgumentCountForInvokeIntrinsic,                                    \
88     "Wrong number of arguments for intrinsic")                                \
89   V(kWrongFunctionCodeStart, "Wrong value in code start register passed")     \
90   V(kWrongFunctionContext, "Wrong context passed to function")                \
91   V(kUnexpectedThreadInWasmSet, "thread_in_wasm flag was already set")        \
92   V(kUnexpectedThreadInWasmUnset, "thread_in_wasm flag was not set")
93 
94 #define BAILOUT_MESSAGES_LIST(V)                                            \
95   V(kNoReason, "no reason")                                                 \
96                                                                             \
97   V(kBailedOutDueToDependencyChange, "Bailed out due to dependency change") \
98   V(kCodeGenerationFailed, "Code generation failed")                        \
99   V(kCyclicObjectStateDetectedInEscapeAnalysis,                             \
100     "Cyclic object state detected by escape analysis")                      \
101   V(kFunctionBeingDebugged, "Function is being debugged")                   \
102   V(kGraphBuildingFailed, "Optimized graph construction failed")            \
103   V(kFunctionTooBig, "Function is too big to be optimized")                 \
104   V(kLiveEdit, "LiveEdit")                                                  \
105   V(kNativeFunctionLiteral, "Native function literal")                      \
106   V(kNotEnoughVirtualRegistersRegalloc,                                     \
107     "Not enough virtual registers (regalloc)")                              \
108   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 #undef ERROR_MESSAGES_CONSTANTS
120 
121 const char* GetBailoutReason(BailoutReason reason);
122 const char* GetAbortReason(AbortReason reason);
123 bool IsValidAbortReason(int reason_id);
124 
125 }  // namespace internal
126 }  // namespace v8
127 
128 #endif  // V8_CODEGEN_BAILOUT_REASON_H_
129