| OLD | NEW |
| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 }; | 211 }; |
| 212 | 212 |
| 213 | 213 |
| 214 enum StringStubFeedback { | 214 enum StringStubFeedback { |
| 215 DEFAULT_STRING_STUB = 0, | 215 DEFAULT_STRING_STUB = 0, |
| 216 STRING_INDEX_OUT_OF_BOUNDS = 1 | 216 STRING_INDEX_OUT_OF_BOUNDS = 1 |
| 217 }; | 217 }; |
| 218 | 218 |
| 219 | 219 |
| 220 // Forward declarations. | 220 // Forward declarations. |
| 221 // TODO(rossberg): these should all go away eventually. | |
| 222 class Assignment; | |
| 223 class Call; | |
| 224 class CallNew; | |
| 225 class CaseClause; | |
| 226 class CompilationInfo; | 221 class CompilationInfo; |
| 227 class CountOperation; | |
| 228 class Expression; | |
| 229 class ForInStatement; | |
| 230 class ICStub; | 222 class ICStub; |
| 231 class Property; | |
| 232 class SmallMapList; | 223 class SmallMapList; |
| 233 class ObjectLiteral; | |
| 234 class ObjectLiteralProperty; | |
| 235 | 224 |
| 236 | 225 |
| 237 class TypeFeedbackOracle: public ZoneObject { | 226 class TypeFeedbackOracle: public ZoneObject { |
| 238 public: | 227 public: |
| 239 TypeFeedbackOracle(Handle<Code> code, | 228 TypeFeedbackOracle(Handle<Code> code, |
| 240 Handle<Context> native_context, | 229 Handle<Context> native_context, |
| 241 Isolate* isolate, | 230 Isolate* isolate, |
| 242 Zone* zone); | 231 Zone* zone); |
| 243 | 232 |
| 244 bool LoadIsMonomorphicNormal(TypeFeedbackId id); | 233 bool LoadIsMonomorphicNormal(TypeFeedbackId id); |
| 245 bool LoadIsUninitialized(TypeFeedbackId id); | 234 bool LoadIsUninitialized(TypeFeedbackId id); |
| 246 bool LoadIsPreMonomorphic(TypeFeedbackId id); | 235 bool LoadIsPreMonomorphic(TypeFeedbackId id); |
| 247 bool LoadIsPolymorphic(TypeFeedbackId id); | 236 bool LoadIsPolymorphic(TypeFeedbackId id); |
| 248 bool StoreIsUninitialized(TypeFeedbackId ast_id); | 237 bool StoreIsUninitialized(TypeFeedbackId id); |
| 249 bool StoreIsMonomorphicNormal(TypeFeedbackId ast_id); | 238 bool StoreIsMonomorphicNormal(TypeFeedbackId id); |
| 250 bool StoreIsPreMonomorphic(TypeFeedbackId ast_id); | 239 bool StoreIsPreMonomorphic(TypeFeedbackId id); |
| 251 bool StoreIsKeyedPolymorphic(TypeFeedbackId ast_id); | 240 bool StoreIsKeyedPolymorphic(TypeFeedbackId id); |
| 252 bool CallIsMonomorphic(Call* expr); | 241 bool CallIsMonomorphic(TypeFeedbackId aid); |
| 253 bool KeyedArrayCallIsHoley(Call* expr); | 242 bool KeyedArrayCallIsHoley(TypeFeedbackId id); |
| 254 bool CallNewIsMonomorphic(CallNew* expr); | 243 bool CallNewIsMonomorphic(TypeFeedbackId id); |
| 255 bool ObjectLiteralStoreIsMonomorphic(ObjectLiteralProperty* prop); | 244 bool ObjectLiteralStoreIsMonomorphic(TypeFeedbackId id); |
| 256 | 245 |
| 257 // TODO(1571) We can't use ForInStatement::ForInType as the return value due | 246 // TODO(1571) We can't use ForInStatement::ForInType as the return value due |
| 258 // to various cycles in our headers. | 247 // to various cycles in our headers. |
| 259 // TODO(rossberg): once all oracle access is removed from ast.cc, it should | 248 // TODO(rossberg): once all oracle access is removed from ast.cc, it should |
| 260 // be possible. | 249 // be possible. |
| 261 byte ForInType(TypeFeedbackId id); | 250 byte ForInType(TypeFeedbackId id); |
| 262 | 251 |
| 263 Handle<Map> LoadMonomorphicReceiverType(TypeFeedbackId id); | 252 Handle<Map> LoadMonomorphicReceiverType(TypeFeedbackId id); |
| 264 Handle<Map> StoreMonomorphicReceiverType(TypeFeedbackId id); | 253 Handle<Map> StoreMonomorphicReceiverType(TypeFeedbackId id); |
| 265 | 254 |
| 266 KeyedAccessStoreMode GetStoreMode(TypeFeedbackId ast_id); | 255 KeyedAccessStoreMode GetStoreMode(TypeFeedbackId id); |
| 267 | 256 |
| 268 void LoadReceiverTypes(TypeFeedbackId id, | 257 void LoadReceiverTypes(TypeFeedbackId id, |
| 269 Handle<String> name, | 258 Handle<String> name, |
| 270 SmallMapList* types); | 259 SmallMapList* types); |
| 271 void StoreReceiverTypes(Assignment* expr, | 260 void StoreReceiverTypes(TypeFeedbackId id, |
| 272 Handle<String> name, | 261 Handle<String> name, |
| 273 SmallMapList* types); | 262 SmallMapList* types); |
| 274 void CallReceiverTypes(Call* expr, | 263 void CallReceiverTypes(TypeFeedbackId id, |
| 275 Handle<String> name, | 264 Handle<String> name, |
| 265 int arity, |
| 276 CallKind call_kind, | 266 CallKind call_kind, |
| 277 SmallMapList* types); | 267 SmallMapList* types); |
| 278 void CollectKeyedReceiverTypes(TypeFeedbackId ast_id, | 268 void CollectKeyedReceiverTypes(TypeFeedbackId id, |
| 279 SmallMapList* types); | 269 SmallMapList* types); |
| 280 void CollectPolymorphicStoreReceiverTypes(TypeFeedbackId ast_id, | 270 void CollectPolymorphicStoreReceiverTypes(TypeFeedbackId id, |
| 281 SmallMapList* types); | 271 SmallMapList* types); |
| 282 | 272 |
| 283 void PropertyReceiverTypes(TypeFeedbackId id, | 273 void PropertyReceiverTypes(TypeFeedbackId id, |
| 284 Handle<String> name, | 274 Handle<String> name, |
| 285 SmallMapList* receiver_types, | 275 SmallMapList* receiver_types, |
| 286 bool* is_prototype); | 276 bool* is_prototype); |
| 287 void KeyedPropertyReceiverTypes(TypeFeedbackId id, | 277 void KeyedPropertyReceiverTypes(TypeFeedbackId id, |
| 288 SmallMapList* receiver_types, | 278 SmallMapList* receiver_types, |
| 289 bool* is_string); | 279 bool* is_string); |
| 280 void AssignmentReceiverTypes(TypeFeedbackId id, |
| 281 Handle<String> name, |
| 282 SmallMapList* receiver_types); |
| 283 void KeyedAssignmentReceiverTypes(TypeFeedbackId id, |
| 284 SmallMapList* receiver_types, |
| 285 KeyedAccessStoreMode* store_mode); |
| 290 void CountReceiverTypes(TypeFeedbackId id, | 286 void CountReceiverTypes(TypeFeedbackId id, |
| 291 SmallMapList* receiver_types); | 287 SmallMapList* receiver_types); |
| 292 | 288 |
| 293 static bool CanRetainOtherContext(Map* map, Context* native_context); | 289 static bool CanRetainOtherContext(Map* map, Context* native_context); |
| 294 static bool CanRetainOtherContext(JSFunction* function, | 290 static bool CanRetainOtherContext(JSFunction* function, |
| 295 Context* native_context); | 291 Context* native_context); |
| 296 | 292 |
| 297 void CollectPolymorphicMaps(Handle<Code> code, SmallMapList* types); | 293 void CollectPolymorphicMaps(Handle<Code> code, SmallMapList* types); |
| 298 | 294 |
| 299 CheckType GetCallCheckType(Call* expr); | 295 CheckType GetCallCheckType(TypeFeedbackId id); |
| 300 Handle<JSFunction> GetCallTarget(Call* expr); | 296 Handle<JSFunction> GetCallTarget(TypeFeedbackId id); |
| 301 Handle<JSFunction> GetCallNewTarget(CallNew* expr); | 297 Handle<JSFunction> GetCallNewTarget(TypeFeedbackId id); |
| 302 Handle<Cell> GetCallNewAllocationInfoCell(CallNew* expr); | 298 Handle<Cell> GetCallNewAllocationInfoCell(TypeFeedbackId id); |
| 303 | 299 |
| 304 Handle<Map> GetObjectLiteralStoreMap(ObjectLiteralProperty* prop); | 300 Handle<Map> GetObjectLiteralStoreMap(TypeFeedbackId id); |
| 305 | 301 |
| 306 bool LoadIsBuiltin(TypeFeedbackId id, Builtins::Name builtin_id); | 302 bool LoadIsBuiltin(TypeFeedbackId id, Builtins::Name builtin_id); |
| 307 bool LoadIsStub(TypeFeedbackId id, ICStub* stub); | 303 bool LoadIsStub(TypeFeedbackId id, ICStub* stub); |
| 308 | 304 |
| 309 // TODO(1571) We can't use ToBooleanStub::Types as the return value because | 305 // TODO(1571) We can't use ToBooleanStub::Types as the return value because |
| 310 // of various cycles in our headers. Death to tons of implementations in | 306 // of various cycles in our headers. Death to tons of implementations in |
| 311 // headers!! :-P | 307 // headers!! :-P |
| 312 byte ToBooleanTypes(TypeFeedbackId id); | 308 byte ToBooleanTypes(TypeFeedbackId id); |
| 313 | 309 |
| 314 // Get type information for arithmetic operations and compares. | 310 // Get type information for arithmetic operations and compares. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 325 Handle<Type>* combined); | 321 Handle<Type>* combined); |
| 326 | 322 |
| 327 Handle<Type> CountType(TypeFeedbackId id); | 323 Handle<Type> CountType(TypeFeedbackId id); |
| 328 | 324 |
| 329 Handle<Type> ClauseType(TypeFeedbackId id); | 325 Handle<Type> ClauseType(TypeFeedbackId id); |
| 330 | 326 |
| 331 Zone* zone() const { return zone_; } | 327 Zone* zone() const { return zone_; } |
| 332 Isolate* isolate() const { return isolate_; } | 328 Isolate* isolate() const { return isolate_; } |
| 333 | 329 |
| 334 private: | 330 private: |
| 335 void CollectReceiverTypes(TypeFeedbackId ast_id, | 331 void CollectReceiverTypes(TypeFeedbackId id, |
| 336 Handle<String> name, | 332 Handle<String> name, |
| 337 Code::Flags flags, | 333 Code::Flags flags, |
| 338 SmallMapList* types); | 334 SmallMapList* types); |
| 339 | 335 |
| 340 void SetInfo(TypeFeedbackId ast_id, Object* target); | 336 void SetInfo(TypeFeedbackId id, Object* target); |
| 341 | 337 |
| 342 void BuildDictionary(Handle<Code> code); | 338 void BuildDictionary(Handle<Code> code); |
| 343 void GetRelocInfos(Handle<Code> code, ZoneList<RelocInfo>* infos); | 339 void GetRelocInfos(Handle<Code> code, ZoneList<RelocInfo>* infos); |
| 344 void CreateDictionary(Handle<Code> code, ZoneList<RelocInfo>* infos); | 340 void CreateDictionary(Handle<Code> code, ZoneList<RelocInfo>* infos); |
| 345 void RelocateRelocInfos(ZoneList<RelocInfo>* infos, | 341 void RelocateRelocInfos(ZoneList<RelocInfo>* infos, |
| 346 byte* old_start, | 342 byte* old_start, |
| 347 byte* new_start); | 343 byte* new_start); |
| 348 void ProcessRelocInfos(ZoneList<RelocInfo>* infos); | 344 void ProcessRelocInfos(ZoneList<RelocInfo>* infos); |
| 349 void ProcessTypeFeedbackCells(Handle<Code> code); | 345 void ProcessTypeFeedbackCells(Handle<Code> code); |
| 350 | 346 |
| 351 // Returns an element from the backing store. Returns undefined if | 347 // Returns an element from the backing store. Returns undefined if |
| 352 // there is no information. | 348 // there is no information. |
| 353 Handle<Object> GetInfo(TypeFeedbackId ast_id); | 349 Handle<Object> GetInfo(TypeFeedbackId id); |
| 354 | 350 |
| 355 // Return the cell that contains type feedback. | 351 // Return the cell that contains type feedback. |
| 356 Handle<Cell> GetInfoCell(TypeFeedbackId ast_id); | 352 Handle<Cell> GetInfoCell(TypeFeedbackId id); |
| 357 | 353 |
| 358 private: | 354 private: |
| 359 Handle<Context> native_context_; | 355 Handle<Context> native_context_; |
| 360 Isolate* isolate_; | 356 Isolate* isolate_; |
| 361 Zone* zone_; | 357 Zone* zone_; |
| 362 Handle<UnseededNumberDictionary> dictionary_; | 358 Handle<UnseededNumberDictionary> dictionary_; |
| 363 | 359 |
| 364 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); | 360 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); |
| 365 }; | 361 }; |
| 366 | 362 |
| 367 } } // namespace v8::internal | 363 } } // namespace v8::internal |
| 368 | 364 |
| 369 #endif // V8_TYPE_INFO_H_ | 365 #endif // V8_TYPE_INFO_H_ |
| OLD | NEW |