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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
637 } | 637 } |
638 | 638 |
639 | 639 |
640 void Heap::ClearJSFunctionResultCaches() { | 640 void Heap::ClearJSFunctionResultCaches() { |
641 if (isolate_->bootstrapper()->IsActive()) return; | 641 if (isolate_->bootstrapper()->IsActive()) return; |
642 | 642 |
643 Object* context = global_contexts_list_; | 643 Object* context = global_contexts_list_; |
644 while (!context->IsUndefined()) { | 644 while (!context->IsUndefined()) { |
645 // Get the caches for this context: | 645 // Get the caches for this context: |
646 FixedArray* caches = | 646 FixedArray* caches = |
647 Context::cast(context)->jsfunction_result_caches(); | 647 Context::cast(context)->jsfunction_result_caches(); |
Vyacheslav Egorov (Chromium)
2011/12/13 12:26:20
Should not you guard here instead of guarding belo
ulan
2011/12/13 13:02:58
Done.
| |
648 // Clear the caches: | 648 // Clear the caches: |
649 int length = caches->length(); | 649 int length = caches->length(); |
650 for (int i = 0; i < length; i++) { | 650 for (int i = 0; i < length; i++) { |
651 JSFunctionResultCache::cast(caches->get(i))->Clear(); | 651 Object* cache = caches->get(i); |
652 if (!cache->IsUndefined()) { | |
653 JSFunctionResultCache::cast(cache)->Clear(); | |
654 } | |
652 } | 655 } |
653 // Get the next context: | 656 // Get the next context: |
654 context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK); | 657 context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK); |
655 } | 658 } |
656 } | 659 } |
657 | 660 |
658 | 661 |
659 | 662 |
660 void Heap::ClearNormalizedMapCaches() { | 663 void Heap::ClearNormalizedMapCaches() { |
661 if (isolate_->bootstrapper()->IsActive() && | 664 if (isolate_->bootstrapper()->IsActive() && |
662 !incremental_marking()->IsMarking()) { | 665 !incremental_marking()->IsMarking()) { |
663 return; | 666 return; |
664 } | 667 } |
665 | 668 |
666 Object* context = global_contexts_list_; | 669 Object* context = global_contexts_list_; |
667 while (!context->IsUndefined()) { | 670 while (!context->IsUndefined()) { |
668 Context::cast(context)->normalized_map_cache()->Clear(); | 671 int index = Context::NORMALIZED_MAP_CACHE_INDEX; |
Vyacheslav Egorov (Chromium)
2011/12/13 12:26:20
I don't think we need separate variable just for i
ulan
2011/12/13 13:02:58
Done.
| |
672 Object* cache = Context::cast(context)->get(index); | |
673 if (!cache->IsUndefined()) { | |
Vyacheslav Egorov (Chromium)
2011/12/13 12:26:20
please comment why we need to guard against partia
ulan
2011/12/13 13:02:58
Done.
| |
674 NormalizedMapCache::cast(cache)->Clear(); | |
675 } | |
669 context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK); | 676 context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK); |
670 } | 677 } |
671 } | 678 } |
672 | 679 |
673 | 680 |
674 void Heap::UpdateSurvivalRateTrend(int start_new_space_size) { | 681 void Heap::UpdateSurvivalRateTrend(int start_new_space_size) { |
675 double survival_rate = | 682 double survival_rate = |
676 (static_cast<double>(young_survivors_after_last_gc_) * 100) / | 683 (static_cast<double>(young_survivors_after_last_gc_) * 100) / |
677 start_new_space_size; | 684 start_new_space_size; |
678 | 685 |
(...skipping 5912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6591 isolate_->heap()->store_buffer()->Compact(); | 6598 isolate_->heap()->store_buffer()->Compact(); |
6592 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6599 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
6593 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6600 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
6594 next = chunk->next_chunk(); | 6601 next = chunk->next_chunk(); |
6595 isolate_->memory_allocator()->Free(chunk); | 6602 isolate_->memory_allocator()->Free(chunk); |
6596 } | 6603 } |
6597 chunks_queued_for_free_ = NULL; | 6604 chunks_queued_for_free_ = NULL; |
6598 } | 6605 } |
6599 | 6606 |
6600 } } // namespace v8::internal | 6607 } } // namespace v8::internal |
OLD | NEW |