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(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(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") \ 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(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") \ 42 V(kComputedPropertyName, "Computed property name") \ 43 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") \ 47 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") \ 56 V(kDoExpressionUnmodelable, \ 57 "Encountered a do-expression with unmodelable control statements") \ 58 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") \ 64 V(kExpectedAllocationSite, "Expected allocation site") \ 65 V(kExpectedBooleanValue, "Expected boolean value") \ 66 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") \ 72 V(kExpectedNewSpaceObject, "Expected new space object") \ 73 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") \ 78 V(kForInStatementWithNonLocalEachVariable, \ 79 "ForInStatement with non-local each variable") \ 80 V(kForOfStatement, "ForOfStatement") \ 81 V(kFunctionBeingDebugged, "Function is being debugged") \ 82 V(kFunctionCallsEval, "Function calls eval") \ 83 V(kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, \ 84 "The function_data field should be a BytecodeArray on interpreter entry") \ 85 V(kGeneratedCodeIsTooLarge, "Generated code is too large") \ 86 V(kGenerator, "Generator") \ 87 V(kGlobalFunctionsMustHaveInitialMap, \ 88 "Global functions must have initial map") \ 89 V(kGraphBuildingFailed, "Optimized graph construction failed") \ 90 V(kHeapNumberMapRegisterClobbered, "HeapNumberMap register clobbered") \ 91 V(kHydrogenFilter, "Optimization disabled by filter") \ 92 V(kImportDeclaration, "Import declaration") \ 93 V(kIndexIsNegative, "Index is negative") \ 94 V(kIndexIsTooLarge, "Index is too large") \ 95 V(kInliningBailedOut, "Inlining bailed out") \ 96 V(kInputGPRIsExpectedToHaveUpper32Cleared, \ 97 "Input GPR is expected to have upper32 cleared") \ 98 V(kInputStringTooLong, "Input string too long") \ 99 V(kInteger32ToSmiFieldWritingToNonSmiLocation, \ 100 "Integer32ToSmiField writing to non-smi location") \ 101 V(kInvalidBytecode, "Invalid bytecode") \ 102 V(kInvalidElementsKindForInternalArrayOrInternalPackedArray, \ 103 "Invalid ElementsKind for InternalArray or InternalPackedArray") \ 104 V(kInvalidFrameForFastNewRestArgumentsStub, \ 105 "Invalid frame for FastNewRestArgumentsStub") \ 106 V(kInvalidFrameForFastNewSloppyArgumentsStub, \ 107 "Invalid frame for FastNewSloppyArgumentsStub") \ 108 V(kInvalidFrameForFastNewStrictArgumentsStub, \ 109 "Invalid frame for FastNewStrictArgumentsStub") \ 110 V(kInvalidFullCodegenState, "invalid full-codegen state") \ 111 V(kInvalidHandleScopeLevel, "Invalid HandleScope level") \ 112 V(kInvalidJumpTableIndex, "Invalid jump table index") \ 113 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") \ 117 V(kInvalidRegisterFileInGenerator, "invalid register file in generator") \ 118 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") \ 125 V(kLiveEdit, "LiveEdit") \ 126 V(kLookupVariableInCountOperation, "Lookup variable in count operation") \ 127 V(kMapBecameDeprecated, "Map became deprecated") \ 128 V(kMapBecameUnstable, "Map became unstable") \ 129 V(kNativeFunctionLiteral, "Native function literal") \ 130 V(kNeedSmiLiteral, "Need a Smi literal here") \ 131 V(kNoCasesLeft, "No cases left") \ 132 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") \ 144 V(kOffsetOutOfRange, "Offset out of range") \ 145 V(kOperandIsANumber, "Operand is a number") \ 146 V(kOperandIsASmiAndNotABoundFunction, \ 147 "Operand is a smi and not a bound function") \ 148 V(kOperandIsASmiAndNotAFunction, "Operand is a smi and not a function") \ 149 V(kOperandIsASmiAndNotAGeneratorObject, \ 150 "Operand is a smi and not a generator object") \ 151 V(kOperandIsASmiAndNotAName, "Operand is a smi and not a name") \ 152 V(kOperandIsASmiAndNotAReceiver, "Operand is a smi and not a receiver") \ 153 V(kOperandIsASmiAndNotAString, "Operand is a smi and not a string") \ 154 V(kOperandIsASmi, "Operand is a smi") \ 155 V(kOperandIsNotABoundFunction, "Operand is not a bound function") \ 156 V(kOperandIsNotAFunction, "Operand is not a function") \ 157 V(kOperandIsNotAGeneratorObject, "Operand is not a generator object") \ 158 V(kOperandIsNotAName, "Operand is not a name") \ 159 V(kOperandIsNotANumber, "Operand is not a number") \ 160 V(kOperandIsNotAReceiver, "Operand is not a receiver") \ 161 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") \ 167 V(kOptimizationDisabled, "Optimization disabled") \ 168 V(kOptimizationDisabledForTest, "Optimization disabled for test") \ 169 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") \ 174 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") \ 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(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, \ 256 "Unsupported phi use of const or let variable") \ 257 V(kUnexpectedReturnFromThrow, "Unexpectedly returned from a throw") \ 258 V(kUnsupportedSwitchStatement, "Unsupported switch statement") \ 259 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") \ 267 V(kWrongArgumentCountForInvokeIntrinsic, \ 268 "Wrong number of arguments for intrinsic") \ 269 V(kShouldNotDirectlyEnterOsrFunction, \ 270 "Should not directly enter OSR-compiled function") 271 272 #define ERROR_MESSAGES_CONSTANTS(C, T) C, 273 enum BailoutReason { 274 ERROR_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS) kLastErrorMessage 275 }; 276 #undef ERROR_MESSAGES_CONSTANTS 277 278 279 const char* GetBailoutReason(BailoutReason reason); 280 281 } // namespace internal 282 } // namespace v8 283 284 #endif // V8_BAILOUT_REASON_H_ 285