blob: 92929cf38c24bbbe96f6bc6c2594cdfaaef3fa51 [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") \
21 V(kArrayBoilerplateCreationFailed, "Array boilerplate creation failed") \
22 V(kArrayIndexConstantValueTooBig, "Array index constant value too big") \
23 V(kAssignmentToArguments, "Assignment to arguments") \
24 V(kAssignmentToLetVariableBeforeInitialization, \
25 "Assignment to let variable before initialization") \
26 V(kAssignmentToLOOKUPVariable, "Assignment to LOOKUP variable") \
27 V(kAssignmentToParameterFunctionUsesArgumentsObject, \
28 "Assignment to parameter, function uses arguments object") \
29 V(kAssignmentToParameterInArgumentsObject, \
30 "Assignment to parameter in arguments object") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000031 V(kBadValueContextForArgumentsObjectValue, \
32 "Bad value context for arguments object value") \
33 V(kBadValueContextForArgumentsValue, \
34 "Bad value context for arguments value") \
35 V(kBailedOutDueToDependencyChange, "Bailed out due to dependency change") \
36 V(kBailoutWasNotPrepared, "Bailout was not prepared") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000037 V(kBothRegistersWereSmisInSelectNonSmi, \
38 "Both registers were smis in SelectNonSmi") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000039 V(kClassLiteral, "Class literal") \
40 V(kCodeGenerationFailed, "Code generation failed") \
41 V(kCodeObjectNotProperlyPatched, "Code object not properly patched") \
42 V(kCompoundAssignmentToLookupSlot, "Compound assignment to lookup slot") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000043 V(kComputedPropertyName, "Computed property name") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000044 V(kContextAllocatedArguments, "Context-allocated arguments") \
45 V(kCopyBuffersOverlap, "Copy buffers overlap") \
46 V(kCouldNotGenerateZero, "Could not generate +0.0") \
47 V(kCouldNotGenerateNegativeZero, "Could not generate -0.0") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000048 V(kDebuggerStatement, "DebuggerStatement") \
49 V(kDeclarationInCatchContext, "Declaration in catch context") \
50 V(kDeclarationInWithContext, "Declaration in with context") \
51 V(kDefaultNaNModeNotSet, "Default NaN mode not set") \
52 V(kDeleteWithGlobalVariable, "Delete with global variable") \
53 V(kDeleteWithNonGlobalVariable, "Delete with non-global variable") \
54 V(kDestinationOfCopyNotAligned, "Destination of copy not aligned") \
55 V(kDontDeleteCellsCannotContainTheHole, \
56 "DontDelete cells can't contain the hole") \
Ben Murdochda12d292016-06-02 14:46:10 +010057 V(kDoExpressionUnmodelable, \
58 "Encountered a do-expression with unmodelable control statements") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000059 V(kDoPushArgumentNotImplementedForDoubleType, \
60 "DoPushArgument not implemented for double type") \
61 V(kEliminatedBoundsCheckFailed, "Eliminated bounds check failed") \
62 V(kEmitLoadRegisterUnsupportedDoubleImmediate, \
63 "EmitLoadRegister: Unsupported double immediate") \
64 V(kEval, "eval") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000065 V(kExpectedAlignmentMarker, "Expected alignment marker") \
66 V(kExpectedAllocationSite, "Expected allocation site") \
67 V(kExpectedFunctionObject, "Expected function object in register") \
68 V(kExpectedHeapNumber, "Expected HeapNumber") \
69 V(kExpectedNativeContext, "Expected native context") \
70 V(kExpectedNonIdenticalObjects, "Expected non-identical objects") \
71 V(kExpectedNonNullContext, "Expected non-null context") \
72 V(kExpectedPositiveZero, "Expected +0.0") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000073 V(kExpectedNewSpaceObject, "Expected new space object") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000074 V(kExpectedUndefinedOrCell, "Expected undefined or cell in register") \
75 V(kExpectingAlignmentForCopyBytes, "Expecting alignment for CopyBytes") \
76 V(kExportDeclaration, "Export declaration") \
77 V(kExternalStringExpectedButNotFound, \
78 "External string expected, but not found") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000079 V(kForInStatementWithNonLocalEachVariable, \
80 "ForInStatement with non-local each variable") \
81 V(kForOfStatement, "ForOfStatement") \
82 V(kFrameIsExpectedToBeAligned, "Frame is expected to be aligned") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000083 V(kFunctionBeingDebugged, "Function is being debugged") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000084 V(kFunctionCallsEval, "Function calls eval") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000085 V(kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, \
86 "The function_data field should be a BytecodeArray on interpreter entry") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000087 V(kGeneratedCodeIsTooLarge, "Generated code is too large") \
88 V(kGeneratorFailedToResume, "Generator failed to resume") \
Ben Murdochda12d292016-06-02 14:46:10 +010089 V(kGeneratorResumeMethod, "Generator resume method is being called") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000090 V(kGenerator, "Generator") \
91 V(kGlobalFunctionsMustHaveInitialMap, \
92 "Global functions must have initial map") \
93 V(kHeapNumberMapRegisterClobbered, "HeapNumberMap register clobbered") \
94 V(kHydrogenFilter, "Optimization disabled by filter") \
95 V(kImportDeclaration, "Import declaration") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000096 V(kIndexIsNegative, "Index is negative") \
97 V(kIndexIsTooLarge, "Index is too large") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +000098 V(kInliningBailedOut, "Inlining bailed out") \
99 V(kInputGPRIsExpectedToHaveUpper32Cleared, \
100 "Input GPR is expected to have upper32 cleared") \
101 V(kInputStringTooLong, "Input string too long") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000102 V(kInteger32ToSmiFieldWritingToNonSmiLocation, \
103 "Integer32ToSmiField writing to non-smi location") \
Ben Murdochda12d292016-06-02 14:46:10 +0100104 V(kInvalidBytecode, "Invalid bytecode") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000105 V(kInvalidCaptureReferenced, "Invalid capture referenced") \
106 V(kInvalidElementsKindForInternalArrayOrInternalPackedArray, \
107 "Invalid ElementsKind for InternalArray or InternalPackedArray") \
108 V(kInvalidFullCodegenState, "invalid full-codegen state") \
109 V(kInvalidHandleScopeLevel, "Invalid HandleScope level") \
110 V(kInvalidLeftHandSideInAssignment, "Invalid left-hand side in assignment") \
111 V(kInvalidLhsInCompoundAssignment, "Invalid lhs in compound assignment") \
112 V(kInvalidLhsInCountOperation, "Invalid lhs in count operation") \
113 V(kInvalidMinLength, "Invalid min_length") \
114 V(kJSGlobalObjectNativeContextShouldBeANativeContext, \
115 "JSGlobalObject::native_context should be a native context") \
116 V(kJSGlobalProxyContextShouldNotBeNull, \
117 "JSGlobalProxy::context() should not be null") \
118 V(kJSObjectWithFastElementsMapHasSlowElements, \
119 "JSObject with fast elements map has slow elements") \
120 V(kLetBindingReInitialization, "Let binding re-initialization") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000121 V(kLiveBytesCountOverflowChunkSize, "Live Bytes Count overflow chunk size") \
122 V(kLiveEdit, "LiveEdit") \
123 V(kLookupVariableInCountOperation, "Lookup variable in count operation") \
124 V(kMapBecameDeprecated, "Map became deprecated") \
125 V(kMapBecameUnstable, "Map became unstable") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000126 V(kNativeFunctionLiteral, "Native function literal") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000127 V(kNeedSmiLiteral, "Need a Smi literal here") \
128 V(kNoCasesLeft, "No cases left") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000129 V(kNonInitializerAssignmentToConst, "Non-initializer assignment to const") \
130 V(kNonSmiIndex, "Non-smi index") \
131 V(kNonSmiKeyInArrayLiteral, "Non-smi key in array literal") \
132 V(kNonSmiValue, "Non-smi value") \
133 V(kNonObject, "Non-object value") \
134 V(kNotEnoughVirtualRegistersForValues, \
135 "Not enough virtual registers for values") \
136 V(kNotEnoughSpillSlotsForOsr, "Not enough spill slots for OSR") \
137 V(kNotEnoughVirtualRegistersRegalloc, \
138 "Not enough virtual registers (regalloc)") \
139 V(kObjectFoundInSmiOnlyArray, "Object found in smi-only array") \
140 V(kObjectLiteralWithComplexProperty, "Object literal with complex property") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000141 V(kOffsetOutOfRange, "Offset out of range") \
Ben Murdochda12d292016-06-02 14:46:10 +0100142 V(kOperandIsANumber, "Operand is a number") \
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") \
Ben Murdochda12d292016-06-02 14:46:10 +0100233 V(kUnexpectedFunctionIDForInvokeIntrinsic, \
234 "Unexpected runtime function id for the InvokeIntrinsic bytecode") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000235 V(kUnexpectedFPCRMode, "Unexpected FPCR mode.") \
236 V(kUnexpectedSmi, "Unexpected smi value") \
Ben Murdoch097c5b22016-05-18 11:27:45 +0100237 V(kUnexpectedStackDepth, "Unexpected operand stack depth in full-codegen") \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000238 V(kUnexpectedStackPointer, "The stack pointer is not the expected value") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000239 V(kUnexpectedStringType, "Unexpected string type") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000240 V(kUnexpectedTypeForRegExpDataFixedArrayExpected, \
241 "Unexpected type for RegExp data, FixedArray expected") \
242 V(kUnexpectedValue, "Unexpected value") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000243 V(kUnsupportedConstCompoundAssignment, \
244 "Unsupported const compound assignment") \
245 V(kUnsupportedCountOperationWithConst, \
246 "Unsupported count operation with const") \
247 V(kUnsupportedDoubleImmediate, "Unsupported double immediate") \
248 V(kUnsupportedLetCompoundAssignment, "Unsupported let compound assignment") \
249 V(kUnsupportedLookupSlotInDeclaration, \
250 "Unsupported lookup slot in declaration") \
251 V(kUnsupportedNonPrimitiveCompare, "Unsupported non-primitive compare") \
252 V(kUnsupportedPhiUseOfArguments, "Unsupported phi use of arguments") \
253 V(kUnsupportedPhiUseOfConstVariable, \
Ben Murdochda12d292016-06-02 14:46:10 +0100254 "Unsupported phi use of const or let variable") \
Ben Murdoch097c5b22016-05-18 11:27:45 +0100255 V(kUnexpectedReturnFromBytecodeHandler, \
256 "Unexpectedly returned from a bytecode handler") \
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, \
270 "Should not directly enter OSR-compiled function") \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000271 V(kYield, "Yield")
272
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000273#define ERROR_MESSAGES_CONSTANTS(C, T) C,
274enum BailoutReason {
275 ERROR_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS) kLastErrorMessage
276};
277#undef ERROR_MESSAGES_CONSTANTS
278
279
280const char* GetBailoutReason(BailoutReason reason);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000281
282} // namespace internal
283} // namespace v8
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000284
285#endif // V8_BAILOUT_REASON_H_