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