blob: 83898d12bf762c863efaf2fb55997259415e0a54 [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// 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
8namespace v8 {
9namespace internal {
10
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000011// TODO(svenpanne) introduce an AbortReason and partition this list
Ben Murdochb8a8cc12014-11-26 15:28:44 +000012#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") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000032 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") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000038 V(kBothRegistersWereSmisInSelectNonSmi, \
39 "Both registers were smis in SelectNonSmi") \
40 V(kCallToAJavaScriptRuntimeFunction, \
41 "Call to a JavaScript runtime function") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000042 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") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000046 V(kComputedPropertyName, "Computed property name") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000047 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") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000051 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") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000060 V(kDoExpression, "Do expression encountered") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000061 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") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000067 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") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000075 V(kExpectedNewSpaceObject, "Expected new space object") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000076 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") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000081 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") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000087 V(kFunctionBeingDebugged, "Function is being debugged") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000088 V(kFunctionCallsEval, "Function calls eval") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000089 V(kFunctionWithIllegalRedeclaration, "Function with illegal redeclaration") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000090 V(kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, \
91 "The function_data field should be a BytecodeArray on interpreter entry") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000092 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") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000100 V(kIndexIsNegative, "Index is negative") \
101 V(kIndexIsTooLarge, "Index is too large") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000102 V(kInlinedRuntimeFunctionFastOneByteArrayJoin, \
103 "Inlined runtime function: FastOneByteArrayJoin") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000104 V(kInliningBailedOut, "Inlining bailed out") \
105 V(kInputGPRIsExpectedToHaveUpper32Cleared, \
106 "Input GPR is expected to have upper32 cleared") \
107 V(kInputStringTooLong, "Input string too long") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000108 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") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000126 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") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000131 V(kNativeFunctionLiteral, "Native function literal") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000132 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") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000148 V(kOffsetOutOfRange, "Offset out of range") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000149 V(kOperandIsASmiAndNotABoundFunction, \
150 "Operand is a smi and not a bound function") \
151 V(kOperandIsASmiAndNotAFunction, "Operand is a smi and not a function") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000152 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") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000155 V(kOperandIsNotADate, "Operand is not a date") \
156 V(kOperandIsNotABoundFunction, "Operand is not a bound function") \
157 V(kOperandIsNotAFunction, "Operand is not a function") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000158 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") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000172 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") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000180 V(kRestParameter, "Rest parameters") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000181 V(kReturnAddressNotFoundInFrame, "Return address not found in frame") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000182 V(kSloppyFunctionExpectsJSReceiverReceiver, \
183 "Sloppy function expects JSReceiver as receiver.") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000184 V(kSmiAdditionOverflow, "Smi addition overflow") \
185 V(kSmiSubtractionOverflow, "Smi subtraction overflow") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000186 V(kSpread, "Spread in array literal") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000187 V(kStackAccessBelowStackPointer, "Stack access below stack pointer") \
188 V(kStackFrameTypesMustMatch, "Stack frame types must match") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000189 V(kSuperReference, "Super reference") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000190 V(kTheCurrentStackPointerIsBelowCsp, \
191 "The current stack pointer is below csp") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000192 V(kTheSourceAndDestinationAreTheSame, \
193 "The source and destination are the same") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000194 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") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000206 V(kUnalignedAllocationInNewSpace, "Unaligned allocation in new space") \
207 V(kUnalignedCellInWriteBarrier, "Unaligned cell in write barrier") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000208 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") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000218 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") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000239 V(kUnexpectedStackPointer, "The stack pointer is not the expected value") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000240 V(kUnexpectedStringType, "Unexpected string type") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000241 V(kUnexpectedTypeForRegExpDataFixedArrayExpected, \
242 "Unexpected type for RegExp data, FixedArray expected") \
243 V(kUnexpectedValue, "Unexpected value") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000244 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") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000256 V(kUnexpectedReturnFromThrow, "Unexpectedly returned from a throw") \
257 V(kUnsupportedSwitchStatement, "Unsupported switch statement") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000258 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") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000266 V(kShouldNotDirectlyEnterOsrFunction, \
267 "Should not directly enter OSR-compiled function") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000268 V(kYield, "Yield")
269
270
271#define ERROR_MESSAGES_CONSTANTS(C, T) C,
272enum BailoutReason {
273 ERROR_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS) kLastErrorMessage
274};
275#undef ERROR_MESSAGES_CONSTANTS
276
277
278const char* GetBailoutReason(BailoutReason reason);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000279
280} // namespace internal
281} // namespace v8
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000282
283#endif // V8_BAILOUT_REASON_H_