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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 default: | 534 default: |
535 return unknown; | 535 return unknown; |
536 } | 536 } |
537 UNREACHABLE(); | 537 UNREACHABLE(); |
538 return unknown; | 538 return unknown; |
539 } | 539 } |
540 | 540 |
541 | 541 |
542 static void AddMapIfMissing(Handle<Map> map, SmallMapList* list, | 542 static void AddMapIfMissing(Handle<Map> map, SmallMapList* list, |
543 Zone* zone) { | 543 Zone* zone) { |
| 544 map = Map::Update(map); |
544 for (int i = 0; i < list->length(); ++i) { | 545 for (int i = 0; i < list->length(); ++i) { |
545 if (list->at(i).is_identical_to(map)) return; | 546 if (list->at(i).is_identical_to(map)) return; |
546 } | 547 } |
547 list->Add(map, zone); | 548 list->Add(map, zone); |
548 } | 549 } |
549 | 550 |
550 | 551 |
551 void TypeFeedbackOracle::CollectPolymorphicMaps(Handle<Code> code, | 552 void TypeFeedbackOracle::CollectPolymorphicMaps(Handle<Code> code, |
552 SmallMapList* types) { | 553 SmallMapList* types) { |
553 MapHandleList maps; | 554 MapHandleList maps; |
(...skipping 13 matching lines...) Expand all Loading... |
567 Code::Flags flags, | 568 Code::Flags flags, |
568 SmallMapList* types) { | 569 SmallMapList* types) { |
569 Handle<Object> object = GetInfo(ast_id); | 570 Handle<Object> object = GetInfo(ast_id); |
570 if (object->IsUndefined() || object->IsSmi()) return; | 571 if (object->IsUndefined() || object->IsSmi()) return; |
571 | 572 |
572 if (object.is_identical_to(isolate_->builtins()->StoreIC_GlobalProxy())) { | 573 if (object.is_identical_to(isolate_->builtins()->StoreIC_GlobalProxy())) { |
573 // TODO(fschneider): We could collect the maps and signal that | 574 // TODO(fschneider): We could collect the maps and signal that |
574 // we need a generic store (or load) here. | 575 // we need a generic store (or load) here. |
575 ASSERT(Handle<Code>::cast(object)->ic_state() == GENERIC); | 576 ASSERT(Handle<Code>::cast(object)->ic_state() == GENERIC); |
576 } else if (object->IsMap()) { | 577 } else if (object->IsMap()) { |
577 types->Add(Handle<Map>::cast(object), zone()); | 578 AddMapIfMissing(Handle<Map>::cast(object), types, zone()); |
578 } else if (Handle<Code>::cast(object)->ic_state() == POLYMORPHIC) { | 579 } else if (Handle<Code>::cast(object)->ic_state() == POLYMORPHIC) { |
579 CollectPolymorphicMaps(Handle<Code>::cast(object), types); | 580 CollectPolymorphicMaps(Handle<Code>::cast(object), types); |
580 } else if (FLAG_collect_megamorphic_maps_from_stub_cache && | 581 } else if (FLAG_collect_megamorphic_maps_from_stub_cache && |
581 Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC) { | 582 Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC) { |
582 types->Reserve(4, zone()); | 583 types->Reserve(4, zone()); |
583 ASSERT(object->IsCode()); | 584 ASSERT(object->IsCode()); |
584 isolate_->stub_cache()->CollectMatchingMaps(types, | 585 isolate_->stub_cache()->CollectMatchingMaps(types, |
585 *name, | 586 name, |
586 flags, | 587 flags, |
587 native_context_, | 588 native_context_, |
588 zone()); | 589 zone()); |
589 } | 590 } |
590 } | 591 } |
591 | 592 |
592 | 593 |
593 // Check if a map originates from a given native context. We use this | 594 // Check if a map originates from a given native context. We use this |
594 // information to filter out maps from different context to avoid | 595 // information to filter out maps from different context to avoid |
595 // retaining objects from different tabs in Chrome via optimized code. | 596 // retaining objects from different tabs in Chrome via optimized code. |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 USE(maybe_result); | 783 USE(maybe_result); |
783 #ifdef DEBUG | 784 #ifdef DEBUG |
784 Object* result = NULL; | 785 Object* result = NULL; |
785 // Dictionary has been allocated with sufficient size for all elements. | 786 // Dictionary has been allocated with sufficient size for all elements. |
786 ASSERT(maybe_result->ToObject(&result)); | 787 ASSERT(maybe_result->ToObject(&result)); |
787 ASSERT(*dictionary_ == result); | 788 ASSERT(*dictionary_ == result); |
788 #endif | 789 #endif |
789 } | 790 } |
790 | 791 |
791 } } // namespace v8::internal | 792 } } // namespace v8::internal |
OLD | NEW |