| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 } | 681 } |
| 682 | 682 |
| 683 | 683 |
| 684 void Heap::MarkCompactPrologue(bool is_compacting) { | 684 void Heap::MarkCompactPrologue(bool is_compacting) { |
| 685 // At any old GC clear the keyed lookup cache to enable collection of unused | 685 // At any old GC clear the keyed lookup cache to enable collection of unused |
| 686 // maps. | 686 // maps. |
| 687 isolate_->keyed_lookup_cache()->Clear(); | 687 isolate_->keyed_lookup_cache()->Clear(); |
| 688 isolate_->context_slot_cache()->Clear(); | 688 isolate_->context_slot_cache()->Clear(); |
| 689 isolate_->descriptor_lookup_cache()->Clear(); | 689 isolate_->descriptor_lookup_cache()->Clear(); |
| 690 | 690 |
| 691 CompilationCache::MarkCompactPrologue(); | 691 isolate_->compilation_cache()->MarkCompactPrologue(); |
| 692 | 692 |
| 693 Top::MarkCompactPrologue(is_compacting); | 693 Top::MarkCompactPrologue(is_compacting); |
| 694 ThreadManager::MarkCompactPrologue(is_compacting); | 694 ThreadManager::MarkCompactPrologue(is_compacting); |
| 695 | 695 |
| 696 CompletelyClearInstanceofCache(); | 696 CompletelyClearInstanceofCache(); |
| 697 | 697 |
| 698 if (is_compacting) THIS->FlushNumberStringCache(); | 698 if (is_compacting) THIS->FlushNumberStringCache(); |
| 699 } | 699 } |
| 700 | 700 |
| 701 | 701 |
| (...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1651 // Initialize keyed lookup cache. | 1651 // Initialize keyed lookup cache. |
| 1652 isolate_->keyed_lookup_cache()->Clear(); | 1652 isolate_->keyed_lookup_cache()->Clear(); |
| 1653 | 1653 |
| 1654 // Initialize context slot cache. | 1654 // Initialize context slot cache. |
| 1655 isolate_->context_slot_cache()->Clear(); | 1655 isolate_->context_slot_cache()->Clear(); |
| 1656 | 1656 |
| 1657 // Initialize descriptor cache. | 1657 // Initialize descriptor cache. |
| 1658 isolate_->descriptor_lookup_cache()->Clear(); | 1658 isolate_->descriptor_lookup_cache()->Clear(); |
| 1659 | 1659 |
| 1660 // Initialize compilation cache. | 1660 // Initialize compilation cache. |
| 1661 CompilationCache::Clear(); | 1661 isolate_->compilation_cache()->Clear(); |
| 1662 | 1662 |
| 1663 return true; | 1663 return true; |
| 1664 } | 1664 } |
| 1665 | 1665 |
| 1666 | 1666 |
| 1667 Object* Heap::InitializeNumberStringCache() { | 1667 Object* Heap::InitializeNumberStringCache() { |
| 1668 // Compute the size of the number string cache based on the max heap size. | 1668 // Compute the size of the number string cache based on the max heap size. |
| 1669 // max_semispace_size_ == 512 KB => number_string_cache_size = 32. | 1669 // max_semispace_size_ == 512 KB => number_string_cache_size = 32. |
| 1670 // max_semispace_size_ == 8 MB => number_string_cache_size = 16KB. | 1670 // max_semispace_size_ == 8 MB => number_string_cache_size = 16KB. |
| 1671 int number_string_cache_size = max_semispace_size_ / 512; | 1671 int number_string_cache_size = max_semispace_size_ / 512; |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2215 // Only flush code for functions. | 2215 // Only flush code for functions. |
| 2216 if (!function_info->code()->kind() == Code::FUNCTION) return; | 2216 if (!function_info->code()->kind() == Code::FUNCTION) return; |
| 2217 | 2217 |
| 2218 // Function must be lazy compilable. | 2218 // Function must be lazy compilable. |
| 2219 if (!function_info->allows_lazy_compilation()) return; | 2219 if (!function_info->allows_lazy_compilation()) return; |
| 2220 | 2220 |
| 2221 // If this is a full script wrapped in a function we do no flush the code. | 2221 // If this is a full script wrapped in a function we do no flush the code. |
| 2222 if (function_info->is_toplevel()) return; | 2222 if (function_info->is_toplevel()) return; |
| 2223 | 2223 |
| 2224 // If this function is in the compilation cache we do not flush the code. | 2224 // If this function is in the compilation cache we do not flush the code. |
| 2225 if (CompilationCache::HasFunction(function_info)) return; | 2225 if (Isolate::Current()->compilation_cache()->HasFunction(function_info)) |
| 2226 return; |
| 2226 | 2227 |
| 2227 // Make sure we are not referencing the code from the stack. | 2228 // Make sure we are not referencing the code from the stack. |
| 2228 for (StackFrameIterator it; !it.done(); it.Advance()) { | 2229 for (StackFrameIterator it; !it.done(); it.Advance()) { |
| 2229 if (function_info->code()->contains(it.frame()->pc())) return; | 2230 if (function_info->code()->contains(it.frame()->pc())) return; |
| 2230 } | 2231 } |
| 2231 // Iterate the archived stacks in all threads to check if | 2232 // Iterate the archived stacks in all threads to check if |
| 2232 // the code is referenced. | 2233 // the code is referenced. |
| 2233 FlushingStackVisitor threadvisitor(function_info->code()); | 2234 FlushingStackVisitor threadvisitor(function_info->code()); |
| 2234 ThreadManager::IterateArchivedThreads(&threadvisitor); | 2235 ThreadManager::IterateArchivedThreads(&threadvisitor); |
| 2235 if (threadvisitor.FoundCode()) return; | 2236 if (threadvisitor.FoundCode()) return; |
| (...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3217 } else { | 3218 } else { |
| 3218 CollectGarbage(0, NEW_SPACE); | 3219 CollectGarbage(0, NEW_SPACE); |
| 3219 } | 3220 } |
| 3220 new_space_.Shrink(); | 3221 new_space_.Shrink(); |
| 3221 last_gc_count = gc_count_; | 3222 last_gc_count = gc_count_; |
| 3222 | 3223 |
| 3223 } else if (number_idle_notifications == kIdlesBeforeMarkSweep) { | 3224 } else if (number_idle_notifications == kIdlesBeforeMarkSweep) { |
| 3224 // Before doing the mark-sweep collections we clear the | 3225 // Before doing the mark-sweep collections we clear the |
| 3225 // compilation cache to avoid hanging on to source code and | 3226 // compilation cache to avoid hanging on to source code and |
| 3226 // generated code for cached functions. | 3227 // generated code for cached functions. |
| 3227 CompilationCache::Clear(); | 3228 isolate_->compilation_cache()->Clear(); |
| 3228 | 3229 |
| 3229 CollectAllGarbage(false); | 3230 CollectAllGarbage(false); |
| 3230 new_space_.Shrink(); | 3231 new_space_.Shrink(); |
| 3231 last_gc_count = gc_count_; | 3232 last_gc_count = gc_count_; |
| 3232 | 3233 |
| 3233 } else if (number_idle_notifications == kIdlesBeforeMarkCompact) { | 3234 } else if (number_idle_notifications == kIdlesBeforeMarkCompact) { |
| 3234 CollectAllGarbage(true); | 3235 CollectAllGarbage(true); |
| 3235 new_space_.Shrink(); | 3236 new_space_.Shrink(); |
| 3236 last_gc_count = gc_count_; | 3237 last_gc_count = gc_count_; |
| 3237 number_idle_notifications = 0; | 3238 number_idle_notifications = 0; |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3771 v->Synchronize("bootstrapper"); | 3772 v->Synchronize("bootstrapper"); |
| 3772 Top::Iterate(v); | 3773 Top::Iterate(v); |
| 3773 v->Synchronize("top"); | 3774 v->Synchronize("top"); |
| 3774 Relocatable::Iterate(v); | 3775 Relocatable::Iterate(v); |
| 3775 v->Synchronize("relocatable"); | 3776 v->Synchronize("relocatable"); |
| 3776 | 3777 |
| 3777 #ifdef ENABLE_DEBUGGER_SUPPORT | 3778 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 3778 Debug::Iterate(v); | 3779 Debug::Iterate(v); |
| 3779 #endif | 3780 #endif |
| 3780 v->Synchronize("debug"); | 3781 v->Synchronize("debug"); |
| 3781 CompilationCache::Iterate(v); | 3782 isolate_->compilation_cache()->Iterate(v); |
| 3782 v->Synchronize("compilationcache"); | 3783 v->Synchronize("compilationcache"); |
| 3783 | 3784 |
| 3784 // Iterate over local handles in handle scopes. | 3785 // Iterate over local handles in handle scopes. |
| 3785 isolate->handle_scope_implementer()->Iterate(v); | 3786 isolate->handle_scope_implementer()->Iterate(v); |
| 3786 v->Synchronize("handlescope"); | 3787 v->Synchronize("handlescope"); |
| 3787 | 3788 |
| 3788 // Iterate over the builtin code objects and code stubs in the | 3789 // Iterate over the builtin code objects and code stubs in the |
| 3789 // heap. Note that it is not necessary to iterate over code objects | 3790 // heap. Note that it is not necessary to iterate over code objects |
| 3790 // on scavenge collections. | 3791 // on scavenge collections. |
| 3791 if (mode != VISIT_ALL_IN_SCAVENGE) { | 3792 if (mode != VISIT_ALL_IN_SCAVENGE) { |
| (...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4736 void ExternalStringTable::TearDown() { | 4737 void ExternalStringTable::TearDown() { |
| 4737 new_space_strings_.Free(); | 4738 new_space_strings_.Free(); |
| 4738 old_space_strings_.Free(); | 4739 old_space_strings_.Free(); |
| 4739 } | 4740 } |
| 4740 | 4741 |
| 4741 | 4742 |
| 4742 List<Object*> ExternalStringTable::new_space_strings_; | 4743 List<Object*> ExternalStringTable::new_space_strings_; |
| 4743 List<Object*> ExternalStringTable::old_space_strings_; | 4744 List<Object*> ExternalStringTable::old_space_strings_; |
| 4744 | 4745 |
| 4745 } } // namespace v8::internal | 4746 } } // namespace v8::internal |
| OLD | NEW |