blob: 272b6a4180e7ed8abcae2205a51667fef175d3e6 [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(kForInStatementWithNonLocalEachVariable, \
82 "ForInStatement with non-local each variable") \
83 V(kForOfStatement, "ForOfStatement") \
84 V(kFrameIsExpectedToBeAligned, "Frame is expected to be aligned") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000085 V(kFunctionBeingDebugged, "Function is being debugged") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000086 V(kFunctionCallsEval, "Function calls eval") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000087 V(kFunctionWithIllegalRedeclaration, "Function with illegal redeclaration") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000088 V(kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, \
89 "The function_data field should be a BytecodeArray on interpreter entry") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000090 V(kGeneratedCodeIsTooLarge, "Generated code is too large") \
91 V(kGeneratorFailedToResume, "Generator failed to resume") \
92 V(kGenerator, "Generator") \
93 V(kGlobalFunctionsMustHaveInitialMap, \
94 "Global functions must have initial map") \
95 V(kHeapNumberMapRegisterClobbered, "HeapNumberMap register clobbered") \
96 V(kHydrogenFilter, "Optimization disabled by filter") \
97 V(kImportDeclaration, "Import declaration") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000098 V(kIndexIsNegative, "Index is negative") \
99 V(kIndexIsTooLarge, "Index is too large") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000100 V(kInliningBailedOut, "Inlining bailed out") \
101 V(kInputGPRIsExpectedToHaveUpper32Cleared, \
102 "Input GPR is expected to have upper32 cleared") \
103 V(kInputStringTooLong, "Input string too long") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000104 V(kInteger32ToSmiFieldWritingToNonSmiLocation, \
105 "Integer32ToSmiField writing to non-smi location") \
106 V(kInvalidCaptureReferenced, "Invalid capture referenced") \
107 V(kInvalidElementsKindForInternalArrayOrInternalPackedArray, \
108 "Invalid ElementsKind for InternalArray or InternalPackedArray") \
109 V(kInvalidFullCodegenState, "invalid full-codegen state") \
110 V(kInvalidHandleScopeLevel, "Invalid HandleScope level") \
111 V(kInvalidLeftHandSideInAssignment, "Invalid left-hand side in assignment") \
112 V(kInvalidLhsInCompoundAssignment, "Invalid lhs in compound assignment") \
113 V(kInvalidLhsInCountOperation, "Invalid lhs in count operation") \
114 V(kInvalidMinLength, "Invalid min_length") \
115 V(kJSGlobalObjectNativeContextShouldBeANativeContext, \
116 "JSGlobalObject::native_context should be a native context") \
117 V(kJSGlobalProxyContextShouldNotBeNull, \
118 "JSGlobalProxy::context() should not be null") \
119 V(kJSObjectWithFastElementsMapHasSlowElements, \
120 "JSObject with fast elements map has slow elements") \
121 V(kLetBindingReInitialization, "Let binding re-initialization") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000122 V(kLiveBytesCountOverflowChunkSize, "Live Bytes Count overflow chunk size") \
123 V(kLiveEdit, "LiveEdit") \
124 V(kLookupVariableInCountOperation, "Lookup variable in count operation") \
125 V(kMapBecameDeprecated, "Map became deprecated") \
126 V(kMapBecameUnstable, "Map became unstable") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000127 V(kNativeFunctionLiteral, "Native function literal") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000128 V(kNeedSmiLiteral, "Need a Smi literal here") \
129 V(kNoCasesLeft, "No cases left") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000130 V(kNonInitializerAssignmentToConst, "Non-initializer assignment to const") \
131 V(kNonSmiIndex, "Non-smi index") \
132 V(kNonSmiKeyInArrayLiteral, "Non-smi key in array literal") \
133 V(kNonSmiValue, "Non-smi value") \
134 V(kNonObject, "Non-object value") \
135 V(kNotEnoughVirtualRegistersForValues, \
136 "Not enough virtual registers for values") \
137 V(kNotEnoughSpillSlotsForOsr, "Not enough spill slots for OSR") \
138 V(kNotEnoughVirtualRegistersRegalloc, \
139 "Not enough virtual registers (regalloc)") \
140 V(kObjectFoundInSmiOnlyArray, "Object found in smi-only array") \
141 V(kObjectLiteralWithComplexProperty, "Object literal with complex property") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000142 V(kOffsetOutOfRange, "Offset out of range") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000143 V(kOperandIsASmiAndNotABoundFunction, \
144 "Operand is a smi and not a bound function") \
145 V(kOperandIsASmiAndNotAFunction, "Operand is a smi and not a function") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000146 V(kOperandIsASmiAndNotAName, "Operand is a smi and not a name") \
Ben Murdoch097c5b22016-05-18 11:27:45 +0100147 V(kOperandIsASmiAndNotAReceiver, "Operand is a smi and not a receiver") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000148 V(kOperandIsASmiAndNotAString, "Operand is a smi and not a string") \
149 V(kOperandIsASmi, "Operand is a smi") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000150 V(kOperandIsNotADate, "Operand is not a date") \
151 V(kOperandIsNotABoundFunction, "Operand is not a bound function") \
152 V(kOperandIsNotAFunction, "Operand is not a function") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000153 V(kOperandIsNotAName, "Operand is not a name") \
154 V(kOperandIsNotANumber, "Operand is not a number") \
Ben Murdoch097c5b22016-05-18 11:27:45 +0100155 V(kOperandIsNotAReceiver, "Operand is not a receiver") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000156 V(kOperandIsNotASmi, "Operand is not a smi") \
157 V(kOperandIsNotAString, "Operand is not a string") \
158 V(kOperandIsNotSmi, "Operand is not smi") \
159 V(kOperandNotANumber, "Operand not a number") \
160 V(kObjectTagged, "The object is tagged") \
161 V(kObjectNotTagged, "The object is not tagged") \
162 V(kOptimizationDisabled, "Optimization is disabled") \
163 V(kOptimizedTooManyTimes, "Optimized too many times") \
164 V(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister, \
165 "Out of virtual registers while trying to allocate temp register") \
166 V(kParseScopeError, "Parse/scope error") \
167 V(kPossibleDirectCallToEval, "Possible direct call to eval") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000168 V(kReceivedInvalidReturnAddress, "Received invalid return address") \
169 V(kReferenceToAVariableWhichRequiresDynamicLookup, \
170 "Reference to a variable which requires dynamic lookup") \
171 V(kReferenceToGlobalLexicalVariable, "Reference to global lexical variable") \
172 V(kReferenceToUninitializedVariable, "Reference to uninitialized variable") \
173 V(kRegisterDidNotMatchExpectedRoot, "Register did not match expected root") \
174 V(kRegisterWasClobbered, "Register was clobbered") \
175 V(kRememberedSetPointerInNewSpace, "Remembered set pointer is in new space") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000176 V(kRestParameter, "Rest parameters") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000177 V(kReturnAddressNotFoundInFrame, "Return address not found in frame") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000178 V(kSloppyFunctionExpectsJSReceiverReceiver, \
179 "Sloppy function expects JSReceiver as receiver.") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000180 V(kSmiAdditionOverflow, "Smi addition overflow") \
181 V(kSmiSubtractionOverflow, "Smi subtraction overflow") \
182 V(kStackAccessBelowStackPointer, "Stack access below stack pointer") \
183 V(kStackFrameTypesMustMatch, "Stack frame types must match") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000184 V(kSuperReference, "Super reference") \
Ben Murdoch097c5b22016-05-18 11:27:45 +0100185 V(kTailCall, "Tail call") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000186 V(kTheCurrentStackPointerIsBelowCsp, \
187 "The current stack pointer is below csp") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000188 V(kTheSourceAndDestinationAreTheSame, \
189 "The source and destination are the same") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000190 V(kTheStackWasCorruptedByMacroAssemblerCall, \
191 "The stack was corrupted by MacroAssembler::Call()") \
192 V(kTooManyParametersLocals, "Too many parameters/locals") \
193 V(kTooManyParameters, "Too many parameters") \
194 V(kTooManySpillSlotsNeededForOSR, "Too many spill slots needed for OSR") \
195 V(kToOperand32UnsupportedImmediate, "ToOperand32 unsupported immediate.") \
196 V(kToOperandIsDoubleRegisterUnimplemented, \
197 "ToOperand IsDoubleRegister unimplemented") \
198 V(kToOperandUnsupportedDoubleImmediate, \
199 "ToOperand Unsupported double immediate") \
200 V(kTryCatchStatement, "TryCatchStatement") \
201 V(kTryFinallyStatement, "TryFinallyStatement") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000202 V(kUnalignedAllocationInNewSpace, "Unaligned allocation in new space") \
203 V(kUnalignedCellInWriteBarrier, "Unaligned cell in write barrier") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000204 V(kUnexpectedAllocationTop, "Unexpected allocation top") \
205 V(kUnexpectedColorFound, "Unexpected color bit pattern found") \
206 V(kUnexpectedElementsKindInArrayConstructor, \
207 "Unexpected ElementsKind in array constructor") \
208 V(kUnexpectedFallthroughFromCharCodeAtSlowCase, \
209 "Unexpected fallthrough from CharCodeAt slow case") \
210 V(kUnexpectedFallthroughFromCharFromCodeSlowCase, \
211 "Unexpected fallthrough from CharFromCode slow case") \
212 V(kUnexpectedFallThroughFromStringComparison, \
213 "Unexpected fall-through from string comparison") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000214 V(kUnexpectedFallthroughToCharCodeAtSlowCase, \
215 "Unexpected fallthrough to CharCodeAt slow case") \
216 V(kUnexpectedFallthroughToCharFromCodeSlowCase, \
217 "Unexpected fallthrough to CharFromCode slow case") \
218 V(kUnexpectedFPUStackDepthAfterInstruction, \
219 "Unexpected FPU stack depth after instruction") \
220 V(kUnexpectedInitialMapForArrayFunction1, \
221 "Unexpected initial map for Array function (1)") \
222 V(kUnexpectedInitialMapForArrayFunction2, \
223 "Unexpected initial map for Array function (2)") \
224 V(kUnexpectedInitialMapForArrayFunction, \
225 "Unexpected initial map for Array function") \
226 V(kUnexpectedInitialMapForInternalArrayFunction, \
227 "Unexpected initial map for InternalArray function") \
228 V(kUnexpectedLevelAfterReturnFromApiCall, \
229 "Unexpected level after return from api call") \
230 V(kUnexpectedNegativeValue, "Unexpected negative value") \
231 V(kUnexpectedNumberOfPreAllocatedPropertyFields, \
232 "Unexpected number of pre-allocated property fields") \
233 V(kUnexpectedFPCRMode, "Unexpected FPCR mode.") \
234 V(kUnexpectedSmi, "Unexpected smi value") \
Ben Murdoch097c5b22016-05-18 11:27:45 +0100235 V(kUnexpectedStackDepth, "Unexpected operand stack depth in full-codegen") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000236 V(kUnexpectedStackPointer, "The stack pointer is not the expected value") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000237 V(kUnexpectedStringType, "Unexpected string type") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000238 V(kUnexpectedTypeForRegExpDataFixedArrayExpected, \
239 "Unexpected type for RegExp data, FixedArray expected") \
240 V(kUnexpectedValue, "Unexpected value") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000241 V(kUnsupportedConstCompoundAssignment, \
242 "Unsupported const compound assignment") \
243 V(kUnsupportedCountOperationWithConst, \
244 "Unsupported count operation with const") \
245 V(kUnsupportedDoubleImmediate, "Unsupported double immediate") \
246 V(kUnsupportedLetCompoundAssignment, "Unsupported let compound assignment") \
247 V(kUnsupportedLookupSlotInDeclaration, \
248 "Unsupported lookup slot in declaration") \
249 V(kUnsupportedNonPrimitiveCompare, "Unsupported non-primitive compare") \
250 V(kUnsupportedPhiUseOfArguments, "Unsupported phi use of arguments") \
251 V(kUnsupportedPhiUseOfConstVariable, \
252 "Unsupported phi use of const variable") \
Ben Murdoch097c5b22016-05-18 11:27:45 +0100253 V(kUnexpectedReturnFromBytecodeHandler, \
254 "Unexpectedly returned from a bytecode handler") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000255 V(kUnexpectedReturnFromThrow, "Unexpectedly returned from a throw") \
256 V(kUnsupportedSwitchStatement, "Unsupported switch statement") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000257 V(kUnsupportedTaggedImmediate, "Unsupported tagged immediate") \
258 V(kVariableResolvedToWithContext, "Variable resolved to with context") \
259 V(kWeShouldNotHaveAnEmptyLexicalContext, \
260 "We should not have an empty lexical context") \
261 V(kWithStatement, "WithStatement") \
262 V(kWrongFunctionContext, "Wrong context passed to function") \
263 V(kWrongAddressOrValuePassedToRecordWrite, \
264 "Wrong address or value passed to RecordWrite") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000265 V(kShouldNotDirectlyEnterOsrFunction, \
266 "Should not directly enter OSR-compiled function") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000267 V(kYield, "Yield")
268
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000269#define ERROR_MESSAGES_CONSTANTS(C, T) C,
270enum BailoutReason {
271 ERROR_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS) kLastErrorMessage
272};
273#undef ERROR_MESSAGES_CONSTANTS
274
275
276const char* GetBailoutReason(BailoutReason reason);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000277
278} // namespace internal
279} // namespace v8
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000280
281#endif // V8_BAILOUT_REASON_H_