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.
5 #ifndef V8_BAILOUT_REASON_H_
6 #define V8_BAILOUT_REASON_H_
11 // TODO(svenpanne) introduce an AbortReason and partition this list
12 #define ERROR_MESSAGES_LIST(V) \
13 V(kNoReason, "no reason") \
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(kBinaryStubGenerateFloatingPointCode, \
40 "BinaryStub_GenerateFloatingPointCode") \
41 V(kBothRegistersWereSmisInSelectNonSmi, \
42 "Both registers were smis in SelectNonSmi") \
43 V(kBuiltinFunctionCannotBeOptimized, "Builtin function cannot be optimized") \
44 V(kCallToAJavaScriptRuntimeFunction, \
45 "Call to a JavaScript runtime function") \
46 V(kCannotTranslatePositionInChangedArea, \
47 "Cannot translate position in changed area") \
48 V(kClassLiteral, "Class literal") \
49 V(kCodeGenerationFailed, "Code generation failed") \
50 V(kCodeObjectNotProperlyPatched, "Code object not properly patched") \
51 V(kCompoundAssignmentToLookupSlot, "Compound assignment to lookup slot") \
52 V(kComputedPropertyName, "Computed property name") \
53 V(kContextAllocatedArguments, "Context-allocated arguments") \
54 V(kCopyBuffersOverlap, "Copy buffers overlap") \
55 V(kCouldNotGenerateZero, "Could not generate +0.0") \
56 V(kCouldNotGenerateNegativeZero, "Could not generate -0.0") \
57 V(kDebuggerHasBreakPoints, "Debugger has break points") \
58 V(kDebuggerStatement, "DebuggerStatement") \
59 V(kDeclarationInCatchContext, "Declaration in catch context") \
60 V(kDeclarationInWithContext, "Declaration in with context") \
61 V(kDefaultNaNModeNotSet, "Default NaN mode not set") \
62 V(kDeleteWithGlobalVariable, "Delete with global variable") \
63 V(kDeleteWithNonGlobalVariable, "Delete with non-global variable") \
64 V(kDestinationOfCopyNotAligned, "Destination of copy not aligned") \
65 V(kDontDeleteCellsCannotContainTheHole, \
66 "DontDelete cells can't contain the hole") \
67 V(kDoPushArgumentNotImplementedForDoubleType, \
68 "DoPushArgument not implemented for double type") \
69 V(kEliminatedBoundsCheckFailed, "Eliminated bounds check failed") \
70 V(kEmitLoadRegisterUnsupportedDoubleImmediate, \
71 "EmitLoadRegister: Unsupported double immediate") \
73 V(kExpected0AsASmiSentinel, "Expected 0 as a Smi sentinel") \
74 V(kExpectedAlignmentMarker, "Expected alignment marker") \
75 V(kExpectedAllocationSite, "Expected allocation site") \
76 V(kExpectedFunctionObject, "Expected function object in register") \
77 V(kExpectedHeapNumber, "Expected HeapNumber") \
78 V(kExpectedNativeContext, "Expected native context") \
79 V(kExpectedNonIdenticalObjects, "Expected non-identical objects") \
80 V(kExpectedNonNullContext, "Expected non-null context") \
81 V(kExpectedPositiveZero, "Expected +0.0") \
82 V(kExpectedAllocationSiteInCell, "Expected AllocationSite in property cell") \
83 V(kExpectedFixedArrayInFeedbackVector, \
84 "Expected fixed array in feedback vector") \
85 V(kExpectedFixedArrayInRegisterA2, "Expected fixed array in register a2") \
86 V(kExpectedFixedArrayInRegisterEbx, "Expected fixed array in register ebx") \
87 V(kExpectedFixedArrayInRegisterR2, "Expected fixed array in register r2") \
88 V(kExpectedFixedArrayInRegisterRbx, "Expected fixed array in register rbx") \
89 V(kExpectedNewSpaceObject, "Expected new space object") \
90 V(kExpectedSmiOrHeapNumber, "Expected smi or HeapNumber") \
91 V(kExpectedUndefinedOrCell, "Expected undefined or cell in register") \
92 V(kExpectingAlignmentForCopyBytes, "Expecting alignment for CopyBytes") \
93 V(kExportDeclaration, "Export declaration") \
94 V(kExternalStringExpectedButNotFound, \
95 "External string expected, but not found") \
96 V(kFailedBailedOutLastTime, "Failed/bailed out last time") \
97 V(kForInStatementIsNotFastCase, "ForInStatement is not fast case") \
98 V(kForInStatementOptimizationIsDisabled, \
99 "ForInStatement optimization is disabled") \
100 V(kForInStatementWithNonLocalEachVariable, \
101 "ForInStatement with non-local each variable") \
102 V(kForOfStatement, "ForOfStatement") \
103 V(kFrameIsExpectedToBeAligned, "Frame is expected to be aligned") \
104 V(kFunctionCallsEval, "Function calls eval") \
105 V(kFunctionIsAGenerator, "Function is a generator") \
106 V(kFunctionWithIllegalRedeclaration, "Function with illegal redeclaration") \
107 V(kGeneratedCodeIsTooLarge, "Generated code is too large") \
108 V(kGeneratorFailedToResume, "Generator failed to resume") \
109 V(kGenerator, "Generator") \
110 V(kGlobalFunctionsMustHaveInitialMap, \
111 "Global functions must have initial map") \
112 V(kHeapNumberMapRegisterClobbered, "HeapNumberMap register clobbered") \
113 V(kHydrogenFilter, "Optimization disabled by filter") \
114 V(kImportDeclaration, "Import declaration") \
115 V(kImproperObjectOnPrototypeChainForStore, \
116 "Improper object on prototype chain for store") \
117 V(kIndexIsNegative, "Index is negative") \
118 V(kIndexIsTooLarge, "Index is too large") \
119 V(kInlinedRuntimeFunctionClassOf, "Inlined runtime function: ClassOf") \
120 V(kInlinedRuntimeFunctionFastOneByteArrayJoin, \
121 "Inlined runtime function: FastOneByteArrayJoin") \
122 V(kInlinedRuntimeFunctionGeneratorNext, \
123 "Inlined runtime function: GeneratorNext") \
124 V(kInlinedRuntimeFunctionGeneratorThrow, \
125 "Inlined runtime function: GeneratorThrow") \
126 V(kInlinedRuntimeFunctionGetFromCache, \
127 "Inlined runtime function: GetFromCache") \
128 V(kInlinedRuntimeFunctionIsNonNegativeSmi, \
129 "Inlined runtime function: IsNonNegativeSmi") \
130 V(kInlinedRuntimeFunctionIsStringWrapperSafeForDefaultValueOf, \
131 "Inlined runtime function: IsStringWrapperSafeForDefaultValueOf") \
132 V(kInliningBailedOut, "Inlining bailed out") \
133 V(kInputGPRIsExpectedToHaveUpper32Cleared, \
134 "Input GPR is expected to have upper32 cleared") \
135 V(kInputStringTooLong, "Input string too long") \
136 V(kInstanceofStubUnexpectedCallSiteCacheCheck, \
137 "InstanceofStub unexpected call site cache (check)") \
138 V(kInstanceofStubUnexpectedCallSiteCacheCmp1, \
139 "InstanceofStub unexpected call site cache (cmp 1)") \
140 V(kInstanceofStubUnexpectedCallSiteCacheCmp2, \
141 "InstanceofStub unexpected call site cache (cmp 2)") \
142 V(kInstanceofStubUnexpectedCallSiteCacheMov, \
143 "InstanceofStub unexpected call site cache (mov)") \
144 V(kInteger32ToSmiFieldWritingToNonSmiLocation, \
145 "Integer32ToSmiField writing to non-smi location") \
146 V(kInvalidCaptureReferenced, "Invalid capture referenced") \
147 V(kInvalidElementsKindForInternalArrayOrInternalPackedArray, \
148 "Invalid ElementsKind for InternalArray or InternalPackedArray") \
149 V(kInvalidFullCodegenState, "invalid full-codegen state") \
150 V(kInvalidHandleScopeLevel, "Invalid HandleScope level") \
151 V(kInvalidLeftHandSideInAssignment, "Invalid left-hand side in assignment") \
152 V(kInvalidLhsInCompoundAssignment, "Invalid lhs in compound assignment") \
153 V(kInvalidLhsInCountOperation, "Invalid lhs in count operation") \
154 V(kInvalidMinLength, "Invalid min_length") \
155 V(kJSGlobalObjectNativeContextShouldBeANativeContext, \
156 "JSGlobalObject::native_context should be a native context") \
157 V(kJSGlobalProxyContextShouldNotBeNull, \
158 "JSGlobalProxy::context() should not be null") \
159 V(kJSObjectWithFastElementsMapHasSlowElements, \
160 "JSObject with fast elements map has slow elements") \
161 V(kLetBindingReInitialization, "Let binding re-initialization") \
162 V(kLhsHasBeenClobbered, "lhs has been clobbered") \
163 V(kLiveBytesCountOverflowChunkSize, "Live Bytes Count overflow chunk size") \
164 V(kLiveEdit, "LiveEdit") \
165 V(kLookupVariableInCountOperation, "Lookup variable in count operation") \
166 V(kMapBecameDeprecated, "Map became deprecated") \
167 V(kMapBecameUnstable, "Map became unstable") \
168 V(kMapIsNoLongerInEax, "Map is no longer in eax") \
169 V(kModuleDeclaration, "Module declaration") \
170 V(kModuleLiteral, "Module literal") \
171 V(kModulePath, "Module path") \
172 V(kModuleStatement, "Module statement") \
173 V(kModuleVariable, "Module variable") \
174 V(kModuleUrl, "Module url") \
175 V(kNativeFunctionLiteral, "Native function literal") \
176 V(kSuperReference, "Super reference") \
177 V(kNeedSmiLiteral, "Need a Smi literal here") \
178 V(kNoCasesLeft, "No cases left") \
179 V(kNoEmptyArraysHereInEmitFastOneByteArrayJoin, \
180 "No empty arrays here in EmitFastOneByteArrayJoin") \
181 V(kNonInitializerAssignmentToConst, "Non-initializer assignment to const") \
182 V(kNonSmiIndex, "Non-smi index") \
183 V(kNonSmiKeyInArrayLiteral, "Non-smi key in array literal") \
184 V(kNonSmiValue, "Non-smi value") \
185 V(kNonObject, "Non-object value") \
186 V(kNotEnoughVirtualRegistersForValues, \
187 "Not enough virtual registers for values") \
188 V(kNotEnoughSpillSlotsForOsr, "Not enough spill slots for OSR") \
189 V(kNotEnoughVirtualRegistersRegalloc, \
190 "Not enough virtual registers (regalloc)") \
191 V(kObjectFoundInSmiOnlyArray, "Object found in smi-only array") \
192 V(kObjectLiteralWithComplexProperty, "Object literal with complex property") \
193 V(kOddballInStringTableIsNotUndefinedOrTheHole, \
194 "Oddball in string table is not undefined or the hole") \
195 V(kOffsetOutOfRange, "Offset out of range") \
196 V(kOperandIsASmiAndNotAName, "Operand is a smi and not a name") \
197 V(kOperandIsASmiAndNotAString, "Operand is a smi and not a string") \
198 V(kOperandIsASmi, "Operand is a smi") \
199 V(kOperandIsNotAName, "Operand is not a name") \
200 V(kOperandIsNotANumber, "Operand is not a number") \
201 V(kOperandIsNotASmi, "Operand is not a smi") \
202 V(kOperandIsNotAString, "Operand is not a string") \
203 V(kOperandIsNotSmi, "Operand is not smi") \
204 V(kOperandNotANumber, "Operand not a number") \
205 V(kObjectTagged, "The object is tagged") \
206 V(kObjectNotTagged, "The object is not tagged") \
207 V(kOptimizationDisabled, "Optimization is disabled") \
208 V(kOptimizedTooManyTimes, "Optimized too many times") \
209 V(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister, \
210 "Out of virtual registers while trying to allocate temp register") \
211 V(kParseScopeError, "Parse/scope error") \
212 V(kPossibleDirectCallToEval, "Possible direct call to eval") \
213 V(kPreconditionsWereNotMet, "Preconditions were not met") \
214 V(kPropertyAllocationCountFailed, "Property allocation count failed") \
215 V(kReceivedInvalidReturnAddress, "Received invalid return address") \
216 V(kReferenceToAVariableWhichRequiresDynamicLookup, \
217 "Reference to a variable which requires dynamic lookup") \
218 V(kReferenceToGlobalLexicalVariable, "Reference to global lexical variable") \
219 V(kReferenceToUninitializedVariable, "Reference to uninitialized variable") \
220 V(kRegisterDidNotMatchExpectedRoot, "Register did not match expected root") \
221 V(kRegisterWasClobbered, "Register was clobbered") \
222 V(kRememberedSetPointerInNewSpace, "Remembered set pointer is in new space") \
223 V(kRestParameter, "Rest parameters") \
224 V(kReturnAddressNotFoundInFrame, "Return address not found in frame") \
225 V(kRhsHasBeenClobbered, "Rhs has been clobbered") \
226 V(kScopedBlock, "ScopedBlock") \
227 V(kSmiAdditionOverflow, "Smi addition overflow") \
228 V(kSmiSubtractionOverflow, "Smi subtraction overflow") \
229 V(kStackAccessBelowStackPointer, "Stack access below stack pointer") \
230 V(kStackFrameTypesMustMatch, "Stack frame types must match") \
231 V(kTheCurrentStackPointerIsBelowCsp, \
232 "The current stack pointer is below csp") \
233 V(kTheInstructionShouldBeALis, "The instruction should be a lis") \
234 V(kTheInstructionShouldBeALui, "The instruction should be a lui") \
235 V(kTheInstructionShouldBeAnOri, "The instruction should be an ori") \
236 V(kTheInstructionShouldBeAnOris, "The instruction should be an oris") \
237 V(kTheInstructionShouldBeALi, "The instruction should be a li") \
238 V(kTheInstructionShouldBeASldi, "The instruction should be a sldi") \
239 V(kTheInstructionToPatchShouldBeALoadFromConstantPool, \
240 "The instruction to patch should be a load from the constant pool") \
241 V(kTheInstructionToPatchShouldBeAnLdrLiteral, \
242 "The instruction to patch should be a ldr literal") \
243 V(kTheInstructionToPatchShouldBeALis, \
244 "The instruction to patch should be a lis") \
245 V(kTheInstructionToPatchShouldBeALui, \
246 "The instruction to patch should be a lui") \
247 V(kTheInstructionToPatchShouldBeAnOri, \
248 "The instruction to patch should be an ori") \
249 V(kTheSourceAndDestinationAreTheSame, \
250 "The source and destination are the same") \
251 V(kTheStackPointerIsNotAligned, "The stack pointer is not aligned.") \
252 V(kTheStackWasCorruptedByMacroAssemblerCall, \
253 "The stack was corrupted by MacroAssembler::Call()") \
254 V(kTooManyParametersLocals, "Too many parameters/locals") \
255 V(kTooManyParameters, "Too many parameters") \
256 V(kTooManySpillSlotsNeededForOSR, "Too many spill slots needed for OSR") \
257 V(kToOperand32UnsupportedImmediate, "ToOperand32 unsupported immediate.") \
258 V(kToOperandIsDoubleRegisterUnimplemented, \
259 "ToOperand IsDoubleRegister unimplemented") \
260 V(kToOperandUnsupportedDoubleImmediate, \
261 "ToOperand Unsupported double immediate") \
262 V(kTryCatchStatement, "TryCatchStatement") \
263 V(kTryFinallyStatement, "TryFinallyStatement") \
264 V(kUnableToEncodeValueAsSmi, "Unable to encode value as smi") \
265 V(kUnalignedAllocationInNewSpace, "Unaligned allocation in new space") \
266 V(kUnalignedCellInWriteBarrier, "Unaligned cell in write barrier") \
267 V(kUndefinedValueNotLoaded, "Undefined value not loaded") \
268 V(kUndoAllocationOfNonAllocatedMemory, \
269 "Undo allocation of non allocated memory") \
270 V(kUnexpectedAllocationTop, "Unexpected allocation top") \
271 V(kUnexpectedColorFound, "Unexpected color bit pattern found") \
272 V(kUnexpectedElementsKindInArrayConstructor, \
273 "Unexpected ElementsKind in array constructor") \
274 V(kUnexpectedFallthroughFromCharCodeAtSlowCase, \
275 "Unexpected fallthrough from CharCodeAt slow case") \
276 V(kUnexpectedFallthroughFromCharFromCodeSlowCase, \
277 "Unexpected fallthrough from CharFromCode slow case") \
278 V(kUnexpectedFallThroughFromStringComparison, \
279 "Unexpected fall-through from string comparison") \
280 V(kUnexpectedFallThroughInBinaryStubGenerateFloatingPointCode, \
281 "Unexpected fall-through in BinaryStub_GenerateFloatingPointCode") \
282 V(kUnexpectedFallthroughToCharCodeAtSlowCase, \
283 "Unexpected fallthrough to CharCodeAt slow case") \
284 V(kUnexpectedFallthroughToCharFromCodeSlowCase, \
285 "Unexpected fallthrough to CharFromCode slow case") \
286 V(kUnexpectedFPUStackDepthAfterInstruction, \
287 "Unexpected FPU stack depth after instruction") \
288 V(kUnexpectedInitialMapForArrayFunction1, \
289 "Unexpected initial map for Array function (1)") \
290 V(kUnexpectedInitialMapForArrayFunction2, \
291 "Unexpected initial map for Array function (2)") \
292 V(kUnexpectedInitialMapForArrayFunction, \
293 "Unexpected initial map for Array function") \
294 V(kUnexpectedInitialMapForInternalArrayFunction, \
295 "Unexpected initial map for InternalArray function") \
296 V(kUnexpectedLevelAfterReturnFromApiCall, \
297 "Unexpected level after return from api call") \
298 V(kUnexpectedNegativeValue, "Unexpected negative value") \
299 V(kUnexpectedNumberOfPreAllocatedPropertyFields, \
300 "Unexpected number of pre-allocated property fields") \
301 V(kUnexpectedFPCRMode, "Unexpected FPCR mode.") \
302 V(kUnexpectedSmi, "Unexpected smi value") \
303 V(kUnexpectedStringFunction, "Unexpected String function") \
304 V(kUnexpectedStringType, "Unexpected string type") \
305 V(kUnexpectedStringWrapperInstanceSize, \
306 "Unexpected string wrapper instance size") \
307 V(kUnexpectedTypeForRegExpDataFixedArrayExpected, \
308 "Unexpected type for RegExp data, FixedArray expected") \
309 V(kUnexpectedValue, "Unexpected value") \
310 V(kUnexpectedUnusedPropertiesOfStringWrapper, \
311 "Unexpected unused properties of string wrapper") \
312 V(kUnimplemented, "unimplemented") \
313 V(kUninitializedKSmiConstantRegister, "Uninitialized kSmiConstantRegister") \
314 V(kUnsupportedConstCompoundAssignment, \
315 "Unsupported const compound assignment") \
316 V(kUnsupportedCountOperationWithConst, \
317 "Unsupported count operation with const") \
318 V(kUnsupportedDoubleImmediate, "Unsupported double immediate") \
319 V(kUnsupportedLetCompoundAssignment, "Unsupported let compound assignment") \
320 V(kUnsupportedLookupSlotInDeclaration, \
321 "Unsupported lookup slot in declaration") \
322 V(kUnsupportedNonPrimitiveCompare, "Unsupported non-primitive compare") \
323 V(kUnsupportedPhiUseOfArguments, "Unsupported phi use of arguments") \
324 V(kUnsupportedPhiUseOfConstVariable, \
325 "Unsupported phi use of const variable") \
326 V(kUnsupportedTaggedImmediate, "Unsupported tagged immediate") \
327 V(kVariableResolvedToWithContext, "Variable resolved to with context") \
328 V(kWeShouldNotHaveAnEmptyLexicalContext, \
329 "We should not have an empty lexical context") \
330 V(kWithStatement, "WithStatement") \
331 V(kWrongFunctionContext, "Wrong context passed to function") \
332 V(kWrongAddressOrValuePassedToRecordWrite, \
333 "Wrong address or value passed to RecordWrite") \
334 V(kShouldNotDirectlyEnterOsrFunction, \
335 "Should not directly enter OSR-compiled function") \
336 V(kOsrCompileFailed, "OSR compilation failed") \
340 #define ERROR_MESSAGES_CONSTANTS(C, T) C,
342 ERROR_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS) kLastErrorMessage
344 #undef ERROR_MESSAGES_CONSTANTS
347 const char* GetBailoutReason(BailoutReason reason);
349 } // namespace v8::internal
351 #endif // V8_BAILOUT_REASON_H_