753989649874ff7e85beb47cbd9f26caef15507a
[platform/upstream/v8.git] / src / bailout-reason.h
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(kAttemptToUseUndefinedCache, "Attempt to use undefined cache")             \
33   V(kBadValueContextForArgumentsObjectValue,                                   \
34     "Bad value context for arguments object value")                            \
35   V(kBadValueContextForArgumentsValue,                                         \
36     "Bad value context for arguments value")                                   \
37   V(kBailedOutDueToDependencyChange, "Bailed out due to dependency change")    \
38   V(kBailoutWasNotPrepared, "Bailout was not prepared")                        \
39   V(kBothRegistersWereSmisInSelectNonSmi,                                      \
40     "Both registers were smis in SelectNonSmi")                                \
41   V(kCallToAJavaScriptRuntimeFunction,                                         \
42     "Call to a JavaScript runtime function")                                   \
43   V(kClassLiteral, "Class literal")                                            \
44   V(kCodeGenerationFailed, "Code generation failed")                           \
45   V(kCodeObjectNotProperlyPatched, "Code object not properly patched")         \
46   V(kCompoundAssignmentToLookupSlot, "Compound assignment to lookup slot")     \
47   V(kComputedPropertyName, "Computed property name")                           \
48   V(kContextAllocatedArguments, "Context-allocated arguments")                 \
49   V(kCopyBuffersOverlap, "Copy buffers overlap")                               \
50   V(kCouldNotGenerateZero, "Could not generate +0.0")                          \
51   V(kCouldNotGenerateNegativeZero, "Could not generate -0.0")                  \
52   V(kDebuggerStatement, "DebuggerStatement")                                   \
53   V(kDeclarationInCatchContext, "Declaration in catch context")                \
54   V(kDeclarationInWithContext, "Declaration in with context")                  \
55   V(kDefaultNaNModeNotSet, "Default NaN mode not set")                         \
56   V(kDeleteWithGlobalVariable, "Delete with global variable")                  \
57   V(kDeleteWithNonGlobalVariable, "Delete with non-global variable")           \
58   V(kDestinationOfCopyNotAligned, "Destination of copy not aligned")           \
59   V(kDontDeleteCellsCannotContainTheHole,                                      \
60     "DontDelete cells can't contain the hole")                                 \
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(kInstanceofStubUnexpectedCallSiteCacheCheck,                               \
109     "InstanceofStub unexpected call site cache (check)")                       \
110   V(kInstanceofStubUnexpectedCallSiteCacheCmp1,                                \
111     "InstanceofStub unexpected call site cache (cmp 1)")                       \
112   V(kInstanceofStubUnexpectedCallSiteCacheCmp2,                                \
113     "InstanceofStub unexpected call site cache (cmp 2)")                       \
114   V(kInstanceofStubUnexpectedCallSiteCacheMov,                                 \
115     "InstanceofStub unexpected call site cache (mov)")                         \
116   V(kInteger32ToSmiFieldWritingToNonSmiLocation,                               \
117     "Integer32ToSmiField writing to non-smi location")                         \
118   V(kInvalidCaptureReferenced, "Invalid capture referenced")                   \
119   V(kInvalidElementsKindForInternalArrayOrInternalPackedArray,                 \
120     "Invalid ElementsKind for InternalArray or InternalPackedArray")           \
121   V(kInvalidFullCodegenState, "invalid full-codegen state")                    \
122   V(kInvalidHandleScopeLevel, "Invalid HandleScope level")                     \
123   V(kInvalidLeftHandSideInAssignment, "Invalid left-hand side in assignment")  \
124   V(kInvalidLhsInCompoundAssignment, "Invalid lhs in compound assignment")     \
125   V(kInvalidLhsInCountOperation, "Invalid lhs in count operation")             \
126   V(kInvalidMinLength, "Invalid min_length")                                   \
127   V(kJSGlobalObjectNativeContextShouldBeANativeContext,                        \
128     "JSGlobalObject::native_context should be a native context")               \
129   V(kJSGlobalProxyContextShouldNotBeNull,                                      \
130     "JSGlobalProxy::context() should not be null")                             \
131   V(kJSObjectWithFastElementsMapHasSlowElements,                               \
132     "JSObject with fast elements map has slow elements")                       \
133   V(kLetBindingReInitialization, "Let binding re-initialization")              \
134   V(kLiveBytesCountOverflowChunkSize, "Live Bytes Count overflow chunk size")  \
135   V(kLiveEdit, "LiveEdit")                                                     \
136   V(kLookupVariableInCountOperation, "Lookup variable in count operation")     \
137   V(kMapBecameDeprecated, "Map became deprecated")                             \
138   V(kMapBecameUnstable, "Map became unstable")                                 \
139   V(kNativeFunctionLiteral, "Native function literal")                         \
140   V(kNeedSmiLiteral, "Need a Smi literal here")                                \
141   V(kNoCasesLeft, "No cases left")                                             \
142   V(kNoEmptyArraysHereInEmitFastOneByteArrayJoin,                              \
143     "No empty arrays here in EmitFastOneByteArrayJoin")                        \
144   V(kNonInitializerAssignmentToConst, "Non-initializer assignment to const")   \
145   V(kNonSmiIndex, "Non-smi index")                                             \
146   V(kNonSmiKeyInArrayLiteral, "Non-smi key in array literal")                  \
147   V(kNonSmiValue, "Non-smi value")                                             \
148   V(kNonObject, "Non-object value")                                            \
149   V(kNotEnoughVirtualRegistersForValues,                                       \
150     "Not enough virtual registers for values")                                 \
151   V(kNotEnoughSpillSlotsForOsr, "Not enough spill slots for OSR")              \
152   V(kNotEnoughVirtualRegistersRegalloc,                                        \
153     "Not enough virtual registers (regalloc)")                                 \
154   V(kObjectFoundInSmiOnlyArray, "Object found in smi-only array")              \
155   V(kObjectLiteralWithComplexProperty, "Object literal with complex property") \
156   V(kOffsetOutOfRange, "Offset out of range")                                  \
157   V(kOperandIsASmiAndNotAName, "Operand is a smi and not a name")              \
158   V(kOperandIsASmiAndNotAString, "Operand is a smi and not a string")          \
159   V(kOperandIsASmi, "Operand is a smi")                                        \
160   V(kOperandIsNotADate, "Operand is not a date")                               \
161   V(kOperandIsNotAName, "Operand is not a name")                               \
162   V(kOperandIsNotANumber, "Operand is not a number")                           \
163   V(kOperandIsNotASmi, "Operand is not a smi")                                 \
164   V(kOperandIsNotAString, "Operand is not a string")                           \
165   V(kOperandIsNotSmi, "Operand is not smi")                                    \
166   V(kOperandNotANumber, "Operand not a number")                                \
167   V(kObjectTagged, "The object is tagged")                                     \
168   V(kObjectNotTagged, "The object is not tagged")                              \
169   V(kOptimizationDisabled, "Optimization is disabled")                         \
170   V(kOptimizedTooManyTimes, "Optimized too many times")                        \
171   V(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister,                   \
172     "Out of virtual registers while trying to allocate temp register")         \
173   V(kParseScopeError, "Parse/scope error")                                     \
174   V(kPossibleDirectCallToEval, "Possible direct call to eval")                 \
175   V(kReceivedInvalidReturnAddress, "Received invalid return address")          \
176   V(kReferenceToAVariableWhichRequiresDynamicLookup,                           \
177     "Reference to a variable which requires dynamic lookup")                   \
178   V(kReferenceToGlobalLexicalVariable, "Reference to global lexical 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(kReturnAddressNotFoundInFrame, "Return address not found in frame")        \
184   V(kScriptContext, "Allocation of script context")                            \
185   V(kSmiAdditionOverflow, "Smi addition overflow")                             \
186   V(kSmiSubtractionOverflow, "Smi subtraction overflow")                       \
187   V(kSpread, "Spread in array literal")                                        \
188   V(kStackAccessBelowStackPointer, "Stack access below stack pointer")         \
189   V(kStackFrameTypesMustMatch, "Stack frame types must match")                 \
190   V(kSuperReference, "Super reference")                                        \
191   V(kTheCurrentStackPointerIsBelowCsp,                                         \
192     "The current stack pointer is below csp")                                  \
193   V(kTheInstructionShouldBeALis, "The instruction should be a lis")            \
194   V(kTheInstructionShouldBeALui, "The instruction should be a lui")            \
195   V(kTheInstructionShouldBeAnOri, "The instruction should be an ori")          \
196   V(kTheInstructionShouldBeAnOris, "The instruction should be an oris")        \
197   V(kTheInstructionShouldBeALi, "The instruction should be a li")              \
198   V(kTheInstructionShouldBeASldi, "The instruction should be a sldi")          \
199   V(kTheInstructionToPatchShouldBeAnLdrLiteral,                                \
200     "The instruction to patch should be a ldr literal")                        \
201   V(kTheInstructionToPatchShouldBeALis,                                        \
202     "The instruction to patch should be a lis")                                \
203   V(kTheInstructionToPatchShouldBeALui,                                        \
204     "The instruction to patch should be a lui")                                \
205   V(kTheInstructionToPatchShouldBeAnOri,                                       \
206     "The instruction to patch should be an ori")                               \
207   V(kTheSourceAndDestinationAreTheSame,                                        \
208     "The source and destination are the same")                                 \
209   V(kTheStackWasCorruptedByMacroAssemblerCall,                                 \
210     "The stack was corrupted by MacroAssembler::Call()")                       \
211   V(kTooManyParametersLocals, "Too many parameters/locals")                    \
212   V(kTooManyParameters, "Too many parameters")                                 \
213   V(kTooManySpillSlotsNeededForOSR, "Too many spill slots needed for OSR")     \
214   V(kToOperand32UnsupportedImmediate, "ToOperand32 unsupported immediate.")    \
215   V(kToOperandIsDoubleRegisterUnimplemented,                                   \
216     "ToOperand IsDoubleRegister unimplemented")                                \
217   V(kToOperandUnsupportedDoubleImmediate,                                      \
218     "ToOperand Unsupported double immediate")                                  \
219   V(kTryCatchStatement, "TryCatchStatement")                                   \
220   V(kTryFinallyStatement, "TryFinallyStatement")                               \
221   V(kUnableToEncodeValueAsSmi, "Unable to encode value as smi")                \
222   V(kUnalignedAllocationInNewSpace, "Unaligned allocation in new space")       \
223   V(kUnalignedCellInWriteBarrier, "Unaligned cell in write barrier")           \
224   V(kUnexpectedAllocationTop, "Unexpected allocation top")                     \
225   V(kUnexpectedColorFound, "Unexpected color bit pattern found")               \
226   V(kUnexpectedElementsKindInArrayConstructor,                                 \
227     "Unexpected ElementsKind in array constructor")                            \
228   V(kUnexpectedFallthroughFromCharCodeAtSlowCase,                              \
229     "Unexpected fallthrough from CharCodeAt slow case")                        \
230   V(kUnexpectedFallthroughFromCharFromCodeSlowCase,                            \
231     "Unexpected fallthrough from CharFromCode slow case")                      \
232   V(kUnexpectedFallThroughFromStringComparison,                                \
233     "Unexpected fall-through from string comparison")                          \
234   V(kUnexpectedFallthroughToCharCodeAtSlowCase,                                \
235     "Unexpected fallthrough to CharCodeAt slow case")                          \
236   V(kUnexpectedFallthroughToCharFromCodeSlowCase,                              \
237     "Unexpected fallthrough to CharFromCode slow case")                        \
238   V(kUnexpectedFPUStackDepthAfterInstruction,                                  \
239     "Unexpected FPU stack depth after instruction")                            \
240   V(kUnexpectedInitialMapForArrayFunction1,                                    \
241     "Unexpected initial map for Array function (1)")                           \
242   V(kUnexpectedInitialMapForArrayFunction2,                                    \
243     "Unexpected initial map for Array function (2)")                           \
244   V(kUnexpectedInitialMapForArrayFunction,                                     \
245     "Unexpected initial map for Array function")                               \
246   V(kUnexpectedInitialMapForInternalArrayFunction,                             \
247     "Unexpected initial map for InternalArray function")                       \
248   V(kUnexpectedLevelAfterReturnFromApiCall,                                    \
249     "Unexpected level after return from api call")                             \
250   V(kUnexpectedNegativeValue, "Unexpected negative value")                     \
251   V(kUnexpectedNumberOfPreAllocatedPropertyFields,                             \
252     "Unexpected number of pre-allocated property fields")                      \
253   V(kUnexpectedFPCRMode, "Unexpected FPCR mode.")                              \
254   V(kUnexpectedSmi, "Unexpected smi value")                                    \
255   V(kUnexpectedStringFunction, "Unexpected String function")                   \
256   V(kUnexpectedStringType, "Unexpected string type")                           \
257   V(kUnexpectedStringWrapperInstanceSize,                                      \
258     "Unexpected string wrapper instance size")                                 \
259   V(kUnexpectedTypeForRegExpDataFixedArrayExpected,                            \
260     "Unexpected type for RegExp data, FixedArray expected")                    \
261   V(kUnexpectedValue, "Unexpected value")                                      \
262   V(kUnexpectedUnusedPropertiesOfStringWrapper,                                \
263     "Unexpected unused properties of string wrapper")                          \
264   V(kUnsupportedConstCompoundAssignment,                                       \
265     "Unsupported const compound assignment")                                   \
266   V(kUnsupportedCountOperationWithConst,                                       \
267     "Unsupported count operation with const")                                  \
268   V(kUnsupportedDoubleImmediate, "Unsupported double immediate")               \
269   V(kUnsupportedLetCompoundAssignment, "Unsupported let compound assignment")  \
270   V(kUnsupportedLookupSlotInDeclaration,                                       \
271     "Unsupported lookup slot in declaration")                                  \
272   V(kUnsupportedNonPrimitiveCompare, "Unsupported non-primitive compare")      \
273   V(kUnsupportedPhiUseOfArguments, "Unsupported phi use of arguments")         \
274   V(kUnsupportedPhiUseOfConstVariable,                                         \
275     "Unsupported phi use of const variable")                                   \
276   V(kUnsupportedTaggedImmediate, "Unsupported tagged immediate")               \
277   V(kVariableResolvedToWithContext, "Variable resolved to with context")       \
278   V(kWeShouldNotHaveAnEmptyLexicalContext,                                     \
279     "We should not have an empty lexical context")                             \
280   V(kWithStatement, "WithStatement")                                           \
281   V(kWrongFunctionContext, "Wrong context passed to function")                 \
282   V(kWrongAddressOrValuePassedToRecordWrite,                                   \
283     "Wrong address or value passed to RecordWrite")                            \
284   V(kShouldNotDirectlyEnterOsrFunction,                                        \
285     "Should not directly enter OSR-compiled function")                         \
286   V(kYield, "Yield")
287
288
289 #define ERROR_MESSAGES_CONSTANTS(C, T) C,
290 enum BailoutReason {
291   ERROR_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS) kLastErrorMessage
292 };
293 #undef ERROR_MESSAGES_CONSTANTS
294
295
296 const char* GetBailoutReason(BailoutReason reason);
297
298 }  // namespace internal
299 }  // namespace v8
300
301 #endif  // V8_BAILOUT_REASON_H_