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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 return *GetInfo(expr->PropertyFeedbackId()) == | 301 return *GetInfo(expr->PropertyFeedbackId()) == |
302 isolate_->builtins()->builtin(id); | 302 isolate_->builtins()->builtin(id); |
303 } | 303 } |
304 | 304 |
305 | 305 |
306 bool TypeFeedbackOracle::LoadIsStub(Property* expr, ICStub* stub) { | 306 bool TypeFeedbackOracle::LoadIsStub(Property* expr, ICStub* stub) { |
307 Handle<Object> object = GetInfo(expr->PropertyFeedbackId()); | 307 Handle<Object> object = GetInfo(expr->PropertyFeedbackId()); |
308 if (!object->IsCode()) return false; | 308 if (!object->IsCode()) return false; |
309 Handle<Code> code = Handle<Code>::cast(object); | 309 Handle<Code> code = Handle<Code>::cast(object); |
310 if (!code->is_load_stub()) return false; | 310 if (!code->is_load_stub()) return false; |
311 if (code->ic_state() != MONOMORPHIC) return false; | |
311 return stub->Describes(*code); | 312 return stub->Describes(*code); |
312 } | 313 } |
313 | 314 |
314 | 315 |
315 static TypeInfo TypeFromCompareType(CompareIC::State state) { | 316 static TypeInfo TypeFromCompareType(CompareIC::State state) { |
316 switch (state) { | 317 switch (state) { |
317 case CompareIC::UNINITIALIZED: | 318 case CompareIC::UNINITIALIZED: |
318 // Uninitialized means never executed. | 319 // Uninitialized means never executed. |
319 return TypeInfo::Uninitialized(); | 320 return TypeInfo::Uninitialized(); |
320 case CompareIC::SMI: | 321 case CompareIC::SMI: |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
490 SmallMapList* types) { | 491 SmallMapList* types) { |
491 Handle<Object> object = GetInfo(ast_id); | 492 Handle<Object> object = GetInfo(ast_id); |
492 if (object->IsUndefined() || object->IsSmi()) return; | 493 if (object->IsUndefined() || object->IsSmi()) return; |
493 | 494 |
494 if (object.is_identical_to(isolate_->builtins()->StoreIC_GlobalProxy())) { | 495 if (object.is_identical_to(isolate_->builtins()->StoreIC_GlobalProxy())) { |
495 // TODO(fschneider): We could collect the maps and signal that | 496 // TODO(fschneider): We could collect the maps and signal that |
496 // we need a generic store (or load) here. | 497 // we need a generic store (or load) here. |
497 ASSERT(Handle<Code>::cast(object)->ic_state() == GENERIC); | 498 ASSERT(Handle<Code>::cast(object)->ic_state() == GENERIC); |
498 } else if (object->IsMap()) { | 499 } else if (object->IsMap()) { |
499 types->Add(Handle<Map>::cast(object), zone()); | 500 types->Add(Handle<Map>::cast(object), zone()); |
501 } else if (Handle<Code>::cast(object)->ic_state() == POLYMORPHIC) { | |
502 MapHandleList maps; | |
503 Handle<Code>::cast(object)->FindAllMaps(&maps); | |
504 types->Reserve(maps.length(), zone()); | |
505 for (int i = 0; i < maps.length(); i++) { | |
506 types->Add(maps.at(i), zone()); | |
Jakob Kummerow
2013/03/01 22:21:04
Please compare this with CollectKeyedReceiverTypes
Toon Verwaest
2013/03/04 10:54:08
Done.
| |
507 } | |
500 } else if (FLAG_collect_megamorphic_maps_from_stub_cache && | 508 } else if (FLAG_collect_megamorphic_maps_from_stub_cache && |
501 Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC) { | 509 Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC) { |
502 types->Reserve(4, zone()); | 510 types->Reserve(4, zone()); |
503 ASSERT(object->IsCode()); | 511 ASSERT(object->IsCode()); |
504 isolate_->stub_cache()->CollectMatchingMaps(types, | 512 isolate_->stub_cache()->CollectMatchingMaps(types, |
505 *name, | 513 *name, |
506 flags, | 514 flags, |
507 native_context_, | 515 native_context_, |
508 zone()); | 516 zone()); |
509 } | 517 } |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
710 USE(maybe_result); | 718 USE(maybe_result); |
711 #ifdef DEBUG | 719 #ifdef DEBUG |
712 Object* result = NULL; | 720 Object* result = NULL; |
713 // Dictionary has been allocated with sufficient size for all elements. | 721 // Dictionary has been allocated with sufficient size for all elements. |
714 ASSERT(maybe_result->ToObject(&result)); | 722 ASSERT(maybe_result->ToObject(&result)); |
715 ASSERT(*dictionary_ == result); | 723 ASSERT(*dictionary_ == result); |
716 #endif | 724 #endif |
717 } | 725 } |
718 | 726 |
719 } } // namespace v8::internal | 727 } } // namespace v8::internal |
OLD | NEW |