| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 18 matching lines...) Expand all Loading... |
| 29 #define V8_TYPE_INFO_H_ | 29 #define V8_TYPE_INFO_H_ |
| 30 | 30 |
| 31 #include "allocation.h" | 31 #include "allocation.h" |
| 32 #include "globals.h" | 32 #include "globals.h" |
| 33 #include "zone.h" | 33 #include "zone.h" |
| 34 #include "zone-inl.h" | 34 #include "zone-inl.h" |
| 35 | 35 |
| 36 namespace v8 { | 36 namespace v8 { |
| 37 namespace internal { | 37 namespace internal { |
| 38 | 38 |
| 39 const int kMaxKeyedPolymorphism = 4; |
| 40 |
| 39 // Unknown | 41 // Unknown |
| 40 // | \____________ | 42 // | \____________ |
| 41 // | | | 43 // | | |
| 42 // Primitive Non-primitive | 44 // Primitive Non-primitive |
| 43 // | \_______ | | 45 // | \_______ | |
| 44 // | | | | 46 // | | | |
| 45 // Number String | | 47 // Number String | |
| 46 // / \ | | | 48 // / \ | | |
| 47 // Double Integer32 | / | 49 // Double Integer32 | / |
| 48 // | | / / | 50 // | | / / |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 class CompareOperation; | 210 class CompareOperation; |
| 209 class CountOperation; | 211 class CountOperation; |
| 210 class CompilationInfo; | 212 class CompilationInfo; |
| 211 class Property; | 213 class Property; |
| 212 class CaseClause; | 214 class CaseClause; |
| 213 | 215 |
| 214 class TypeFeedbackOracle BASE_EMBEDDED { | 216 class TypeFeedbackOracle BASE_EMBEDDED { |
| 215 public: | 217 public: |
| 216 TypeFeedbackOracle(Handle<Code> code, Handle<Context> global_context); | 218 TypeFeedbackOracle(Handle<Code> code, Handle<Context> global_context); |
| 217 | 219 |
| 218 bool LoadIsMonomorphic(Property* expr); | 220 bool LoadIsMonomorphicNormal(Property* expr); |
| 219 bool StoreIsMonomorphic(Expression* expr); | 221 bool LoadIsMegamorphicWithTypeInfo(Property* expr); |
| 222 bool StoreIsMonomorphicNormal(Expression* expr); |
| 223 bool StoreIsMegamorphicWithTypeInfo(Expression* expr); |
| 220 bool CallIsMonomorphic(Call* expr); | 224 bool CallIsMonomorphic(Call* expr); |
| 221 | 225 |
| 222 Handle<Map> LoadMonomorphicReceiverType(Property* expr); | 226 Handle<Map> LoadMonomorphicReceiverType(Property* expr); |
| 223 Handle<Map> StoreMonomorphicReceiverType(Expression* expr); | 227 Handle<Map> StoreMonomorphicReceiverType(Expression* expr); |
| 224 | 228 |
| 225 ZoneMapList* LoadReceiverTypes(Property* expr, Handle<String> name); | 229 ZoneMapList* LoadReceiverTypes(Property* expr, Handle<String> name); |
| 226 ZoneMapList* StoreReceiverTypes(Assignment* expr, Handle<String> name); | 230 ZoneMapList* StoreReceiverTypes(Assignment* expr, Handle<String> name); |
| 227 ZoneMapList* CallReceiverTypes(Call* expr, | 231 ZoneMapList* CallReceiverTypes(Call* expr, |
| 228 Handle<String> name, | 232 Handle<String> name, |
| 229 CallKind call_kind); | 233 CallKind call_kind); |
| 230 | 234 void CollectKeyedReceiverTypes(unsigned ast_id, |
| 231 ExternalArrayType GetKeyedLoadExternalArrayType(Property* expr); | 235 ZoneMapList* types); |
| 232 ExternalArrayType GetKeyedStoreExternalArrayType(Expression* expr); | |
| 233 | 236 |
| 234 CheckType GetCallCheckType(Call* expr); | 237 CheckType GetCallCheckType(Call* expr); |
| 235 Handle<JSObject> GetPrototypeForPrimitiveCheck(CheckType check); | 238 Handle<JSObject> GetPrototypeForPrimitiveCheck(CheckType check); |
| 236 | 239 |
| 237 bool LoadIsBuiltin(Property* expr, Builtins::Name id); | 240 bool LoadIsBuiltin(Property* expr, Builtins::Name id); |
| 238 | 241 |
| 239 // Get type information for arithmetic operations and compares. | 242 // Get type information for arithmetic operations and compares. |
| 240 TypeInfo UnaryType(UnaryOperation* expr); | 243 TypeInfo UnaryType(UnaryOperation* expr); |
| 241 TypeInfo BinaryType(BinaryOperation* expr); | 244 TypeInfo BinaryType(BinaryOperation* expr); |
| 242 TypeInfo CompareType(CompareOperation* expr); | 245 TypeInfo CompareType(CompareOperation* expr); |
| 243 bool IsSymbolCompare(CompareOperation* expr); | 246 bool IsSymbolCompare(CompareOperation* expr); |
| 244 TypeInfo SwitchType(CaseClause* clause); | 247 TypeInfo SwitchType(CaseClause* clause); |
| 245 TypeInfo IncrementType(CountOperation* expr); | 248 TypeInfo IncrementType(CountOperation* expr); |
| 246 | 249 |
| 247 private: | 250 private: |
| 248 ZoneMapList* CollectReceiverTypes(unsigned ast_id, | 251 ZoneMapList* CollectReceiverTypes(unsigned ast_id, |
| 249 Handle<String> name, | 252 Handle<String> name, |
| 250 Code::Flags flags); | 253 Code::Flags flags); |
| 251 | 254 |
| 252 void SetInfo(unsigned ast_id, Object* target); | 255 void SetInfo(unsigned ast_id, Object* target); |
| 253 | 256 |
| 254 void PopulateMap(Handle<Code> code); | 257 void BuildDictionary(Handle<Code> code); |
| 255 | 258 void GetRelocInfos(Handle<Code> code, ZoneList<RelocInfo>* infos); |
| 256 void CollectIds(Code* code, | 259 void CreateDictionary(Handle<Code> code, ZoneList<RelocInfo>* infos); |
| 257 List<int>* code_positions, | 260 void RelocateRelocInfos(ZoneList<RelocInfo>* infos, |
| 258 List<unsigned>* ast_ids); | 261 byte* old_start, |
| 262 byte* new_start); |
| 263 void ProcessRelocInfos(ZoneList<RelocInfo>* infos); |
| 264 void ProcessTarget(unsigned ast_id, Code* target); |
| 259 | 265 |
| 260 // Returns an element from the backing store. Returns undefined if | 266 // Returns an element from the backing store. Returns undefined if |
| 261 // there is no information. | 267 // there is no information. |
| 262 Handle<Object> GetInfo(unsigned ast_id); | 268 Handle<Object> GetInfo(unsigned ast_id); |
| 263 | 269 |
| 264 Handle<Context> global_context_; | 270 Handle<Context> global_context_; |
| 265 Handle<NumberDictionary> dictionary_; | 271 Handle<NumberDictionary> dictionary_; |
| 266 | 272 |
| 267 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); | 273 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); |
| 268 }; | 274 }; |
| 269 | 275 |
| 270 } } // namespace v8::internal | 276 } } // namespace v8::internal |
| 271 | 277 |
| 272 #endif // V8_TYPE_INFO_H_ | 278 #endif // V8_TYPE_INFO_H_ |
| OLD | NEW |