| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 class TypeFeedbackOracle: public ZoneObject { | 235 class TypeFeedbackOracle: public ZoneObject { |
| 236 public: | 236 public: |
| 237 TypeFeedbackOracle(Handle<Code> code, | 237 TypeFeedbackOracle(Handle<Code> code, |
| 238 Handle<Context> global_context, | 238 Handle<Context> global_context, |
| 239 Isolate* isolate, | 239 Isolate* isolate, |
| 240 Zone* zone); | 240 Zone* zone); |
| 241 | 241 |
| 242 bool LoadIsMonomorphicNormal(Property* expr); | 242 bool LoadIsMonomorphicNormal(Property* expr); |
| 243 bool LoadIsUninitialized(Property* expr); | 243 bool LoadIsUninitialized(Property* expr); |
| 244 bool LoadIsMegamorphicWithTypeInfo(Property* expr); | 244 bool LoadIsMegamorphicWithTypeInfo(Property* expr); |
| 245 bool StoreIsMonomorphicNormal(Expression* expr); | 245 bool StoreIsMonomorphicNormal(TypeFeedbackId ast_id); |
| 246 bool StoreIsMegamorphicWithTypeInfo(Expression* expr); | 246 bool StoreIsMegamorphicWithTypeInfo(TypeFeedbackId ast_id); |
| 247 bool CallIsMonomorphic(Call* expr); | 247 bool CallIsMonomorphic(Call* expr); |
| 248 bool CallNewIsMonomorphic(CallNew* expr); | 248 bool CallNewIsMonomorphic(CallNew* expr); |
| 249 bool ObjectLiteralStoreIsMonomorphic(ObjectLiteral::Property* prop); | 249 bool ObjectLiteralStoreIsMonomorphic(ObjectLiteral::Property* prop); |
| 250 | 250 |
| 251 bool IsForInFastCase(ForInStatement* expr); | 251 bool IsForInFastCase(ForInStatement* expr); |
| 252 | 252 |
| 253 Handle<Map> LoadMonomorphicReceiverType(Property* expr); | 253 Handle<Map> LoadMonomorphicReceiverType(Property* expr); |
| 254 Handle<Map> StoreMonomorphicReceiverType(Expression* expr); | 254 Handle<Map> StoreMonomorphicReceiverType(TypeFeedbackId ast_id); |
| 255 | 255 |
| 256 void LoadReceiverTypes(Property* expr, | 256 void LoadReceiverTypes(Property* expr, |
| 257 Handle<String> name, | 257 Handle<String> name, |
| 258 SmallMapList* types); | 258 SmallMapList* types); |
| 259 void StoreReceiverTypes(Assignment* expr, | 259 void StoreReceiverTypes(Assignment* expr, |
| 260 Handle<String> name, | 260 Handle<String> name, |
| 261 SmallMapList* types); | 261 SmallMapList* types); |
| 262 void CallReceiverTypes(Call* expr, | 262 void CallReceiverTypes(Call* expr, |
| 263 Handle<String> name, | 263 Handle<String> name, |
| 264 CallKind call_kind, | 264 CallKind call_kind, |
| 265 SmallMapList* types); | 265 SmallMapList* types); |
| 266 void CollectKeyedReceiverTypes(unsigned ast_id, | 266 void CollectKeyedReceiverTypes(TypeFeedbackId ast_id, |
| 267 SmallMapList* types); | 267 SmallMapList* types); |
| 268 | 268 |
| 269 static bool CanRetainOtherContext(Map* map, Context* global_context); | 269 static bool CanRetainOtherContext(Map* map, Context* global_context); |
| 270 static bool CanRetainOtherContext(JSFunction* function, | 270 static bool CanRetainOtherContext(JSFunction* function, |
| 271 Context* global_context); | 271 Context* global_context); |
| 272 | 272 |
| 273 CheckType GetCallCheckType(Call* expr); | 273 CheckType GetCallCheckType(Call* expr); |
| 274 Handle<JSObject> GetPrototypeForPrimitiveCheck(CheckType check); | 274 Handle<JSObject> GetPrototypeForPrimitiveCheck(CheckType check); |
| 275 | 275 |
| 276 Handle<JSFunction> GetCallTarget(Call* expr); | 276 Handle<JSFunction> GetCallTarget(Call* expr); |
| 277 Handle<JSFunction> GetCallNewTarget(CallNew* expr); | 277 Handle<JSFunction> GetCallNewTarget(CallNew* expr); |
| 278 | 278 |
| 279 Handle<Map> GetObjectLiteralStoreMap(ObjectLiteral::Property* prop); | 279 Handle<Map> GetObjectLiteralStoreMap(ObjectLiteral::Property* prop); |
| 280 | 280 |
| 281 bool LoadIsBuiltin(Property* expr, Builtins::Name id); | 281 bool LoadIsBuiltin(Property* expr, Builtins::Name id); |
| 282 | 282 |
| 283 // TODO(1571) We can't use ToBooleanStub::Types as the return value because | 283 // TODO(1571) We can't use ToBooleanStub::Types as the return value because |
| 284 // of various cylces in our headers. Death to tons of implementations in | 284 // of various cylces in our headers. Death to tons of implementations in |
| 285 // headers!! :-P | 285 // headers!! :-P |
| 286 byte ToBooleanTypes(unsigned ast_id); | 286 byte ToBooleanTypes(TypeFeedbackId ast_id); |
| 287 | 287 |
| 288 // Get type information for arithmetic operations and compares. | 288 // Get type information for arithmetic operations and compares. |
| 289 TypeInfo UnaryType(UnaryOperation* expr); | 289 TypeInfo UnaryType(UnaryOperation* expr); |
| 290 TypeInfo BinaryType(BinaryOperation* expr); | 290 TypeInfo BinaryType(BinaryOperation* expr); |
| 291 TypeInfo CompareType(CompareOperation* expr); | 291 TypeInfo CompareType(CompareOperation* expr); |
| 292 bool IsSymbolCompare(CompareOperation* expr); | 292 bool IsSymbolCompare(CompareOperation* expr); |
| 293 Handle<Map> GetCompareMap(CompareOperation* expr); | 293 Handle<Map> GetCompareMap(CompareOperation* expr); |
| 294 TypeInfo SwitchType(CaseClause* clause); | 294 TypeInfo SwitchType(CaseClause* clause); |
| 295 TypeInfo IncrementType(CountOperation* expr); | 295 TypeInfo IncrementType(CountOperation* expr); |
| 296 | 296 |
| 297 Zone* zone() const { return zone_; } | 297 Zone* zone() const { return zone_; } |
| 298 | 298 |
| 299 private: | 299 private: |
| 300 void CollectReceiverTypes(unsigned ast_id, | 300 void CollectReceiverTypes(TypeFeedbackId ast_id, |
| 301 Handle<String> name, | 301 Handle<String> name, |
| 302 Code::Flags flags, | 302 Code::Flags flags, |
| 303 SmallMapList* types); | 303 SmallMapList* types); |
| 304 | 304 |
| 305 void SetInfo(unsigned ast_id, Object* target); | 305 void SetInfo(TypeFeedbackId ast_id, Object* target); |
| 306 | 306 |
| 307 void BuildDictionary(Handle<Code> code); | 307 void BuildDictionary(Handle<Code> code); |
| 308 void GetRelocInfos(Handle<Code> code, ZoneList<RelocInfo>* infos); | 308 void GetRelocInfos(Handle<Code> code, ZoneList<RelocInfo>* infos); |
| 309 void CreateDictionary(Handle<Code> code, ZoneList<RelocInfo>* infos); | 309 void CreateDictionary(Handle<Code> code, ZoneList<RelocInfo>* infos); |
| 310 void RelocateRelocInfos(ZoneList<RelocInfo>* infos, | 310 void RelocateRelocInfos(ZoneList<RelocInfo>* infos, |
| 311 byte* old_start, | 311 byte* old_start, |
| 312 byte* new_start); | 312 byte* new_start); |
| 313 void ProcessRelocInfos(ZoneList<RelocInfo>* infos); | 313 void ProcessRelocInfos(ZoneList<RelocInfo>* infos); |
| 314 void ProcessTypeFeedbackCells(Handle<Code> code); | 314 void ProcessTypeFeedbackCells(Handle<Code> code); |
| 315 | 315 |
| 316 // Returns an element from the backing store. Returns undefined if | 316 // Returns an element from the backing store. Returns undefined if |
| 317 // there is no information. | 317 // there is no information. |
| 318 Handle<Object> GetInfo(unsigned ast_id); | 318 Handle<Object> GetInfo(TypeFeedbackId ast_id); |
| 319 | 319 |
| 320 Handle<Context> global_context_; | 320 Handle<Context> global_context_; |
| 321 Isolate* isolate_; | 321 Isolate* isolate_; |
| 322 Handle<UnseededNumberDictionary> dictionary_; | 322 Handle<UnseededNumberDictionary> dictionary_; |
| 323 Zone* zone_; | 323 Zone* zone_; |
| 324 | 324 |
| 325 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); | 325 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); |
| 326 }; | 326 }; |
| 327 | 327 |
| 328 } } // namespace v8::internal | 328 } } // namespace v8::internal |
| 329 | 329 |
| 330 #endif // V8_TYPE_INFO_H_ | 330 #endif // V8_TYPE_INFO_H_ |
| OLD | NEW |