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 // TODO(svenpanne) introduce an AbortReason and partition this list 12 #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(kAllocatingNonEmptyPackedArray, "Allocating non-empty packed array") \ 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(kArrayIndexConstantValueTooBig, "Array index constant value too big") \ 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") \ 30 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") \ 36 V(kBothRegistersWereSmisInSelectNonSmi, \ 37 "Both registers were smis in SelectNonSmi") \ 38 V(kClassConstructorFunction, "Class constructor function") \ 39 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") \ 43 V(kComputedPropertyName, "Computed property name") \ 44 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") \ 48 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") \ 57 V(kDoExpressionUnmodelable, \ 58 "Encountered a do-expression with unmodelable control statements") \ 59 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(kCyclicObjectStateDetectedInEscapeAnalysis, \ 65 "Cyclic object state detected by escape analysis") \ 66 V(kEval, "eval") \ 67 V(kExpectedAllocationSite, "Expected allocation site") \ 68 V(kExpectedBooleanValue, "Expected boolean value") \ 69 V(kExpectedFixedDoubleArrayMap, \ 70 "Expected a fixed double array map in fast shallow clone array literal") \ 71 V(kExpectedFunctionObject, "Expected function object in register") \ 72 V(kExpectedHeapNumber, "Expected HeapNumber") \ 73 V(kExpectedJSReceiver, "Expected object to have receiver type") \ 74 V(kExpectedNativeContext, "Expected native context") \ 75 V(kExpectedNonIdenticalObjects, "Expected non-identical objects") \ 76 V(kExpectedNonNullContext, "Expected non-null context") \ 77 V(kExpectedPositiveZero, "Expected +0.0") \ 78 V(kExpectedNewSpaceObject, "Expected new space object") \ 79 V(kExpectedUndefinedOrCell, "Expected undefined or cell in register") \ 80 V(kExternalStringExpectedButNotFound, \ 81 "External string expected, but not found") \ 82 V(kForInStatementWithNonLocalEachVariable, \ 83 "ForInStatement with non-local each variable") \ 84 V(kForOfStatement, "ForOfStatement") \ 85 V(kFunctionBeingDebugged, "Function is being debugged") \ 86 V(kFunctionCallsEval, "Function calls eval") \ 87 V(kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, \ 88 "The function_data field should be a BytecodeArray on interpreter entry") \ 89 V(kGeneratedCodeIsTooLarge, "Generated code is too large") \ 90 V(kGenerator, "Generator") \ 91 V(kGlobalFunctionsMustHaveInitialMap, \ 92 "Global functions must have initial map") \ 93 V(kGraphBuildingFailed, "Optimized graph construction failed") \ 94 V(kHeapNumberMapRegisterClobbered, "HeapNumberMap register clobbered") \ 95 V(kHydrogenFilter, "Optimization disabled by filter") \ 96 V(kIndexIsNegative, "Index is negative") \ 97 V(kIndexIsTooLarge, "Index is too large") \ 98 V(kInliningBailedOut, "Inlining bailed out") \ 99 V(kInputGPRIsExpectedToHaveUpper32Cleared, \ 100 "Input GPR is expected to have upper32 cleared") \ 101 V(kInputStringTooLong, "Input string too long") \ 102 V(kInteger32ToSmiFieldWritingToNonSmiLocation, \ 103 "Integer32ToSmiField writing to non-smi location") \ 104 V(kInvalidBytecode, "Invalid bytecode") \ 105 V(kInvalidElementsKindForInternalArrayOrInternalPackedArray, \ 106 "Invalid ElementsKind for InternalArray or InternalPackedArray") \ 107 V(kInvalidFrameForFastNewRestArgumentsStub, \ 108 "Invalid frame for FastNewRestArgumentsStub") \ 109 V(kInvalidFrameForFastNewSloppyArgumentsStub, \ 110 "Invalid frame for FastNewSloppyArgumentsStub") \ 111 V(kInvalidFrameForFastNewStrictArgumentsStub, \ 112 "Invalid frame for FastNewStrictArgumentsStub") \ 113 V(kInvalidFullCodegenState, "invalid full-codegen state") \ 114 V(kInvalidHandleScopeLevel, "Invalid HandleScope level") \ 115 V(kInvalidJumpTableIndex, "Invalid jump table index") \ 116 V(kInvalidLeftHandSideInAssignment, "Invalid left-hand side in assignment") \ 117 V(kInvalidLhsInCompoundAssignment, "Invalid lhs in compound assignment") \ 118 V(kInvalidLhsInCountOperation, "Invalid lhs in count operation") \ 119 V(kInvalidMinLength, "Invalid min_length") \ 120 V(kInvalidRegisterFileInGenerator, "invalid register file in generator") \ 121 V(kJSObjectWithFastElementsMapHasSlowElements, \ 122 "JSObject with fast elements map has slow elements") \ 123 V(kLetBindingReInitialization, "Let binding re-initialization") \ 124 V(kLiveEdit, "LiveEdit") \ 125 V(kLookupVariableInCountOperation, "Lookup variable in count operation") \ 126 V(kMapBecameDeprecated, "Map became deprecated") \ 127 V(kMapBecameUnstable, "Map became unstable") \ 128 V(kNativeFunctionLiteral, "Native function literal") \ 129 V(kNeedSmiLiteral, "Need a Smi literal here") \ 130 V(kNoCasesLeft, "No cases left") \ 131 V(kNonInitializerAssignmentToConst, "Non-initializer assignment to const") \ 132 V(kNonSmiIndex, "Non-smi index") \ 133 V(kNonSmiKeyInArrayLiteral, "Non-smi key in array literal") \ 134 V(kNonSmiValue, "Non-smi value") \ 135 V(kNonObject, "Non-object value") \ 136 V(kNotEnoughVirtualRegistersForValues, \ 137 "Not enough virtual registers for values") \ 138 V(kNotEnoughSpillSlotsForOsr, "Not enough spill slots for OSR") \ 139 V(kNotEnoughVirtualRegistersRegalloc, \ 140 "Not enough virtual registers (regalloc)") \ 141 V(kObjectFoundInSmiOnlyArray, "Object found in smi-only array") \ 142 V(kObjectLiteralWithComplexProperty, "Object literal with complex property") \ 143 V(kOffsetOutOfRange, "Offset out of range") \ 144 V(kOperandIsANumber, "Operand is a number") \ 145 V(kOperandIsASmiAndNotABoundFunction, \ 146 "Operand is a smi and not a bound function") \ 147 V(kOperandIsASmiAndNotAFunction, "Operand is a smi and not a function") \ 148 V(kOperandIsASmiAndNotAGeneratorObject, \ 149 "Operand is a smi and not a generator object") \ 150 V(kOperandIsASmiAndNotAName, "Operand is a smi and not a name") \ 151 V(kOperandIsASmiAndNotAReceiver, "Operand is a smi and not a receiver") \ 152 V(kOperandIsASmiAndNotAString, "Operand is a smi and not a string") \ 153 V(kOperandIsASmi, "Operand is a smi") \ 154 V(kOperandIsNotABoundFunction, "Operand is not a bound function") \ 155 V(kOperandIsNotAFunction, "Operand is not a function") \ 156 V(kOperandIsNotAGeneratorObject, "Operand is not a generator object") \ 157 V(kOperandIsNotAName, "Operand is not a name") \ 158 V(kOperandIsNotANumber, "Operand is not a number") \ 159 V(kOperandIsNotAReceiver, "Operand is not a receiver") \ 160 V(kOperandIsNotASmi, "Operand is not a smi") \ 161 V(kOperandIsNotAString, "Operand is not a string") \ 162 V(kOperandIsNotSmi, "Operand is not smi") \ 163 V(kOperandNotANumber, "Operand not a number") \ 164 V(kObjectTagged, "The object is tagged") \ 165 V(kObjectNotTagged, "The object is not tagged") \ 166 V(kOptimizationDisabled, "Optimization disabled") \ 167 V(kOptimizationDisabledForTest, "Optimization disabled for test") \ 168 V(kOptimizedTooManyTimes, "Optimized too many times") \ 169 V(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister, \ 170 "Out of virtual registers while trying to allocate temp register") \ 171 V(kParseScopeError, "Parse/scope error") \ 172 V(kPossibleDirectCallToEval, "Possible direct call to eval") \ 173 V(kReceivedInvalidReturnAddress, "Received invalid return address") \ 174 V(kReferenceToAVariableWhichRequiresDynamicLookup, \ 175 "Reference to a variable which requires dynamic lookup") \ 176 V(kReferenceToGlobalLexicalVariable, "Reference to global lexical variable") \ 177 V(kReferenceToModuleVariable, "Reference to module-allocated 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") \ 182 V(kRestParameter, "Rest parameters") \ 183 V(kReturnAddressNotFoundInFrame, "Return address not found in frame") \ 184 V(kSloppyFunctionExpectsJSReceiverReceiver, \ 185 "Sloppy function expects JSReceiver as receiver.") \ 186 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") \ 190 V(kSuperReference, "Super reference") \ 191 V(kTailCall, "Tail call") \ 192 V(kTheCurrentStackPointerIsBelowCsp, \ 193 "The current stack pointer is below csp") \ 194 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") \ 206 V(kUnalignedAllocationInNewSpace, "Unaligned allocation in new space") \ 207 V(kUnalignedCellInWriteBarrier, "Unaligned cell in write barrier") \ 208 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") \ 218 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") \ 235 V(kUnexpectedFunctionIDForInvokeIntrinsic, \ 236 "Unexpected runtime function id for the InvokeIntrinsic bytecode") \ 237 V(kUnexpectedFPCRMode, "Unexpected FPCR mode.") \ 238 V(kUnexpectedSmi, "Unexpected smi value") \ 239 V(kUnexpectedStackDepth, "Unexpected operand stack depth in full-codegen") \ 240 V(kUnexpectedStackPointer, "The stack pointer is not the expected value") \ 241 V(kUnexpectedStringType, "Unexpected string type") \ 242 V(kUnexpectedTypeForRegExpDataFixedArrayExpected, \ 243 "Unexpected type for RegExp data, FixedArray expected") \ 244 V(kUnexpectedValue, "Unexpected value") \ 245 V(kUnsupportedDoubleImmediate, "Unsupported double immediate") \ 246 V(kUnsupportedLetCompoundAssignment, "Unsupported let compound assignment") \ 247 V(kUnsupportedLookupSlotInDeclaration, \ 248 "Unsupported lookup slot in declaration") \ 249 V(kUnsupportedModuleOperation, "Unsupported module operation") \ 250 V(kUnsupportedNonPrimitiveCompare, "Unsupported non-primitive compare") \ 251 V(kUnsupportedPhiUseOfArguments, "Unsupported phi use of arguments") \ 252 V(kUnsupportedPhiUseOfConstVariable, \ 253 "Unsupported phi use of const or let variable") \ 254 V(kUnexpectedReturnFromThrow, "Unexpectedly returned from a throw") \ 255 V(kUnsupportedSwitchStatement, "Unsupported switch statement") \ 256 V(kUnsupportedTaggedImmediate, "Unsupported tagged immediate") \ 257 V(kUnstableConstantTypeHeapObject, "Unstable constant-type heap object") \ 258 V(kVariableResolvedToWithContext, "Variable resolved to with context") \ 259 V(kWithStatement, "WithStatement") \ 260 V(kWrongFunctionContext, "Wrong context passed to function") \ 261 V(kWrongAddressOrValuePassedToRecordWrite, \ 262 "Wrong address or value passed to RecordWrite") \ 263 V(kWrongArgumentCountForInvokeIntrinsic, \ 264 "Wrong number of arguments for intrinsic") \ 265 V(kShouldNotDirectlyEnterOsrFunction, \ 266 "Should not directly enter OSR-compiled function") 267 268 #define ERROR_MESSAGES_CONSTANTS(C, T) C, 269 enum BailoutReason { 270 ERROR_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS) kLastErrorMessage 271 }; 272 #undef ERROR_MESSAGES_CONSTANTS 273 274 275 const char* GetBailoutReason(BailoutReason reason); 276 277 } // namespace internal 278 } // namespace v8 279 280 #endif // V8_BAILOUT_REASON_H_ 281