blob: e47a93c8bd3d1c9aed75771553c137af4514d2a5 [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") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000017 V(kAllocationIsNotDoubleAligned, "Allocation is not double aligned") \
18 V(kAPICallReturnedInvalidObject, "API call returned invalid object") \
19 V(kArgumentsObjectValueInATestContext, \
20 "Arguments object value in a test context") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000021 V(kArrayIndexConstantValueTooBig, "Array index constant value too big") \
22 V(kAssignmentToArguments, "Assignment to arguments") \
23 V(kAssignmentToLetVariableBeforeInitialization, \
24 "Assignment to let variable before initialization") \
25 V(kAssignmentToLOOKUPVariable, "Assignment to LOOKUP variable") \
26 V(kAssignmentToParameterFunctionUsesArgumentsObject, \
27 "Assignment to parameter, function uses arguments object") \
28 V(kAssignmentToParameterInArgumentsObject, \
29 "Assignment to parameter in arguments object") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000030 V(kBadValueContextForArgumentsObjectValue, \
31 "Bad value context for arguments object value") \
32 V(kBadValueContextForArgumentsValue, \
33 "Bad value context for arguments value") \
34 V(kBailedOutDueToDependencyChange, "Bailed out due to dependency change") \
35 V(kBailoutWasNotPrepared, "Bailout was not prepared") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000036 V(kBothRegistersWereSmisInSelectNonSmi, \
37 "Both registers were smis in SelectNonSmi") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000038 V(kClassLiteral, "Class literal") \
39 V(kCodeGenerationFailed, "Code generation failed") \
40 V(kCodeObjectNotProperlyPatched, "Code object not properly patched") \
41 V(kCompoundAssignmentToLookupSlot, "Compound assignment to lookup slot") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000042 V(kComputedPropertyName, "Computed property name") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000043 V(kContextAllocatedArguments, "Context-allocated arguments") \
44 V(kCopyBuffersOverlap, "Copy buffers overlap") \
45 V(kCouldNotGenerateZero, "Could not generate +0.0") \
46 V(kCouldNotGenerateNegativeZero, "Could not generate -0.0") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000047 V(kDebuggerStatement, "DebuggerStatement") \
48 V(kDeclarationInCatchContext, "Declaration in catch context") \
49 V(kDeclarationInWithContext, "Declaration in with context") \
50 V(kDefaultNaNModeNotSet, "Default NaN mode not set") \
51 V(kDeleteWithGlobalVariable, "Delete with global variable") \
52 V(kDeleteWithNonGlobalVariable, "Delete with non-global variable") \
53 V(kDestinationOfCopyNotAligned, "Destination of copy not aligned") \
54 V(kDontDeleteCellsCannotContainTheHole, \
55 "DontDelete cells can't contain the hole") \
Ben Murdochda12d292016-06-02 14:46:10 +010056 V(kDoExpressionUnmodelable, \
57 "Encountered a do-expression with unmodelable control statements") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000058 V(kDoPushArgumentNotImplementedForDoubleType, \
59 "DoPushArgument not implemented for double type") \
60 V(kEliminatedBoundsCheckFailed, "Eliminated bounds check failed") \
61 V(kEmitLoadRegisterUnsupportedDoubleImmediate, \
62 "EmitLoadRegister: Unsupported double immediate") \
63 V(kEval, "eval") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000064 V(kExpectedAllocationSite, "Expected allocation site") \
Ben Murdochc5610432016-08-08 18:44:38 +010065 V(kExpectedBooleanValue, "Expected boolean value") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000066 V(kExpectedFunctionObject, "Expected function object in register") \
67 V(kExpectedHeapNumber, "Expected HeapNumber") \
68 V(kExpectedNativeContext, "Expected native context") \
69 V(kExpectedNonIdenticalObjects, "Expected non-identical objects") \
70 V(kExpectedNonNullContext, "Expected non-null context") \
71 V(kExpectedPositiveZero, "Expected +0.0") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000072 V(kExpectedNewSpaceObject, "Expected new space object") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000073 V(kExpectedUndefinedOrCell, "Expected undefined or cell in register") \
74 V(kExpectingAlignmentForCopyBytes, "Expecting alignment for CopyBytes") \
75 V(kExportDeclaration, "Export declaration") \
76 V(kExternalStringExpectedButNotFound, \
77 "External string expected, but not found") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000078 V(kForInStatementWithNonLocalEachVariable, \
79 "ForInStatement with non-local each variable") \
80 V(kForOfStatement, "ForOfStatement") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000081 V(kFunctionBeingDebugged, "Function is being debugged") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000082 V(kFunctionCallsEval, "Function calls eval") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000083 V(kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, \
84 "The function_data field should be a BytecodeArray on interpreter entry") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000085 V(kGeneratedCodeIsTooLarge, "Generated code is too large") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000086 V(kGenerator, "Generator") \
87 V(kGlobalFunctionsMustHaveInitialMap, \
88 "Global functions must have initial map") \
Ben Murdochc5610432016-08-08 18:44:38 +010089 V(kGraphBuildingFailed, "Optimized graph construction failed") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000090 V(kHeapNumberMapRegisterClobbered, "HeapNumberMap register clobbered") \
91 V(kHydrogenFilter, "Optimization disabled by filter") \
92 V(kImportDeclaration, "Import declaration") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000093 V(kIndexIsNegative, "Index is negative") \
94 V(kIndexIsTooLarge, "Index is too large") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000095 V(kInliningBailedOut, "Inlining bailed out") \
96 V(kInputGPRIsExpectedToHaveUpper32Cleared, \
97 "Input GPR is expected to have upper32 cleared") \
98 V(kInputStringTooLong, "Input string too long") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000099 V(kInteger32ToSmiFieldWritingToNonSmiLocation, \
100 "Integer32ToSmiField writing to non-smi location") \
Ben Murdochda12d292016-06-02 14:46:10 +0100101 V(kInvalidBytecode, "Invalid bytecode") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000102 V(kInvalidElementsKindForInternalArrayOrInternalPackedArray, \
103 "Invalid ElementsKind for InternalArray or InternalPackedArray") \
Ben Murdochc5610432016-08-08 18:44:38 +0100104 V(kInvalidFrameForFastNewRestArgumentsStub, \
105 "Invalid frame for FastNewRestArgumentsStub") \
106 V(kInvalidFrameForFastNewSloppyArgumentsStub, \
107 "Invalid frame for FastNewSloppyArgumentsStub") \
108 V(kInvalidFrameForFastNewStrictArgumentsStub, \
109 "Invalid frame for FastNewStrictArgumentsStub") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000110 V(kInvalidFullCodegenState, "invalid full-codegen state") \
111 V(kInvalidHandleScopeLevel, "Invalid HandleScope level") \
Ben Murdochc5610432016-08-08 18:44:38 +0100112 V(kInvalidJumpTableIndex, "Invalid jump table index") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000113 V(kInvalidLeftHandSideInAssignment, "Invalid left-hand side in assignment") \
114 V(kInvalidLhsInCompoundAssignment, "Invalid lhs in compound assignment") \
115 V(kInvalidLhsInCountOperation, "Invalid lhs in count operation") \
116 V(kInvalidMinLength, "Invalid min_length") \
Ben Murdochc5610432016-08-08 18:44:38 +0100117 V(kInvalidRegisterFileInGenerator, "invalid register file in generator") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000118 V(kJSGlobalObjectNativeContextShouldBeANativeContext, \
119 "JSGlobalObject::native_context should be a native context") \
120 V(kJSGlobalProxyContextShouldNotBeNull, \
121 "JSGlobalProxy::context() should not be null") \
122 V(kJSObjectWithFastElementsMapHasSlowElements, \
123 "JSObject with fast elements map has slow elements") \
124 V(kLetBindingReInitialization, "Let binding re-initialization") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000125 V(kLiveEdit, "LiveEdit") \
126 V(kLookupVariableInCountOperation, "Lookup variable in count operation") \
127 V(kMapBecameDeprecated, "Map became deprecated") \
128 V(kMapBecameUnstable, "Map became unstable") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000129 V(kNativeFunctionLiteral, "Native function literal") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000130 V(kNeedSmiLiteral, "Need a Smi literal here") \
131 V(kNoCasesLeft, "No cases left") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000132 V(kNonInitializerAssignmentToConst, "Non-initializer assignment to const") \
133 V(kNonSmiIndex, "Non-smi index") \
134 V(kNonSmiKeyInArrayLiteral, "Non-smi key in array literal") \
135 V(kNonSmiValue, "Non-smi value") \
136 V(kNonObject, "Non-object value") \
137 V(kNotEnoughVirtualRegistersForValues, \
138 "Not enough virtual registers for values") \
139 V(kNotEnoughSpillSlotsForOsr, "Not enough spill slots for OSR") \
140 V(kNotEnoughVirtualRegistersRegalloc, \
141 "Not enough virtual registers (regalloc)") \
142 V(kObjectFoundInSmiOnlyArray, "Object found in smi-only array") \
143 V(kObjectLiteralWithComplexProperty, "Object literal with complex property") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000144 V(kOffsetOutOfRange, "Offset out of range") \
Ben Murdochda12d292016-06-02 14:46:10 +0100145 V(kOperandIsANumber, "Operand is a number") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000146 V(kOperandIsASmiAndNotABoundFunction, \
147 "Operand is a smi and not a bound function") \
148 V(kOperandIsASmiAndNotAFunction, "Operand is a smi and not a function") \
Ben Murdochc5610432016-08-08 18:44:38 +0100149 V(kOperandIsASmiAndNotAGeneratorObject, \
150 "Operand is a smi and not a generator object") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000151 V(kOperandIsASmiAndNotAName, "Operand is a smi and not a name") \
Ben Murdoch097c5b22016-05-18 11:27:45 +0100152 V(kOperandIsASmiAndNotAReceiver, "Operand is a smi and not a receiver") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000153 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(kOperandIsNotABoundFunction, "Operand is not a bound function") \
156 V(kOperandIsNotAFunction, "Operand is not a function") \
Ben Murdochc5610432016-08-08 18:44:38 +0100157 V(kOperandIsNotAGeneratorObject, "Operand is not a generator object") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000158 V(kOperandIsNotAName, "Operand is not a name") \
159 V(kOperandIsNotANumber, "Operand is not a number") \
Ben Murdoch097c5b22016-05-18 11:27:45 +0100160 V(kOperandIsNotAReceiver, "Operand is not a receiver") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000161 V(kOperandIsNotASmi, "Operand is not a smi") \
162 V(kOperandIsNotAString, "Operand is not a string") \
163 V(kOperandIsNotSmi, "Operand is not smi") \
164 V(kOperandNotANumber, "Operand not a number") \
165 V(kObjectTagged, "The object is tagged") \
166 V(kObjectNotTagged, "The object is not tagged") \
Ben Murdochc5610432016-08-08 18:44:38 +0100167 V(kOptimizationDisabled, "Optimization disabled") \
168 V(kOptimizationDisabledForTest, "Optimization disabled for test") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000169 V(kOptimizedTooManyTimes, "Optimized too many times") \
170 V(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister, \
171 "Out of virtual registers while trying to allocate temp register") \
172 V(kParseScopeError, "Parse/scope error") \
173 V(kPossibleDirectCallToEval, "Possible direct call to eval") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000174 V(kReceivedInvalidReturnAddress, "Received invalid return address") \
175 V(kReferenceToAVariableWhichRequiresDynamicLookup, \
176 "Reference to a variable which requires dynamic lookup") \
177 V(kReferenceToGlobalLexicalVariable, "Reference to global lexical variable") \
178 V(kReferenceToUninitializedVariable, "Reference to uninitialized variable") \
179 V(kRegisterDidNotMatchExpectedRoot, "Register did not match expected root") \
180 V(kRegisterWasClobbered, "Register was clobbered") \
181 V(kRememberedSetPointerInNewSpace, "Remembered set pointer is in new space") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000182 V(kRestParameter, "Rest parameters") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000183 V(kReturnAddressNotFoundInFrame, "Return address not found in frame") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000184 V(kSloppyFunctionExpectsJSReceiverReceiver, \
185 "Sloppy function expects JSReceiver as receiver.") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000186 V(kSmiAdditionOverflow, "Smi addition overflow") \
187 V(kSmiSubtractionOverflow, "Smi subtraction overflow") \
188 V(kStackAccessBelowStackPointer, "Stack access below stack pointer") \
189 V(kStackFrameTypesMustMatch, "Stack frame types must match") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000190 V(kSuperReference, "Super reference") \
Ben Murdoch097c5b22016-05-18 11:27:45 +0100191 V(kTailCall, "Tail call") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000192 V(kTheCurrentStackPointerIsBelowCsp, \
193 "The current stack pointer is below csp") \
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") \
Ben Murdochda12d292016-06-02 14:46:10 +0100235 V(kUnexpectedFunctionIDForInvokeIntrinsic, \
236 "Unexpected runtime function id for the InvokeIntrinsic bytecode") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000237 V(kUnexpectedFPCRMode, "Unexpected FPCR mode.") \
238 V(kUnexpectedSmi, "Unexpected smi value") \
Ben Murdoch097c5b22016-05-18 11:27:45 +0100239 V(kUnexpectedStackDepth, "Unexpected operand stack depth in full-codegen") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000240 V(kUnexpectedStackPointer, "The stack pointer is not the expected value") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000241 V(kUnexpectedStringType, "Unexpected string type") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000242 V(kUnexpectedTypeForRegExpDataFixedArrayExpected, \
243 "Unexpected type for RegExp data, FixedArray expected") \
244 V(kUnexpectedValue, "Unexpected value") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000245 V(kUnsupportedConstCompoundAssignment, \
246 "Unsupported const compound assignment") \
247 V(kUnsupportedCountOperationWithConst, \
248 "Unsupported count operation with const") \
249 V(kUnsupportedDoubleImmediate, "Unsupported double immediate") \
250 V(kUnsupportedLetCompoundAssignment, "Unsupported let compound assignment") \
251 V(kUnsupportedLookupSlotInDeclaration, \
252 "Unsupported lookup slot in declaration") \
253 V(kUnsupportedNonPrimitiveCompare, "Unsupported non-primitive compare") \
254 V(kUnsupportedPhiUseOfArguments, "Unsupported phi use of arguments") \
255 V(kUnsupportedPhiUseOfConstVariable, \
Ben Murdochda12d292016-06-02 14:46:10 +0100256 "Unsupported phi use of const or let variable") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000257 V(kUnexpectedReturnFromThrow, "Unexpectedly returned from a throw") \
258 V(kUnsupportedSwitchStatement, "Unsupported switch statement") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000259 V(kUnsupportedTaggedImmediate, "Unsupported tagged immediate") \
260 V(kVariableResolvedToWithContext, "Variable resolved to with context") \
261 V(kWeShouldNotHaveAnEmptyLexicalContext, \
262 "We should not have an empty lexical context") \
263 V(kWithStatement, "WithStatement") \
264 V(kWrongFunctionContext, "Wrong context passed to function") \
265 V(kWrongAddressOrValuePassedToRecordWrite, \
266 "Wrong address or value passed to RecordWrite") \
Ben Murdochda12d292016-06-02 14:46:10 +0100267 V(kWrongArgumentCountForInvokeIntrinsic, \
268 "Wrong number of arguments for intrinsic") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000269 V(kShouldNotDirectlyEnterOsrFunction, \
Ben Murdoch61f157c2016-09-16 13:49:30 +0100270 "Should not directly enter OSR-compiled function")
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000271
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000272#define ERROR_MESSAGES_CONSTANTS(C, T) C,
273enum BailoutReason {
274 ERROR_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS) kLastErrorMessage
275};
276#undef ERROR_MESSAGES_CONSTANTS
277
278
279const char* GetBailoutReason(BailoutReason reason);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000280
281} // namespace internal
282} // namespace v8
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000283
284#endif // V8_BAILOUT_REASON_H_