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

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: styles fixed 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, \
1056 "32 bit value in register is not zero-extended") \
1057 V(kAlignmentMarkerExpected, "alignment marker expected") \
1058 V(kAllocationIsNotDoubleAligned, "Allocation is not double aligned") \
1059 V(kAPICallReturnedInvalidObject, "API call returned invalid object") \
1060 V(kArgumentsObjectValueInATestContext, \
1061 "arguments object value in a test context") \
1062 V(kArrayBoilerplateCreationFailed, "array boilerplate creation failed") \
1063 V(kArrayIndexConstantValueTooBig, "array index constant value too big") \
1064 V(kAssignmentToArguments, "assignment to arguments") \
1065 V(kAssignmentToLetVariableBeforeInitialization, \
1066 "assignment to let variable before initialization") \
1067 V(kAssignmentToLOOKUPVariable, "assignment to LOOKUP variable") \
1068 V(kAssignmentToParameterFunctionUsesArgumentsObject, \
1069 "assignment to parameter, function uses arguments object") \
1070 V(kAssignmentToParameterInArgumentsObject, \
1071 "assignment to parameter in arguments object") \
1072 V(kAttemptToUseUndefinedCache, "Attempt to use undefined cache") \
1073 V(kBadValueContextForArgumentsObjectValue, \
1074 "bad value context for arguments object value") \
1075 V(kBadValueContextForArgumentsValue, \
1076 "bad value context for arguments value") \
1077 V(kBailedOutDueToDependentMap, "bailed out due to dependent map") \
1078 V(kBailoutWasNotPrepared, "bailout was not prepared") \
1079 V(kBinaryStubGenerateFloatingPointCode, \
1080 "BinaryStub_GenerateFloatingPointCode.") \
1081 V(kBothRegistersWereSmisInSelectNonSmi, \
1082 "Both registers were smis in SelectNonSmi") \
1083 V(kCallToAJavaScriptRuntimeFunction, \
1084 "call to a JavaScript runtime function") \
1085 V(kCannotTranslatePositionInChangedArea, \
1086 "Cannot translate position in changed area") \
1087 V(kCodeGenerationFailed, "code generation failed") \
1088 V(kCodeObjectNotProperlyPatched, "code object not properly patched") \
1089 V(kCompoundAssignmentToLookupSlot, "compound assignment to lookup slot") \
1090 V(kContextAllocatedArguments, "context-allocated arguments") \
1091 V(kDebuggerIsActive, "debugger is active") \
1092 V(kDebuggerStatement, "DebuggerStatement") \
1093 V(kDeclarationInCatchContext, "Declaration in catch context") \
1094 V(kDeclarationInWithContext, "Declaration in with context") \
1095 V(kDefaultNaNModeNotSet, "Default NaN mode not set") \
1096 V(kDeleteWithGlobalVariable, "delete with global variable") \
1097 V(kDeleteWithNonGlobalVariable, "delete with non-global variable") \
1098 V(kDestinationOfCopyNotAligned, "Destination of copy not aligned.") \
1099 V(kDontDeleteCellsCannotContainTheHole, \
1100 "DontDelete cells can't contain the hole") \
1101 V(kDoPushArgumentNotImplementedForDoubleType, \
1102 "DoPushArgument not implemented for double type") \
1103 V(kEmitLoadRegisterUnsupportedDoubleImmediate, \
1104 "EmitLoadRegister: Unsupported double immediate") \
1105 V(kEval, "eval") \
1106 V(kExpected0AsASmiSentinel, "Expected 0 as a Smi sentinel") \
1107 V(kExpectedAlignmentMarker, "expected alignment marker") \
1108 V(kExpectedPropertyCellInRegisterA2, \
1109 "Expected property cell in register a2") \
1110 V(kExpectedPropertyCellInRegisterEbx, \
1111 "Expected property cell in register ebx") \
1112 V(kExpectedPropertyCellInRegisterRbx, \
1113 "Expected property cell in register rbx") \
1114 V(kExpectingAlignmentForCopyBytes, \
1115 "Expecting alignment for CopyBytes") \
1116 V(kExternalStringExpectedButNotFound, \
1117 "external string expected, but not found") \
1118 V(kFailedBailedOutLastTime, "failed/bailed out last time") \
1119 V(kForInStatementIsNotFastCase, "ForInStatement is not fast case") \
1120 V(kForInStatementOptimizationIsDisabled, \
1121 "ForInStatement optimization is disabled") \
1122 V(kForInStatementWithNonLocalEachVariable, \
1123 "ForInStatement with non-local each variable") \
1124 V(kForOfStatement, "ForOfStatement") \
1125 V(kFrameIsExpectedToBeAligned, "frame is expected to be aligned") \
1126 V(kFunctionCallsEval, "function calls eval") \
1127 V(kFunctionIsAGenerator, "function is a generator") \
1128 V(kFunctionWithIllegalRedeclaration, "function with illegal redeclaration") \
1129 V(kGeneratedCodeIsTooLarge, "Generated code is too large") \
1130 V(kGeneratorFailedToResume, "Generator failed to resume") \
1131 V(kGenerator, "generator") \
1132 V(kGlobalFunctionsMustHaveInitialMap, \
1133 "Global functions must have initial map") \
1134 V(kHeapNumberMapRegisterClobbered, "HeapNumberMap register clobbered") \
1135 V(kImproperObjectOnPrototypeChainForStore, \
1136 "improper object on prototype chain for store") \
1137 V(kIndexIsNegative, "Index is negative") \
1138 V(kIndexIsTooLarge, "Index is too large") \
1139 V(kInlinedRuntimeFunctionClassOf, "inlined runtime function: ClassOf") \
1140 V(kInlinedRuntimeFunctionFastAsciiArrayJoin, \
1141 "inlined runtime function: FastAsciiArrayJoin") \
1142 V(kInlinedRuntimeFunctionGeneratorNext, \
1143 "inlined runtime function: GeneratorNext") \
1144 V(kInlinedRuntimeFunctionGeneratorThrow, \
1145 "inlined runtime function: GeneratorThrow") \
1146 V(kInlinedRuntimeFunctionGetFromCache, \
1147 "inlined runtime function: GetFromCache") \
1148 V(kInlinedRuntimeFunctionIsNonNegativeSmi, \
1149 "inlined runtime function: IsNonNegativeSmi") \
1150 V(kInlinedRuntimeFunctionIsRegExpEquivalent, \
1151 "inlined runtime function: IsRegExpEquivalent") \
1152 V(kInlinedRuntimeFunctionIsStringWrapperSafeForDefaultValueOf, \
1153 "inlined runtime function: IsStringWrapperSafeForDefaultValueOf") \
1154 V(kInliningBailedOut, "inlining bailed out") \
1155 V(kInputGPRIsExpectedToHaveUpper32Cleared, \
1156 "input GPR is expected to have upper32 cleared") \
1157 V(kInstanceofStubUnexpectedCallSiteCacheCheck, \
1158 "InstanceofStub unexpected call site cache (check)") \
1159 V(kInstanceofStubUnexpectedCallSiteCacheCmp1, \
1160 "InstanceofStub unexpected call site cache (cmp 1)") \
1161 V(kInstanceofStubUnexpectedCallSiteCacheCmp2, \
1162 "InstanceofStub unexpected call site cache (cmp 2)") \
1163 V(kInstanceofStubUnexpectedCallSiteCacheMov, \
1164 "InstanceofStub unexpected call site cache (mov)") \
1165 V(kInteger32ToSmiFieldWritingToNonSmiLocation, \
1166 "Integer32ToSmiField writing to non-smi location") \
1167 V(kInvalidCaptureReferenced, "Invalid capture referenced") \
1168 V(kInvalidElementsKindForInternalArrayOrInternalPackedArray, \
1169 "Invalid ElementsKind for InternalArray or InternalPackedArray") \
1170 V(kInvalidHandleScopeLevel, "Invalid HandleScope level") \
1171 V(kInvalidLeftHandSideInAssignment, "invalid left-hand side in assignment") \
1172 V(kInvalidLhsInCompoundAssignment, "invalid lhs in compound assignment") \
1173 V(kInvalidLhsInCountOperation, "invalid lhs in count operation") \
1174 V(kInvalidMinLength, "Invalid min_length") \
1175 V(kJSGlobalObjectNativeContextShouldBeANativeContext, \
1176 "JSGlobalObject::native_context should be a native context") \
1177 V(kJSGlobalProxyContextShouldNotBeNull, \
1178 "JSGlobalProxy::context() should not be null") \
1179 V(kJSObjectWithFastElementsMapHasSlowElements, \
1180 "JSObject with fast elements map has slow elements") \
1181 V(kLetBindingReInitialization, "Let binding re-initialization") \
1182 V(kLiveBytesCountOverflowChunkSize, "Live Bytes Count overflow chunk size") \
1183 V(kLiveEditFrameDroppingIsNotSupportedOnArm, \
1184 "LiveEdit frame dropping is not supported on arm") \
1185 V(kLiveEditFrameDroppingIsNotSupportedOnMips, \
1186 "LiveEdit frame dropping is not supported on mips") \
1187 V(kLiveEdit, "LiveEdit") \
1188 V(kLookupVariableInCountOperation, \
1189 "lookup variable in count operation") \
1190 V(kMapIsNoLongerInEax, "Map is no longer in eax") \
1191 V(kNoCasesLeft, "no cases left") \
1192 V(kNoEmptyArraysHereInEmitFastAsciiArrayJoin, \
1193 "No empty arrays here in EmitFastAsciiArrayJoin") \
1194 V(kNonInitializerAssignmentToConst, \
1195 "non-initializer assignment to const") \
1196 V(kNonSmiIndex, "Non-smi index") \
1197 V(kNonSmiKeyInArrayLiteral, "Non-smi key in array literal") \
1198 V(kNonSmiValue, "Non-smi value") \
1199 V(kNotEnoughVirtualRegistersForValues, \
1200 "not enough virtual registers for values") \
1201 V(kNotEnoughVirtualRegistersRegalloc, \
1202 "not enough virtual registers (regalloc)") \
1203 V(kObjectFoundInSmiOnlyArray, "object found in smi-only array") \
1204 V(kObjectLiteralWithComplexProperty, \
1205 "Object literal with complex property") \
1206 V(kOddballInStringTableIsNotUndefinedOrTheHole, \
1207 "oddball in string table is not undefined or the hole") \
1208 V(kOperandIsASmiAndNotAName, "Operand is a smi and not a name") \
1209 V(kOperandIsASmiAndNotAString, "Operand is a smi and not a string") \
1210 V(kOperandIsASmi, "Operand is a smi") \
1211 V(kOperandIsNotAName, "Operand is not a name") \
1212 V(kOperandIsNotANumber, "Operand is not a number") \
1213 V(kOperandIsNotASmi, "Operand is not a smi") \
1214 V(kOperandIsNotAString, "Operand is not a string") \
1215 V(kOperandIsNotSmi, "Operand is not smi") \
1216 V(kOperandNotANumber, "Operand not a number") \
1217 V(kOptimizedTooManyTimes, "optimized too many times") \
1218 V(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister, \
1219 "Out of virtual registers while trying to allocate temp register") \
1220 V(kParseScopeError, "parse/scope error") \
1221 V(kPossibleDirectCallToEval, "possible direct call to eval") \
1222 V(kPropertyAllocationCountFailed, "Property allocation count failed") \
1223 V(kReceivedInvalidReturnAddress, "Received invalid return address") \
1224 V(kReferenceToAVariableWhichRequiresDynamicLookup, \
1225 "reference to a variable which requires dynamic lookup") \
1226 V(kReferenceToGlobalLexicalVariable, \
1227 "reference to global lexical variable") \
1228 V(kReferenceToUninitializedVariable, "reference to uninitialized variable") \
1229 V(kRegisterDidNotMatchExpectedRoot, "Register did not match expected root") \
1230 V(kRegisterWasClobbered, "register was clobbered") \
1231 V(kScopedBlock, "ScopedBlock") \
1232 V(kSharedFunctionInfoLiteral, "SharedFunctionInfoLiteral") \
1233 V(kSmiAdditionOverflow, "Smi addition overflow") \
1234 V(kSmiSubtractionOverflow, "Smi subtraction overflow") \
1235 V(kStackFrameTypesMustMatch, "stack frame types must match") \
1236 V(kSwitchStatementMixedOrNonLiteralSwitchLabels, \
1237 "SwitchStatement: mixed or non-literal switch labels") \
1238 V(kSwitchStatementTooManyClauses, "SwitchStatement: too many clauses") \
1239 V(kTheInstructionShouldBeALui, "The instruction should be a lui") \
1240 V(kTheInstructionShouldBeAnOri, "The instruction should be an ori") \
1241 V(kTheInstructionToPatchShouldBeALoadFromPc, \
1242 "The instruction to patch should be a load from pc") \
1243 V(kTheInstructionToPatchShouldBeALui, \
1244 "The instruction to patch should be a lui") \
1245 V(kTheInstructionToPatchShouldBeAnOri, \
1246 "The instruction to patch should be an ori") \
1247 V(kTooManyParametersLocals, "too many parameters/locals") \
1248 V(kTooManyParameters, "too many parameters") \
1249 V(kTooManySpillSlotsNeededForOSR, "Too many spill slots needed for OSR") \
1250 V(kToOperandIsDoubleRegisterUnimplemented, \
1251 "ToOperand IsDoubleRegister unimplemented") \
1252 V(kToOperandUnsupportedDoubleImmediate, \
1253 "ToOperand Unsupported double immediate") \
1254 V(kTryCatchStatement, "TryCatchStatement") \
1255 V(kTryFinallyStatement, "TryFinallyStatement") \
1256 V(kUnableToEncodeValueAsSmi, "Unable to encode value as smi") \
1257 V(kUnalignedAllocationInNewSpace, "Unaligned allocation in new space") \
1258 V(kUndefinedValueNotLoaded, "Undefined value not loaded") \
1259 V(kUndoAllocationOfNonAllocatedMemory, \
1260 "Undo allocation of non allocated memory") \
1261 V(kUnexpectedAllocationTop, "Unexpected allocation top") \
1262 V(kUnexpectedElementsKindInArrayConstructor, \
1263 "Unexpected ElementsKind in array constructor") \
1264 V(kUnexpectedFallthroughFromCharCodeAtSlowCase, \
1265 "Unexpected fallthrough from CharCodeAt slow case") \
1266 V(kUnexpectedFallthroughFromCharFromCodeSlowCase, \
1267 "Unexpected fallthrough from CharFromCode slow case") \
1268 V(kUnexpectedFallThroughFromStringComparison, \
1269 "Unexpected fall-through from string comparison") \
1270 V(kUnexpectedFallThroughInBinaryStubGenerateFloatingPointCode, \
1271 "Unexpected fall-through in BinaryStub_GenerateFloatingPointCode") \
1272 V(kUnexpectedFallthroughToCharCodeAtSlowCase, \
1273 "Unexpected fallthrough to CharCodeAt slow case") \
1274 V(kUnexpectedFallthroughToCharFromCodeSlowCase, \
1275 "Unexpected fallthrough to CharFromCode slow case") \
1276 V(kUnexpectedFPUStackDepthAfterInstruction, \
1277 "Unexpected FPU stack depth after instruction") \
1278 V(kUnexpectedInitialMapForArrayFunction1, \
1279 "Unexpected initial map for Array function (1)") \
1280 V(kUnexpectedInitialMapForArrayFunction2, \
1281 "Unexpected initial map for Array function (2)") \
1282 V(kUnexpectedInitialMapForArrayFunction, \
1283 "Unexpected initial map for Array function") \
1284 V(kUnexpectedInitialMapForInternalArrayFunction, \
1285 "Unexpected initial map for InternalArray function") \
1286 V(kUnexpectedLevelAfterReturnFromApiCall, \
1287 "Unexpected level after return from api call") \
1288 V(kUnexpectedNumberOfPreAllocatedPropertyFields, \
1289 "Unexpected number of pre-allocated property fields") \
1290 V(kUnexpectedStringFunction, "Unexpected String function") \
1291 V(kUnexpectedStringType, "Unexpected string type") \
1292 V(kUnexpectedStringWrapperInstanceSize, \
1293 "Unexpected string wrapper instance size") \
1294 V(kUnexpectedTypeForRegExpDataFixedArrayExpected, \
1295 "Unexpected type for RegExp data, FixedArray expected") \
1296 V(kUnexpectedUnusedPropertiesOfStringWrapper, \
1297 "Unexpected unused properties of string wrapper") \
1298 V(kUninitializedKSmiConstantRegister, "Uninitialized kSmiConstantRegister") \
1299 V(kUnknown, "unknown") \
1300 V(kUnsupportedConstCompoundAssignment, \
1301 "unsupported const compound assignment") \
1302 V(kUnsupportedCountOperationWithConst, \
1303 "unsupported count operation with const") \
1304 V(kUnsupportedDoubleImmediate, "unsupported double immediate") \
1305 V(kUnsupportedLetCompoundAssignment, "unsupported let compound assignment") \
1306 V(kUnsupportedLookupSlotInDeclaration, \
1307 "unsupported lookup slot in declaration") \
1308 V(kUnsupportedNonPrimitiveCompare, "Unsupported non-primitive compare") \
1309 V(kUnsupportedPhiUseOfArguments, "Unsupported phi use of arguments") \
1310 V(kUnsupportedPhiUseOfConstVariable, \
1311 "Unsupported phi use of const variable") \
1312 V(kUnsupportedTaggedImmediate, "unsupported tagged immediate") \
1313 V(kVariableResolvedToWithContext, "Variable resolved to with context") \
1314 V(kWeShouldNotHaveAnEmptyLexicalContext, \
1315 "we should not have an empty lexical context") \
1316 V(kWithStatement, "WithStatement") \
1317 V(kWrongAddressOrValuePassedToRecordWrite, \
1318 "Wrong address or value passed to RecordWrite")
1319
1320
1321 #define ERROR_MESSAGES_CONSTANTS(C, T) C,
1322 enum BailoutReason {
1323 ERROR_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS)
1324 kLastErrorMessage
1325 };
1326 #undef ERROR_MESSAGES_CONSTANTS
1327
1328
1329 const char* GetBailoutReason(BailoutReason reason);
1050 1330
1051 1331
1052 // Object is the abstract superclass for all classes in the 1332 // Object is the abstract superclass for all classes in the
1053 // object hierarchy. 1333 // object hierarchy.
1054 // Object does not use any virtual functions to avoid the 1334 // Object does not use any virtual functions to avoid the
1055 // allocation of the C++ vtable. 1335 // allocation of the C++ vtable.
1056 // Since Smi and Failure are subclasses of Object no 1336 // Since Smi and Failure are subclasses of Object no
1057 // data members can be present in Object. 1337 // data members can be present in Object.
1058 class Object : public MaybeObject { 1338 class Object : public MaybeObject {
1059 public: 1339 public:
(...skipping 5238 matching lines...) Expand 10 before | Expand all | Expand 10 after
6298 6578
6299 // Indicates whether or not the code in the shared function support 6579 // Indicates whether or not the code in the shared function support
6300 // deoptimization. 6580 // deoptimization.
6301 inline bool has_deoptimization_support(); 6581 inline bool has_deoptimization_support();
6302 6582
6303 // Enable deoptimization support through recompiled code. 6583 // Enable deoptimization support through recompiled code.
6304 void EnableDeoptimizationSupport(Code* recompiled); 6584 void EnableDeoptimizationSupport(Code* recompiled);
6305 6585
6306 // Disable (further) attempted optimization of all functions sharing this 6586 // Disable (further) attempted optimization of all functions sharing this
6307 // shared function info. 6587 // shared function info.
6308 void DisableOptimization(const char* reason); 6588 void DisableOptimization(BailoutReason reason);
6309 6589
6310 // Lookup the bailout ID and ASSERT that it exists in the non-optimized 6590 // 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 6591 // code, returns whether it asserted (i.e., always true if assertions are
6312 // disabled). 6592 // disabled).
6313 bool VerifyBailoutId(BailoutId id); 6593 bool VerifyBailoutId(BailoutId id);
6314 6594
6315 // [source code]: Source code for the function. 6595 // [source code]: Source code for the function.
6316 bool HasSourceCode(); 6596 bool HasSourceCode();
6317 Handle<Object> GetSourceCode(); 6597 Handle<Object> GetSourceCode();
6318 6598
(...skipping 3580 matching lines...) Expand 10 before | Expand all | Expand 10 after
9899 } else { 10179 } else {
9900 value &= ~(1 << bit_position); 10180 value &= ~(1 << bit_position);
9901 } 10181 }
9902 return value; 10182 return value;
9903 } 10183 }
9904 }; 10184 };
9905 10185
9906 } } // namespace v8::internal 10186 } } // namespace v8::internal
9907 10187
9908 #endif // V8_OBJECTS_H_ 10188 #endif // V8_OBJECTS_H_
OLDNEW
« src/compiler.cc ('K') | « src/mips/macro-assembler-mips.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698