| 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 11 matching lines...) Expand all Loading... |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_TYPE_INFO_H_ | 28 #ifndef V8_TYPE_INFO_H_ |
| 29 #define V8_TYPE_INFO_H_ | 29 #define V8_TYPE_INFO_H_ |
| 30 | 30 |
| 31 #include "allocation.h" | 31 #include "allocation.h" |
| 32 #include "ast.h" | |
| 33 #include "globals.h" | 32 #include "globals.h" |
| 34 #include "zone-inl.h" | 33 #include "zone-inl.h" |
| 35 | 34 |
| 36 namespace v8 { | 35 namespace v8 { |
| 37 namespace internal { | 36 namespace internal { |
| 38 | 37 |
| 39 const int kMaxKeyedPolymorphism = 4; | 38 const int kMaxKeyedPolymorphism = 4; |
| 40 | 39 |
| 41 // Unknown | 40 // Unknown |
| 42 // | \____________ | 41 // | \____________ |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 class CaseClause; | 224 class CaseClause; |
| 226 class CompareOperation; | 225 class CompareOperation; |
| 227 class CompilationInfo; | 226 class CompilationInfo; |
| 228 class CountOperation; | 227 class CountOperation; |
| 229 class Expression; | 228 class Expression; |
| 230 class ForInStatement; | 229 class ForInStatement; |
| 231 class ICStub; | 230 class ICStub; |
| 232 class Property; | 231 class Property; |
| 233 class SmallMapList; | 232 class SmallMapList; |
| 234 class UnaryOperation; | 233 class UnaryOperation; |
| 234 class ObjectLiteral; |
| 235 class ObjectLiteralProperty; |
| 235 | 236 |
| 236 | 237 |
| 237 class TypeFeedbackOracle: public ZoneObject { | 238 class TypeFeedbackOracle: public ZoneObject { |
| 238 public: | 239 public: |
| 239 TypeFeedbackOracle(Handle<Code> code, | 240 TypeFeedbackOracle(Handle<Code> code, |
| 240 Handle<Context> native_context, | 241 Handle<Context> native_context, |
| 241 Isolate* isolate, | 242 Isolate* isolate, |
| 242 Zone* zone); | 243 Zone* zone); |
| 243 | 244 |
| 244 bool LoadIsMonomorphicNormal(Property* expr); | 245 bool LoadIsMonomorphicNormal(Property* expr); |
| 245 bool LoadIsUninitialized(Property* expr); | 246 bool LoadIsUninitialized(Property* expr); |
| 246 bool LoadIsPolymorphic(Property* expr); | 247 bool LoadIsPolymorphic(Property* expr); |
| 247 bool StoreIsMonomorphicNormal(TypeFeedbackId ast_id); | 248 bool StoreIsMonomorphicNormal(TypeFeedbackId ast_id); |
| 248 bool StoreIsPolymorphic(TypeFeedbackId ast_id); | 249 bool StoreIsPolymorphic(TypeFeedbackId ast_id); |
| 249 bool CallIsMonomorphic(Call* expr); | 250 bool CallIsMonomorphic(Call* expr); |
| 250 bool CallNewIsMonomorphic(CallNew* expr); | 251 bool CallNewIsMonomorphic(CallNew* expr); |
| 251 bool ObjectLiteralStoreIsMonomorphic(ObjectLiteral::Property* prop); | 252 bool ObjectLiteralStoreIsMonomorphic(ObjectLiteralProperty* prop); |
| 252 | 253 |
| 253 bool IsForInFastCase(ForInStatement* expr); | 254 // TODO(1571) We can't use ForInStatement::ForInType as the return value due |
| 255 // to various cycles in our headers. |
| 256 byte ForInType(ForInStatement* expr); |
| 254 | 257 |
| 255 Handle<Map> LoadMonomorphicReceiverType(Property* expr); | 258 Handle<Map> LoadMonomorphicReceiverType(Property* expr); |
| 256 Handle<Map> StoreMonomorphicReceiverType(TypeFeedbackId id); | 259 Handle<Map> StoreMonomorphicReceiverType(TypeFeedbackId id); |
| 257 Handle<Map> CompareNilMonomorphicReceiverType(TypeFeedbackId id); | 260 Handle<Map> CompareNilMonomorphicReceiverType(CompareOperation* expr); |
| 258 | 261 |
| 259 KeyedAccessStoreMode GetStoreMode(TypeFeedbackId ast_id); | 262 KeyedAccessStoreMode GetStoreMode(TypeFeedbackId ast_id); |
| 260 | 263 |
| 261 void LoadReceiverTypes(Property* expr, | 264 void LoadReceiverTypes(Property* expr, |
| 262 Handle<String> name, | 265 Handle<String> name, |
| 263 SmallMapList* types); | 266 SmallMapList* types); |
| 264 void StoreReceiverTypes(Assignment* expr, | 267 void StoreReceiverTypes(Assignment* expr, |
| 265 Handle<String> name, | 268 Handle<String> name, |
| 266 SmallMapList* types); | 269 SmallMapList* types); |
| 267 void CallReceiverTypes(Call* expr, | 270 void CallReceiverTypes(Call* expr, |
| 268 Handle<String> name, | 271 Handle<String> name, |
| 269 CallKind call_kind, | 272 CallKind call_kind, |
| 270 SmallMapList* types); | 273 SmallMapList* types); |
| 271 void CollectKeyedReceiverTypes(TypeFeedbackId ast_id, | 274 void CollectKeyedReceiverTypes(TypeFeedbackId ast_id, |
| 272 SmallMapList* types); | 275 SmallMapList* types); |
| 273 | 276 |
| 274 static bool CanRetainOtherContext(Map* map, Context* native_context); | 277 static bool CanRetainOtherContext(Map* map, Context* native_context); |
| 275 static bool CanRetainOtherContext(JSFunction* function, | 278 static bool CanRetainOtherContext(JSFunction* function, |
| 276 Context* native_context); | 279 Context* native_context); |
| 277 | 280 |
| 278 void CollectPolymorphicMaps(Handle<Code> code, SmallMapList* types); | 281 void CollectPolymorphicMaps(Handle<Code> code, SmallMapList* types); |
| 279 | 282 |
| 280 CheckType GetCallCheckType(Call* expr); | 283 CheckType GetCallCheckType(Call* expr); |
| 281 Handle<JSObject> GetPrototypeForPrimitiveCheck(CheckType check); | |
| 282 | |
| 283 Handle<JSFunction> GetCallTarget(Call* expr); | 284 Handle<JSFunction> GetCallTarget(Call* expr); |
| 284 Handle<JSFunction> GetCallNewTarget(CallNew* expr); | 285 Handle<JSFunction> GetCallNewTarget(CallNew* expr); |
| 285 ElementsKind GetCallNewElementsKind(CallNew* expr); | 286 ElementsKind GetCallNewElementsKind(CallNew* expr); |
| 286 | 287 |
| 287 Handle<Map> GetObjectLiteralStoreMap(ObjectLiteral::Property* prop); | 288 Handle<Map> GetObjectLiteralStoreMap(ObjectLiteralProperty* prop); |
| 288 | 289 |
| 289 bool LoadIsBuiltin(Property* expr, Builtins::Name id); | 290 bool LoadIsBuiltin(Property* expr, Builtins::Name id); |
| 290 bool LoadIsStub(Property* expr, ICStub* stub); | 291 bool LoadIsStub(Property* expr, ICStub* stub); |
| 291 | 292 |
| 292 // TODO(1571) We can't use ToBooleanStub::Types as the return value because | 293 // TODO(1571) We can't use ToBooleanStub::Types as the return value because |
| 293 // of various cylces in our headers. Death to tons of implementations in | 294 // of various cycles in our headers. Death to tons of implementations in |
| 294 // headers!! :-P | 295 // headers!! :-P |
| 295 byte ToBooleanTypes(TypeFeedbackId ast_id); | 296 byte ToBooleanTypes(TypeFeedbackId ast_id); |
| 296 | 297 |
| 297 // TODO(1571) We can't use CompareNilICStub::Types as the return value because | 298 // TODO(1571) We can't use CompareNilICStub::Types as the return value because |
| 298 // of various cylces in our headers. Death to tons of implementations in | 299 // of various cylces in our headers. Death to tons of implementations in |
| 299 // headers!! :-P | 300 // headers!! :-P |
| 300 byte CompareNilTypes(TypeFeedbackId ast_id); | 301 byte CompareNilTypes(CompareOperation* expr); |
| 301 | 302 |
| 302 // Get type information for arithmetic operations and compares. | 303 // Get type information for arithmetic operations and compares. |
| 303 TypeInfo UnaryType(UnaryOperation* expr); | 304 TypeInfo UnaryType(UnaryOperation* expr); |
| 304 void BinaryType(BinaryOperation* expr, | 305 void BinaryType(BinaryOperation* expr, |
| 305 TypeInfo* left, | 306 TypeInfo* left, |
| 306 TypeInfo* right, | 307 TypeInfo* right, |
| 307 TypeInfo* result); | 308 TypeInfo* result); |
| 308 void CompareType(CompareOperation* expr, | 309 void CompareType(CompareOperation* expr, |
| 309 TypeInfo* left_type, | 310 TypeInfo* left_type, |
| 310 TypeInfo* right_type, | 311 TypeInfo* right_type, |
| 311 TypeInfo* overall_type); | 312 TypeInfo* overall_type); |
| 312 Handle<Map> GetCompareMap(CompareOperation* expr); | 313 Handle<Map> GetCompareMap(CompareOperation* expr); |
| 313 TypeInfo SwitchType(CaseClause* clause); | 314 TypeInfo SwitchType(CaseClause* clause); |
| 314 TypeInfo IncrementType(CountOperation* expr); | 315 TypeInfo IncrementType(CountOperation* expr); |
| 315 | 316 |
| 316 Zone* zone() const { return zone_; } | 317 Zone* zone() const { return zone_; } |
| 318 Isolate* isolate() const { return isolate_; } |
| 317 | 319 |
| 318 private: | 320 private: |
| 319 void CollectReceiverTypes(TypeFeedbackId ast_id, | 321 void CollectReceiverTypes(TypeFeedbackId ast_id, |
| 320 Handle<String> name, | 322 Handle<String> name, |
| 321 Code::Flags flags, | 323 Code::Flags flags, |
| 322 SmallMapList* types); | 324 SmallMapList* types); |
| 323 | 325 |
| 324 void SetInfo(TypeFeedbackId ast_id, Object* target); | 326 void SetInfo(TypeFeedbackId ast_id, Object* target); |
| 325 | 327 |
| 326 void BuildDictionary(Handle<Code> code); | 328 void BuildDictionary(Handle<Code> code); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 344 Isolate* isolate_; | 346 Isolate* isolate_; |
| 345 Zone* zone_; | 347 Zone* zone_; |
| 346 Handle<UnseededNumberDictionary> dictionary_; | 348 Handle<UnseededNumberDictionary> dictionary_; |
| 347 | 349 |
| 348 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); | 350 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); |
| 349 }; | 351 }; |
| 350 | 352 |
| 351 } } // namespace v8::internal | 353 } } // namespace v8::internal |
| 352 | 354 |
| 353 #endif // V8_TYPE_INFO_H_ | 355 #endif // V8_TYPE_INFO_H_ |
| OLD | NEW |