bailout-reason.h 20.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
// 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.

#ifndef V8_BAILOUT_REASON_H_
#define V8_BAILOUT_REASON_H_

namespace v8 {
namespace internal {

11
// TODO(svenpanne) introduce an AbortReason and partition this list
12 13 14 15 16
#define ERROR_MESSAGES_LIST(V)                                                 \
  V(kNoReason, "no reason")                                                    \
                                                                               \
  V(k32BitValueInRegisterIsNotZeroExtended,                                    \
    "32 bit value in register is not zero-extended")                           \
17
  V(kAllocatingNonEmptyPackedArray, "Allocating non-empty packed array")       \
18 19 20 21 22
  V(kAllocationIsNotDoubleAligned, "Allocation is not double aligned")         \
  V(kAPICallReturnedInvalidObject, "API call returned invalid object")         \
  V(kArgumentsObjectValueInATestContext,                                       \
    "Arguments object value in a test context")                                \
  V(kArrayIndexConstantValueTooBig, "Array index constant value too big")      \
23 24
  V(kAssignmentToLetVariableBeforeInitialization,                              \
    "Assignment to let variable before initialization")                        \
25 26 27 28 29 30 31 32 33 34 35 36 37
  V(kAssignmentToLOOKUPVariable, "Assignment to LOOKUP variable")              \
  V(kAssignmentToParameterFunctionUsesArgumentsObject,                         \
    "Assignment to parameter, function uses arguments object")                 \
  V(kAssignmentToParameterInArgumentsObject,                                   \
    "Assignment to parameter in arguments object")                             \
  V(kBadValueContextForArgumentsObjectValue,                                   \
    "Bad value context for arguments object value")                            \
  V(kBadValueContextForArgumentsValue,                                         \
    "Bad value context for arguments value")                                   \
  V(kBailedOutDueToDependencyChange, "Bailed out due to dependency change")    \
  V(kBailoutWasNotPrepared, "Bailout was not prepared")                        \
  V(kBothRegistersWereSmisInSelectNonSmi,                                      \
    "Both registers were smis in SelectNonSmi")                                \
38
  V(kClassConstructorFunction, "Class constructor function")                   \
39 40 41 42
  V(kClassLiteral, "Class literal")                                            \
  V(kCodeGenerationFailed, "Code generation failed")                           \
  V(kCodeObjectNotProperlyPatched, "Code object not properly patched")         \
  V(kCompoundAssignmentToLookupSlot, "Compound assignment to lookup slot")     \
arv's avatar
arv committed
43
  V(kComputedPropertyName, "Computed property name")                           \
44 45 46 47 48 49 50 51 52 53 54 55 56
  V(kContextAllocatedArguments, "Context-allocated arguments")                 \
  V(kCopyBuffersOverlap, "Copy buffers overlap")                               \
  V(kCouldNotGenerateZero, "Could not generate +0.0")                          \
  V(kCouldNotGenerateNegativeZero, "Could not generate -0.0")                  \
  V(kDebuggerStatement, "DebuggerStatement")                                   \
  V(kDeclarationInCatchContext, "Declaration in catch context")                \
  V(kDeclarationInWithContext, "Declaration in with context")                  \
  V(kDefaultNaNModeNotSet, "Default NaN mode not set")                         \
  V(kDeleteWithGlobalVariable, "Delete with global variable")                  \
  V(kDeleteWithNonGlobalVariable, "Delete with non-global variable")           \
  V(kDestinationOfCopyNotAligned, "Destination of copy not aligned")           \
  V(kDontDeleteCellsCannotContainTheHole,                                      \
    "DontDelete cells can't contain the hole")                                 \
57 58
  V(kDoExpressionUnmodelable,                                                  \
    "Encountered a do-expression with unmodelable control statements")         \
59 60 61 62 63
  V(kDoPushArgumentNotImplementedForDoubleType,                                \
    "DoPushArgument not implemented for double type")                          \
  V(kEliminatedBoundsCheckFailed, "Eliminated bounds check failed")            \
  V(kEmitLoadRegisterUnsupportedDoubleImmediate,                               \
    "EmitLoadRegister: Unsupported double immediate")                          \
64 65
  V(kCyclicObjectStateDetectedInEscapeAnalysis,                                \
    "Cyclic object state detected by escape analysis")                         \
66 67
  V(kEval, "eval")                                                             \
  V(kExpectedAllocationSite, "Expected allocation site")                       \
68
  V(kExpectedBooleanValue, "Expected boolean value")                           \
69 70
  V(kExpectedFixedDoubleArrayMap,                                              \
    "Expected a fixed double array map in fast shallow clone array literal")   \
71 72
  V(kExpectedFunctionObject, "Expected function object in register")           \
  V(kExpectedHeapNumber, "Expected HeapNumber")                                \
73
  V(kExpectedJSReceiver, "Expected object to have receiver type")              \
74 75 76 77 78 79 80 81 82 83 84
  V(kExpectedNativeContext, "Expected native context")                         \
  V(kExpectedNonIdenticalObjects, "Expected non-identical objects")            \
  V(kExpectedNonNullContext, "Expected non-null context")                      \
  V(kExpectedPositiveZero, "Expected +0.0")                                    \
  V(kExpectedNewSpaceObject, "Expected new space object")                      \
  V(kExpectedUndefinedOrCell, "Expected undefined or cell in register")        \
  V(kExternalStringExpectedButNotFound,                                        \
    "External string expected, but not found")                                 \
  V(kForInStatementWithNonLocalEachVariable,                                   \
    "ForInStatement with non-local each variable")                             \
  V(kForOfStatement, "ForOfStatement")                                         \
85
  V(kFunctionBeingDebugged, "Function is being debugged")                      \
86
  V(kFunctionCallsEval, "Function calls eval")                                 \
87 88
  V(kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry,                      \
    "The function_data field should be a BytecodeArray on interpreter entry")  \
89 90
  V(kGeneratedCodeIsTooLarge, "Generated code is too large")                   \
  V(kGenerator, "Generator")                                                   \
91
  V(kGetIterator, "GetIterator")                                               \
92 93
  V(kGlobalFunctionsMustHaveInitialMap,                                        \
    "Global functions must have initial map")                                  \
94
  V(kGraphBuildingFailed, "Optimized graph construction failed")               \
95 96 97 98 99 100 101 102 103 104
  V(kHeapNumberMapRegisterClobbered, "HeapNumberMap register clobbered")       \
  V(kHydrogenFilter, "Optimization disabled by filter")                        \
  V(kIndexIsNegative, "Index is negative")                                     \
  V(kIndexIsTooLarge, "Index is too large")                                    \
  V(kInliningBailedOut, "Inlining bailed out")                                 \
  V(kInputGPRIsExpectedToHaveUpper32Cleared,                                   \
    "Input GPR is expected to have upper32 cleared")                           \
  V(kInputStringTooLong, "Input string too long")                              \
  V(kInteger32ToSmiFieldWritingToNonSmiLocation,                               \
    "Integer32ToSmiField writing to non-smi location")                         \
105
  V(kInvalidBytecode, "Invalid bytecode")                                      \
106 107
  V(kInvalidElementsKindForInternalArrayOrInternalPackedArray,                 \
    "Invalid ElementsKind for InternalArray or InternalPackedArray")           \
108 109 110 111 112 113
  V(kInvalidFrameForFastNewRestArgumentsStub,                                  \
    "Invalid frame for FastNewRestArgumentsStub")                              \
  V(kInvalidFrameForFastNewSloppyArgumentsStub,                                \
    "Invalid frame for FastNewSloppyArgumentsStub")                            \
  V(kInvalidFrameForFastNewStrictArgumentsStub,                                \
    "Invalid frame for FastNewStrictArgumentsStub")                            \
114 115
  V(kInvalidFullCodegenState, "invalid full-codegen state")                    \
  V(kInvalidHandleScopeLevel, "Invalid HandleScope level")                     \
116
  V(kInvalidJumpTableIndex, "Invalid jump table index")                        \
117 118 119 120
  V(kInvalidLeftHandSideInAssignment, "Invalid left-hand side in assignment")  \
  V(kInvalidLhsInCompoundAssignment, "Invalid lhs in compound assignment")     \
  V(kInvalidLhsInCountOperation, "Invalid lhs in count operation")             \
  V(kInvalidMinLength, "Invalid min_length")                                   \
121
  V(kInvalidRegisterFileInGenerator, "invalid register file in generator")     \
122 123 124 125 126
  V(kLetBindingReInitialization, "Let binding re-initialization")              \
  V(kLiveEdit, "LiveEdit")                                                     \
  V(kLookupVariableInCountOperation, "Lookup variable in count operation")     \
  V(kMapBecameDeprecated, "Map became deprecated")                             \
  V(kMapBecameUnstable, "Map became unstable")                                 \
127
  V(kMissingBytecodeArray, "Missing bytecode array from function")             \
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
  V(kNativeFunctionLiteral, "Native function literal")                         \
  V(kNeedSmiLiteral, "Need a Smi literal here")                                \
  V(kNoCasesLeft, "No cases left")                                             \
  V(kNonInitializerAssignmentToConst, "Non-initializer assignment to const")   \
  V(kNonSmiIndex, "Non-smi index")                                             \
  V(kNonSmiKeyInArrayLiteral, "Non-smi key in array literal")                  \
  V(kNonSmiValue, "Non-smi value")                                             \
  V(kNonObject, "Non-object value")                                            \
  V(kNotEnoughVirtualRegistersForValues,                                       \
    "Not enough virtual registers for values")                                 \
  V(kNotEnoughSpillSlotsForOsr, "Not enough spill slots for OSR")              \
  V(kNotEnoughVirtualRegistersRegalloc,                                        \
    "Not enough virtual registers (regalloc)")                                 \
  V(kObjectLiteralWithComplexProperty, "Object literal with complex property") \
  V(kOffsetOutOfRange, "Offset out of range")                                  \
143 144
  V(kOperandIsASmiAndNotABoundFunction,                                        \
    "Operand is a smi and not a bound function")                               \
145
  V(kOperandIsASmiAndNotAFunction, "Operand is a smi and not a function")      \
146 147
  V(kOperandIsASmiAndNotAGeneratorObject,                                      \
    "Operand is a smi and not a generator object")                             \
148
  V(kOperandIsASmiAndNotAName, "Operand is a smi and not a name")              \
149
  V(kOperandIsASmiAndNotAReceiver, "Operand is a smi and not a receiver")      \
150 151
  V(kOperandIsASmiAndNotAString, "Operand is a smi and not a string")          \
  V(kOperandIsASmi, "Operand is a smi")                                        \
152
  V(kOperandIsNotABoundFunction, "Operand is not a bound function")            \
153
  V(kOperandIsNotAFunction, "Operand is not a function")                       \
154
  V(kOperandIsNotAGeneratorObject, "Operand is not a generator object")        \
155
  V(kOperandIsNotAReceiver, "Operand is not a receiver")                       \
156 157 158 159 160
  V(kOperandIsNotASmi, "Operand is not a smi")                                 \
  V(kOperandIsNotAString, "Operand is not a string")                           \
  V(kOperandIsNotSmi, "Operand is not smi")                                    \
  V(kObjectTagged, "The object is tagged")                                     \
  V(kObjectNotTagged, "The object is not tagged")                              \
161 162
  V(kOptimizationDisabled, "Optimization disabled")                            \
  V(kOptimizationDisabledForTest, "Optimization disabled for test")            \
163
  V(kDeoptimizedTooManyTimes, "Deoptimized too many times")                    \
164 165 166 167 168 169 170 171
  V(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister,                   \
    "Out of virtual registers while trying to allocate temp register")         \
  V(kParseScopeError, "Parse/scope error")                                     \
  V(kPossibleDirectCallToEval, "Possible direct call to eval")                 \
  V(kReceivedInvalidReturnAddress, "Received invalid return address")          \
  V(kReferenceToAVariableWhichRequiresDynamicLookup,                           \
    "Reference to a variable which requires dynamic lookup")                   \
  V(kReferenceToGlobalLexicalVariable, "Reference to global lexical variable") \
172
  V(kReferenceToModuleVariable, "Reference to module-allocated variable")      \
173 174 175 176
  V(kReferenceToUninitializedVariable, "Reference to uninitialized variable")  \
  V(kRegisterDidNotMatchExpectedRoot, "Register did not match expected root")  \
  V(kRegisterWasClobbered, "Register was clobbered")                           \
  V(kRememberedSetPointerInNewSpace, "Remembered set pointer is in new space") \
177
  V(kRestParameter, "Rest parameters")                                         \
178
  V(kReturnAddressNotFoundInFrame, "Return address not found in frame")        \
179 180
  V(kSloppyFunctionExpectsJSReceiverReceiver,                                  \
    "Sloppy function expects JSReceiver as receiver.")                         \
181 182
  V(kSmiAdditionOverflow, "Smi addition overflow")                             \
  V(kSmiSubtractionOverflow, "Smi subtraction overflow")                       \
183
  V(kSpreadCall, "Call with spread argument")                                  \
184 185
  V(kStackAccessBelowStackPointer, "Stack access below stack pointer")         \
  V(kStackFrameTypesMustMatch, "Stack frame types must match")                 \
186
  V(kSuperReference, "Super reference")                                        \
187
  V(kTailCall, "Tail call")                                                    \
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
  V(kTheCurrentStackPointerIsBelowCsp,                                         \
    "The current stack pointer is below csp")                                  \
  V(kTheStackWasCorruptedByMacroAssemblerCall,                                 \
    "The stack was corrupted by MacroAssembler::Call()")                       \
  V(kTooManyParametersLocals, "Too many parameters/locals")                    \
  V(kTooManyParameters, "Too many parameters")                                 \
  V(kTooManySpillSlotsNeededForOSR, "Too many spill slots needed for OSR")     \
  V(kToOperand32UnsupportedImmediate, "ToOperand32 unsupported immediate.")    \
  V(kToOperandIsDoubleRegisterUnimplemented,                                   \
    "ToOperand IsDoubleRegister unimplemented")                                \
  V(kToOperandUnsupportedDoubleImmediate,                                      \
    "ToOperand Unsupported double immediate")                                  \
  V(kTryCatchStatement, "TryCatchStatement")                                   \
  V(kTryFinallyStatement, "TryFinallyStatement")                               \
  V(kUnalignedAllocationInNewSpace, "Unaligned allocation in new space")       \
  V(kUnalignedCellInWriteBarrier, "Unaligned cell in write barrier")           \
  V(kUnexpectedAllocationTop, "Unexpected allocation top")                     \
  V(kUnexpectedColorFound, "Unexpected color bit pattern found")               \
  V(kUnexpectedElementsKindInArrayConstructor,                                 \
    "Unexpected ElementsKind in array constructor")                            \
  V(kUnexpectedFallthroughFromCharCodeAtSlowCase,                              \
    "Unexpected fallthrough from CharCodeAt slow case")                        \
  V(kUnexpectedFallThroughFromStringComparison,                                \
    "Unexpected fall-through from string comparison")                          \
  V(kUnexpectedFallthroughToCharCodeAtSlowCase,                                \
    "Unexpected fallthrough to CharCodeAt slow case")                          \
  V(kUnexpectedFPUStackDepthAfterInstruction,                                  \
    "Unexpected FPU stack depth after instruction")                            \
  V(kUnexpectedInitialMapForArrayFunction1,                                    \
    "Unexpected initial map for Array function (1)")                           \
  V(kUnexpectedInitialMapForArrayFunction2,                                    \
    "Unexpected initial map for Array function (2)")                           \
  V(kUnexpectedInitialMapForArrayFunction,                                     \
    "Unexpected initial map for Array function")                               \
  V(kUnexpectedInitialMapForInternalArrayFunction,                             \
    "Unexpected initial map for InternalArray function")                       \
  V(kUnexpectedLevelAfterReturnFromApiCall,                                    \
    "Unexpected level after return from api call")                             \
  V(kUnexpectedNegativeValue, "Unexpected negative value")                     \
227 228
  V(kUnexpectedFunctionIDForInvokeIntrinsic,                                   \
    "Unexpected runtime function id for the InvokeIntrinsic bytecode")         \
229 230
  V(kUnexpectedFPCRMode, "Unexpected FPCR mode.")                              \
  V(kUnexpectedSmi, "Unexpected smi value")                                    \
231
  V(kUnexpectedStackDepth, "Unexpected operand stack depth in full-codegen")   \
232
  V(kUnexpectedStackPointer, "The stack pointer is not the expected value")    \
233
  V(kUnexpectedStringType, "Unexpected string type")                           \
234 235
  V(kUnexpectedTestTypeofLiteralFlag,                                          \
    "Unexpected literal flag for TestTypeof bytecode")                         \
236
  V(kUnexpectedRegExpExecCall, "Unexpected call to the RegExpExecStub")        \
237 238
  V(kUnexpectedValue, "Unexpected value")                                      \
  V(kUnsupportedDoubleImmediate, "Unsupported double immediate")               \
239
  V(kUnsupportedLetCompoundAssignment, "Unsupported let compound assignment")  \
240 241
  V(kUnsupportedLookupSlotInDeclaration,                                       \
    "Unsupported lookup slot in declaration")                                  \
242
  V(kUnsupportedModuleOperation, "Unsupported module operation")               \
243 244 245
  V(kUnsupportedNonPrimitiveCompare, "Unsupported non-primitive compare")      \
  V(kUnsupportedPhiUseOfArguments, "Unsupported phi use of arguments")         \
  V(kUnsupportedPhiUseOfConstVariable,                                         \
246
    "Unsupported phi use of const or let variable")                            \
247 248
  V(kUnexpectedReturnFromFrameDropper,                                         \
    "Unexpectedly returned from dropping frames")                              \
249
  V(kUnexpectedReturnFromThrow, "Unexpectedly returned from a throw")          \
250
  V(kUnsupportedSwitchStatement, "Unsupported switch statement")               \
251
  V(kUnsupportedTaggedImmediate, "Unsupported tagged immediate")               \
252
  V(kUnstableConstantTypeHeapObject, "Unstable constant-type heap object")     \
253 254 255 256 257
  V(kVariableResolvedToWithContext, "Variable resolved to with context")       \
  V(kWithStatement, "WithStatement")                                           \
  V(kWrongFunctionContext, "Wrong context passed to function")                 \
  V(kWrongAddressOrValuePassedToRecordWrite,                                   \
    "Wrong address or value passed to RecordWrite")                            \
258 259
  V(kWrongArgumentCountForInvokeIntrinsic,                                     \
    "Wrong number of arguments for intrinsic")                                 \
260
  V(kShouldNotDirectlyEnterOsrFunction,                                        \
261 262 263
    "Should not directly enter OSR-compiled function")                         \
  V(kUnexpectedReturnFromWasmTrap,                                             \
    "Should not return after throwing a wasm trap")
264 265 266 267 268 269 270 271 272

#define ERROR_MESSAGES_CONSTANTS(C, T) C,
enum BailoutReason {
  ERROR_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS) kLastErrorMessage
};
#undef ERROR_MESSAGES_CONSTANTS


const char* GetBailoutReason(BailoutReason reason);
bmeurer's avatar
bmeurer committed
273 274 275

}  // namespace internal
}  // namespace v8
276 277

#endif  // V8_BAILOUT_REASON_H_