Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: src/objects.h

Issue 20843012: Extract hardcoded error strings into a single place and replace them with enum. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: enum was converted into standard v8 macro Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 V(MapCache) \ 1039 V(MapCache) \
1040 V(Primitive) \ 1040 V(Primitive) \
1041 V(GlobalObject) \ 1041 V(GlobalObject) \
1042 V(JSGlobalObject) \ 1042 V(JSGlobalObject) \
1043 V(JSBuiltinsObject) \ 1043 V(JSBuiltinsObject) \
1044 V(JSGlobalProxy) \ 1044 V(JSGlobalProxy) \
1045 V(UndetectableObject) \ 1045 V(UndetectableObject) \
1046 V(AccessCheckNeeded) \ 1046 V(AccessCheckNeeded) \
1047 V(Cell) \ 1047 V(Cell) \
1048 V(PropertyCell) \ 1048 V(PropertyCell) \
1049 V(ObjectHashTable) \ 1049 V(ObjectHashTable)
1050
1051
1052 #define ERROR_MESSAGES_LIST(V) \
1053 V(kNoReason, "no reason") \
1054 \
1055 V(k32BitValueInRegisterIsNotZeroExtended, "32 bit value in register is not zer o-extended") \
1056 V(kAlignmentMarkerExpected, "alignment marker expected") \
1057 V(kAllocationIsNotDoubleAligned, "Allocation is not double aligned") \
1058 V(kAPICallReturnedInvalidObject, "API call returned invalid object") \
1059 V(kArgumentsObjectValueInATestContext, "arguments object value in a test conte xt") \
1060 V(kArrayBoilerplateCreationFailed, "array boilerplate creation failed") \
1061 V(kArrayIndexConstantValueTooBig, "array index constant value too big") \
1062 V(kAssignmentToArguments, "assignment to arguments") \
1063 V(kAssignmentToLetVariableBeforeInitialization, "assignment to let variable be fore initialization") \
1064 V(kAssignmentToLOOKUPVariable, "assignment to LOOKUP variable") \
1065 V(kAssignmentToParameterFunctionUsesArgumentsObject, "assignment to parameter, function uses arguments object") \
1066 V(kAssignmentToParameterInArgumentsObject, "assignment to parameter in argumen ts object") \
1067 V(kAttemptToUseUndefinedCache, "Attempt to use undefined cache") \
1068 V(kBadValueContextForArgumentsObjectValue, "bad value context for arguments ob ject value") \
1069 V(kBadValueContextForArgumentsValue, "bad value context for arguments value") \
1070 V(kBailedOutDueToDependentMap, "bailed out due to dependent map") \
1071 V(kBailoutWasNotPrepared, "bailout was not prepared") \
1072 V(kBinaryStubGenerateFloatingPointCode, "BinaryStub_GenerateFloatingPointCode. ") \
1073 V(kBothRegistersWereSmisInSelectNonSmi, "Both registers were smis in SelectNon Smi") \
1074 V(kCallToAJavaScriptRuntimeFunction, "call to a JavaScript runtime function") \
1075 V(kCannotTranslatePositionInChangedArea, "Cannot translate position in changed area") \
1076 V(kCodeGenerationFailed, "code generation failed") \
1077 V(kCodeObjectNotProperlyPatched, "code object not properly patched") \
1078 V(kCompoundAssignmentToLookupSlot, "compound assignment to lookup slot") \
1079 V(kContextAllocatedArguments, "context-allocated arguments") \
1080 V(kDebuggerIsActive, "debugger is active") \
1081 V(kDebuggerStatement, "DebuggerStatement") \
1082 V(kDeclarationInCatchContext, "Declaration in catch context") \
1083 V(kDeclarationInWithContext, "Declaration in with context") \
1084 V(kDefaultNaNModeNotSet, "Default NaN mode not set") \
1085 V(kDeleteWithGlobalVariable, "delete with global variable") \
1086 V(kDeleteWithNonGlobalVariable, "delete with non-global variable") \
1087 V(kDestinationOfCopyNotAligned, "Destination of copy not aligned.") \
1088 V(kDontDeleteCellsCanTContainTheHole, "DontDelete cells can't contain the hole ") \
1089 V(kDoPushArgumentNotImplementedForDoubleType, "DoPushArgument not implemented for double type") \
1090 V(kEmitLoadRegisterUnsupportedDoubleImmediate, "EmitLoadRegister: Unsupported double immediate") \
1091 V(kEval, "eval") \
1092 V(kExpected0AsASmiSentinel, "Expected 0 as a Smi sentinel") \
1093 V(kExpectedAlignmentMarker, "expected alignment marker") \
1094 V(kExpectedPropertyCellInRegisterA2, "Expected property cell in register a2") \
1095 V(kExpectedPropertyCellInRegisterEbx, "Expected property cell in register ebx" ) \
1096 V(kExpectedPropertyCellInRegisterRbx, "Expected property cell in register rbx" ) \
1097 V(kExpectingAlignmentForCopyBytes, "Expecting alignment for CopyBytes") \
1098 V(kExternalStringExpectedButNotFound, "external string expected, but not found ") \
1099 V(kFailedBailedOutLastTime, "failed/bailed out last time") \
1100 V(kForInStatementIsNotFastCase, "ForInStatement is not fast case") \
1101 V(kForInStatementOptimizationIsDisabled, "ForInStatement optimization is disab led") \
1102 V(kForInStatementWithNonLocalEachVariable, "ForInStatement with non-local each variable") \
1103 V(kForOfStatement, "ForOfStatement") \
1104 V(kFrameIsExpectedToBeAligned, "frame is expected to be aligned") \
1105 V(kFunctionCallsEval, "function calls eval") \
1106 V(kFunctionIsAGenerator, "function is a generator") \
1107 V(kFunctionWithIllegalRedeclaration, "function with illegal redeclaration") \
1108 V(kGeneratedCodeIsTooLarge, "Generated code is too large") \
1109 V(kGeneratorFailedToResume, "Generator failed to resume") \
1110 V(kGenerator, "generator") \
1111 V(kGlobalFunctionsMustHaveInitialMap, "Global functions must have initial map" ) \
1112 V(kHeapNumberMapRegisterClobbered, "HeapNumberMap register clobbered") \
1113 V(kImproperObjectOnPrototypeChainForStore, "improper object on prototype chain for store") \
1114 V(kIndexIsNegative, "Index is negative") \
1115 V(kIndexIsTooLarge, "Index is too large") \
1116 V(kInlinedRuntimeFunctionClassOf, "inlined runtime function: ClassOf") \
1117 V(kInlinedRuntimeFunctionFastAsciiArrayJoin, "inlined runtime function: FastAs ciiArrayJoin") \
1118 V(kInlinedRuntimeFunctionGeneratorNext, "inlined runtime function: GeneratorNe xt") \
1119 V(kInlinedRuntimeFunctionGeneratorThrow, "inlined runtime function: GeneratorT hrow") \
1120 V(kInlinedRuntimeFunctionGetFromCache, "inlined runtime function: GetFromCache ") \
1121 V(kInlinedRuntimeFunctionIsNonNegativeSmi, "inlined runtime function: IsNonNeg ativeSmi") \
1122 V(kInlinedRuntimeFunctionIsRegExpEquivalent, "inlined runtime function: IsRegE xpEquivalent") \
1123 V(kInlinedRuntimeFunctionIsStringWrapperSafeForDefaultValueOf, "inlined runtim e function: IsStringWrapperSafeForDefaultValueOf") \
alph 2013/08/01 10:35:50 80 chars
loislo 2013/08/01 13:15:30 Done.
1124 V(kInliningBailedOut, "inlining bailed out") \
1125 V(kInputGPRIsExpectedToHaveUpper32Cleared, "input GPR is expected to have uppe r32 cleared") \
1126 V(kInstanceofStubUnexpectedCallSiteCacheCheck, "InstanceofStub unexpected call site cache (check)") \
1127 V(kInstanceofStubUnexpectedCallSiteCacheCmp1, "InstanceofStub unexpected call site cache (cmp 1)") \
1128 V(kInstanceofStubUnexpectedCallSiteCacheCmp2, "InstanceofStub unexpected call site cache (cmp 2)") \
1129 V(kInstanceofStubUnexpectedCallSiteCacheMov, "InstanceofStub unexpected call s ite cache (mov)") \
1130 V(kInteger32ToSmiFieldWritingToNonSmiLocation, "Integer32ToSmiField writing to non-smi location") \
1131 V(kInvalidCaptureReferenced, "Invalid capture referenced") \
1132 V(kInvalidElementsKindForInternalArrayOrInternalPackedArray, "Invalid Elements Kind for InternalArray or InternalPackedArray") \
1133 V(kInvalidHandleScopeLevel, "Invalid HandleScope level") \
1134 V(kInvalidLeftHandSideInAssignment, "invalid left-hand side in assignment") \
1135 V(kInvalidLhsInCompoundAssignment, "invalid lhs in compound assignment") \
1136 V(kInvalidLhsInCountOperation, "invalid lhs in count operation") \
1137 V(kInvalidMinLength, "Invalid min_length") \
1138 V(kJSGlobalObjectNativeContextShouldBeANativeContext, "JSGlobalObject::native_ context should be a native context") \
1139 V(kJSGlobalProxyContextShouldNotBeNull, "JSGlobalProxy::context() should not b e null") \
1140 V(kJSObjectWithFastElementsMapHasSlowElements, "JSObject with fast elements ma p has slow elements") \
1141 V(kLetBindingReInitialization, "Let binding re-initialization") \
1142 V(kLiveBytesCountOverflowChunkSize, "Live Bytes Count overflow chunk size") \
1143 V(kLiveEditFrameDroppingIsNotSupportedOnArm, "LiveEdit frame dropping is not s upported on arm") \
1144 V(kLiveEditFrameDroppingIsNotSupportedOnMips, "LiveEdit frame dropping is not supported on mips") \
1145 V(kLiveEdit, "LiveEdit") \
1146 V(kLookupVariableInCountOperation, "lookup variable in count operation") \
1147 V(kMapIsNoLongerInEax, "Map is no longer in eax") \
1148 V(kNoCasesLeft, "no cases left") \
1149 V(kNoEmptyArraysHereInEmitFastAsciiArrayJoin, "No empty arrays here in EmitFas tAsciiArrayJoin") \
1150 V(kNonInitializerAssignmentToConst, "non-initializer assignment to const") \
1151 V(kNonSmiIndex, "Non-smi index") \
1152 V(kNonSmiKeyInArrayLiteral, "Non-smi key in array literal") \
1153 V(kNonSmiValue, "Non-smi value") \
1154 V(kNotEnoughVirtualRegistersForValues, "not enough virtual registers for value s") \
1155 V(kNotEnoughVirtualRegistersRegalloc, "not enough virtual registers (regalloc) ") \
1156 V(kObjectFoundInSmiOnlyArray, "object found in smi-only array") \
1157 V(kObjectLiteralWithComplexProperty, "Object literal with complex property") \
1158 V(kOddballInStringTableIsNotUndefinedOrTheHole, "oddball in string table is no t undefined or the hole") \
1159 V(kOperandIsASmiAndNotAName, "Operand is a smi and not a name") \
1160 V(kOperandIsASmiAndNotAString, "Operand is a smi and not a string") \
1161 V(kOperandIsASmi, "Operand is a smi") \
1162 V(kOperandIsNotAName, "Operand is not a name") \
1163 V(kOperandIsNotANumber, "Operand is not a number") \
1164 V(kOperandIsNotASmi, "Operand is not a smi") \
1165 V(kOperandIsNotAString, "Operand is not a string") \
1166 V(kOperandIsNotSmi, "Operand is not smi") \
1167 V(kOperandNotANumber, "Operand not a number") \
1168 V(kOptimizedTooManyTimes, "optimized too many times") \
1169 V(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister, "Out of virtual reg isters while trying to allocate temp register") \
1170 V(kParseScopeError, "parse/scope error") \
1171 V(kPossibleDirectCallToEval, "possible direct call to eval") \
1172 V(kPropertyAllocationCountFailed, "Property allocation count failed") \
1173 V(kReceivedInvalidReturnAddress, "Received invalid return address") \
1174 V(kReferenceToAVariableWhichRequiresDynamicLookup, "reference to a variable wh ich requires dynamic lookup") \
1175 V(kReferenceToGlobalLexicalVariable, "reference to global lexical variable") \
1176 V(kReferenceToUninitializedVariable, "reference to uninitialized variable") \
1177 V(kRegisterDidNotMatchExpectedRoot, "Register did not match expected root") \
1178 V(kRegisterWasClobbered, "register was clobbered") \
1179 V(kScopedBlock, "ScopedBlock") \
1180 V(kSharedFunctionInfoLiteral, "SharedFunctionInfoLiteral") \
1181 V(kSmiAdditionOverflow, "Smi addition overflow") \
1182 V(kSmiSubtractionOverflow, "Smi subtraction overflow") \
1183 V(kStackFrameTypesMustMatch, "stack frame types must match") \
1184 V(kSwitchStatementMixedOrNonLiteralSwitchLabels, "SwitchStatement: mixed or no n-literal switch labels") \
1185 V(kSwitchStatementTooManyClauses, "SwitchStatement: too many clauses") \
1186 V(kTheInstructionShouldBeALui, "The instruction should be a lui") \
1187 V(kTheInstructionShouldBeAnOri, "The instruction should be an ori") \
1188 V(kTheInstructionToPatchShouldBeALoadFromPc, "The instruction to patch should be a load from pc") \
1189 V(kTheInstructionToPatchShouldBeALui, "The instruction to patch should be a lu i") \
1190 V(kTheInstructionToPatchShouldBeAnOri, "The instruction to patch should be an ori") \
1191 V(kTooManyParametersLocals, "too many parameters/locals") \
1192 V(kTooManyParameters, "too many parameters") \
1193 V(kTooManySpillSlotsNeededForOSR, "Too many spill slots needed for OSR") \
1194 V(kToOperandIsDoubleRegisterUnimplemented, "ToOperand IsDoubleRegister unimple mented") \
1195 V(kToOperandUnsupportedDoubleImmediate, "ToOperand Unsupported double immediat e") \
1196 V(kTryCatchStatement, "TryCatchStatement") \
1197 V(kTryFinallyStatement, "TryFinallyStatement") \
1198 V(kUnableToEncodeValueAsSmi, "Unable to encode value as smi") \
1199 V(kUnalignedAllocationInNewSpace, "Unaligned allocation in new space") \
1200 V(kUndefinedValueNotLoaded, "Undefined value not loaded") \
1201 V(kUndoAllocationOfNonAllocatedMemory, "Undo allocation of non allocated memor y") \
1202 V(kUnexpectedAllocationTop, "Unexpected allocation top") \
1203 V(kUnexpectedElementsKindInArrayConstructor, "Unexpected ElementsKind in array constructor") \
1204 V(kUnexpectedFallthroughFromCharCodeAtSlowCase, "Unexpected fallthrough from C harCodeAt slow case") \
1205 V(kUnexpectedFallthroughFromCharFromCodeSlowCase, "Unexpected fallthrough from CharFromCode slow case") \
1206 V(kUnexpectedFallThroughFromStringComparison, "Unexpected fall-through from st ring comparison") \
1207 V(kUnexpectedFallThroughInBinaryStubGenerateFloatingPointCode, "Unexpected fal l-through in BinaryStub_GenerateFloatingPointCode") \
1208 V(kUnexpectedFallthroughToCharCodeAtSlowCase, "Unexpected fallthrough to CharC odeAt slow case") \
1209 V(kUnexpectedFallthroughToCharFromCodeSlowCase, "Unexpected fallthrough to Cha rFromCode slow case") \
1210 V(kUnexpectedFPUStackDepthAfterInstruction, "Unexpected FPU stack depth after instruction") \
1211 V(kUnexpectedInitialMapForArrayFunction1, "Unexpected initial map for Array fu nction (1)") \
1212 V(kUnexpectedInitialMapForArrayFunction2, "Unexpected initial map for Array fu nction (2)") \
1213 V(kUnexpectedInitialMapForArrayFunction, "Unexpected initial map for Array fun ction") \
1214 V(kUnexpectedInitialMapForInternalArrayFunction, "Unexpected initial map for I nternalArray function") \
1215 V(kUnexpectedLevelAfterReturnFromApiCall, "Unexpected level after return from api call") \
1216 V(kUnexpectedNumberOfPreAllocatedPropertyFields, "Unexpected number of pre-all ocated property fields") \
1217 V(kUnexpectedStringFunction, "Unexpected String function") \
1218 V(kUnexpectedStringType, "Unexpected string type") \
1219 V(kUnexpectedStringWrapperInstanceSize, "Unexpected string wrapper instance si ze") \
1220 V(kUnexpectedTypeForRegExpDataFixedArrayExpected, "Unexpected type for RegExp data, FixedArray expected") \
1221 V(kUnexpectedUnusedPropertiesOfStringWrapper, "Unexpected unused properties of string wrapper") \
1222 V(kUninitializedKSmiConstantRegister, "Uninitialized kSmiConstantRegister") \
1223 V(kUnknown, "unknown") \
1224 V(kUnsupportedConstCompoundAssignment, "unsupported const compound assignment" ) \
1225 V(kUnsupportedCountOperationWithConst, "unsupported count operation with const ") \
1226 V(kUnsupportedDoubleImmediate, "unsupported double immediate") \
1227 V(kUnsupportedLetCompoundAssignment, "unsupported let compound assignment") \
1228 V(kUnsupportedLookupSlotInDeclaration, "unsupported lookup slot in declaration ") \
1229 V(kUnsupportedNonPrimitiveCompare, "Unsupported non-primitive compare") \
1230 V(kUnsupportedPhiUseOfArguments, "Unsupported phi use of arguments") \
1231 V(kUnsupportedPhiUseOfConstVariable, "Unsupported phi use of const variable") \
1232 V(kUnsupportedTaggedImmediate, "unsupported tagged immediate") \
1233 V(kVariableResolvedToWithContext, "Variable resolved to with context") \
1234 V(kWeShouldNotHaveAnEmptyLexicalContext, "we should not have an empty lexical context") \
1235 V(kWithStatement, "WithStatement") \
1236 V(kWrongAddressOrValuePassedToRecordWrite, "Wrong address or value passed to R ecordWrite") \
1237
1238
1239 #define ERROR_MESSAGES_CONSTANTS(C, T) C,
1240 enum BailoutReason {
1241 ERROR_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS)
1242 kLastErrorMessage
1243 };
1244 #undef ERROR_MESSAGES_CONSTANTS
1245
1246
1247 const char* GetBailoutReason(BailoutReason reason);
1050 1248
1051 1249
1052 // Object is the abstract superclass for all classes in the 1250 // Object is the abstract superclass for all classes in the
1053 // object hierarchy. 1251 // object hierarchy.
1054 // Object does not use any virtual functions to avoid the 1252 // Object does not use any virtual functions to avoid the
1055 // allocation of the C++ vtable. 1253 // allocation of the C++ vtable.
1056 // Since Smi and Failure are subclasses of Object no 1254 // Since Smi and Failure are subclasses of Object no
1057 // data members can be present in Object. 1255 // data members can be present in Object.
1058 class Object : public MaybeObject { 1256 class Object : public MaybeObject {
1059 public: 1257 public:
(...skipping 5238 matching lines...) Expand 10 before | Expand all | Expand 10 after
6298 6496
6299 // Indicates whether or not the code in the shared function support 6497 // Indicates whether or not the code in the shared function support
6300 // deoptimization. 6498 // deoptimization.
6301 inline bool has_deoptimization_support(); 6499 inline bool has_deoptimization_support();
6302 6500
6303 // Enable deoptimization support through recompiled code. 6501 // Enable deoptimization support through recompiled code.
6304 void EnableDeoptimizationSupport(Code* recompiled); 6502 void EnableDeoptimizationSupport(Code* recompiled);
6305 6503
6306 // Disable (further) attempted optimization of all functions sharing this 6504 // Disable (further) attempted optimization of all functions sharing this
6307 // shared function info. 6505 // shared function info.
6308 void DisableOptimization(const char* reason); 6506 void DisableOptimization(BailoutReason reason);
6309 6507
6310 // Lookup the bailout ID and ASSERT that it exists in the non-optimized 6508 // Lookup the bailout ID and ASSERT that it exists in the non-optimized
6311 // code, returns whether it asserted (i.e., always true if assertions are 6509 // code, returns whether it asserted (i.e., always true if assertions are
6312 // disabled). 6510 // disabled).
6313 bool VerifyBailoutId(BailoutId id); 6511 bool VerifyBailoutId(BailoutId id);
6314 6512
6315 // [source code]: Source code for the function. 6513 // [source code]: Source code for the function.
6316 bool HasSourceCode(); 6514 bool HasSourceCode();
6317 Handle<Object> GetSourceCode(); 6515 Handle<Object> GetSourceCode();
6318 6516
(...skipping 3580 matching lines...) Expand 10 before | Expand all | Expand 10 after
9899 } else { 10097 } else {
9900 value &= ~(1 << bit_position); 10098 value &= ~(1 << bit_position);
9901 } 10099 }
9902 return value; 10100 return value;
9903 } 10101 }
9904 }; 10102 };
9905 10103
9906 } } // namespace v8::internal 10104 } } // namespace v8::internal
9907 10105
9908 #endif // V8_OBJECTS_H_ 10106 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698