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