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