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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 void MarkCompactCollector::Finish() { | 828 void MarkCompactCollector::Finish() { |
829 #ifdef DEBUG | 829 #ifdef DEBUG |
830 ASSERT(state_ == SWEEP_SPACES || state_ == RELOCATE_OBJECTS); | 830 ASSERT(state_ == SWEEP_SPACES || state_ == RELOCATE_OBJECTS); |
831 state_ = IDLE; | 831 state_ = IDLE; |
832 #endif | 832 #endif |
833 // The stub cache is not traversed during GC; clear the cache to | 833 // The stub cache is not traversed during GC; clear the cache to |
834 // force lazy re-initialization of it. This must be done after the | 834 // force lazy re-initialization of it. This must be done after the |
835 // GC, because it relies on the new address of certain old space | 835 // GC, because it relies on the new address of certain old space |
836 // objects (empty string, illegal builtin). | 836 // objects (empty string, illegal builtin). |
837 heap()->isolate()->stub_cache()->Clear(); | 837 heap()->isolate()->stub_cache()->Clear(); |
| 838 |
| 839 heap()->external_string_table_.CleanUp(); |
838 } | 840 } |
839 | 841 |
840 | 842 |
841 // ------------------------------------------------------------------------- | 843 // ------------------------------------------------------------------------- |
842 // Phase 1: tracing and marking live objects. | 844 // Phase 1: tracing and marking live objects. |
843 // before: all objects are in normal state. | 845 // before: all objects are in normal state. |
844 // after: a live object's map pointer is marked as '00'. | 846 // after: a live object's map pointer is marked as '00'. |
845 | 847 |
846 // Marking all live objects in the heap as part of mark-sweep or mark-compact | 848 // Marking all live objects in the heap as part of mark-sweep or mark-compact |
847 // collection. Before marking, all objects are in their normal state. After | 849 // collection. Before marking, all objects are in their normal state. After |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 isolate_->heap()->mark_compact_collector()-> | 928 isolate_->heap()->mark_compact_collector()-> |
927 RecordSlot(code_slot, code_slot, *code_slot); | 929 RecordSlot(code_slot, code_slot, *code_slot); |
928 | 930 |
929 candidate = next_candidate; | 931 candidate = next_candidate; |
930 } | 932 } |
931 | 933 |
932 shared_function_info_candidates_head_ = NULL; | 934 shared_function_info_candidates_head_ = NULL; |
933 } | 935 } |
934 | 936 |
935 | 937 |
936 bool CodeFlusher::ContainsCandidate(SharedFunctionInfo* shared_info) { | |
937 SharedFunctionInfo* candidate = shared_function_info_candidates_head_; | |
938 while (candidate != NULL) { | |
939 if (candidate == shared_info) return true; | |
940 candidate = GetNextCandidate(candidate); | |
941 } | |
942 return false; | |
943 } | |
944 | |
945 | |
946 void CodeFlusher::EvictCandidate(SharedFunctionInfo* shared_info) { | 938 void CodeFlusher::EvictCandidate(SharedFunctionInfo* shared_info) { |
947 // The function is no longer a candidate, make sure it gets visited | 939 // The function is no longer a candidate, make sure it gets visited |
948 // again so that previous flushing decisions are revisited. | 940 // again so that previous flushing decisions are revisited. |
949 isolate_->heap()->incremental_marking()->RecordWrites(shared_info); | 941 isolate_->heap()->incremental_marking()->RecordWrites(shared_info); |
950 | 942 |
951 SharedFunctionInfo* candidate = shared_function_info_candidates_head_; | 943 SharedFunctionInfo* candidate = shared_function_info_candidates_head_; |
952 SharedFunctionInfo* next_candidate; | 944 SharedFunctionInfo* next_candidate; |
953 if (candidate == shared_info) { | 945 if (candidate == shared_info) { |
954 next_candidate = GetNextCandidate(shared_info); | 946 next_candidate = GetNextCandidate(shared_info); |
955 shared_function_info_candidates_head_ = next_candidate; | 947 shared_function_info_candidates_head_ = next_candidate; |
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2060 | 2052 |
2061 // Prune the symbol table removing all symbols only pointed to by the | 2053 // Prune the symbol table removing all symbols only pointed to by the |
2062 // symbol table. Cannot use symbol_table() here because the symbol | 2054 // symbol table. Cannot use symbol_table() here because the symbol |
2063 // table is marked. | 2055 // table is marked. |
2064 SymbolTable* symbol_table = heap()->symbol_table(); | 2056 SymbolTable* symbol_table = heap()->symbol_table(); |
2065 SymbolTableCleaner v(heap()); | 2057 SymbolTableCleaner v(heap()); |
2066 symbol_table->IterateElements(&v); | 2058 symbol_table->IterateElements(&v); |
2067 symbol_table->ElementsRemoved(v.PointersRemoved()); | 2059 symbol_table->ElementsRemoved(v.PointersRemoved()); |
2068 heap()->external_string_table_.Iterate(&v); | 2060 heap()->external_string_table_.Iterate(&v); |
2069 heap()->external_string_table_.CleanUp(); | 2061 heap()->external_string_table_.CleanUp(); |
2070 heap()->error_object_list_.RemoveUnmarked(heap()); | |
2071 | 2062 |
2072 // Process the weak references. | 2063 // Process the weak references. |
2073 MarkCompactWeakObjectRetainer mark_compact_object_retainer; | 2064 MarkCompactWeakObjectRetainer mark_compact_object_retainer; |
2074 heap()->ProcessWeakReferences(&mark_compact_object_retainer); | 2065 heap()->ProcessWeakReferences(&mark_compact_object_retainer); |
2075 | 2066 |
2076 // Remove object groups after marking phase. | 2067 // Remove object groups after marking phase. |
2077 heap()->isolate()->global_handles()->RemoveObjectGroups(); | 2068 heap()->isolate()->global_handles()->RemoveObjectGroups(); |
2078 heap()->isolate()->global_handles()->RemoveImplicitRefGroups(); | 2069 heap()->isolate()->global_handles()->RemoveImplicitRefGroups(); |
2079 | 2070 |
2080 // Flush code from collected candidates. | 2071 // Flush code from collected candidates. |
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3100 | 3091 |
3101 // Update pointer from the native contexts list. | 3092 // Update pointer from the native contexts list. |
3102 updating_visitor.VisitPointer(heap_->native_contexts_list_address()); | 3093 updating_visitor.VisitPointer(heap_->native_contexts_list_address()); |
3103 | 3094 |
3104 heap_->symbol_table()->Iterate(&updating_visitor); | 3095 heap_->symbol_table()->Iterate(&updating_visitor); |
3105 | 3096 |
3106 // Update pointers from external string table. | 3097 // Update pointers from external string table. |
3107 heap_->UpdateReferencesInExternalStringTable( | 3098 heap_->UpdateReferencesInExternalStringTable( |
3108 &UpdateReferenceInExternalStringTableEntry); | 3099 &UpdateReferenceInExternalStringTableEntry); |
3109 | 3100 |
3110 // Update pointers in the new error object list. | |
3111 heap_->error_object_list()->UpdateReferences(); | |
3112 | |
3113 if (!FLAG_watch_ic_patching) { | 3101 if (!FLAG_watch_ic_patching) { |
3114 // Update JSFunction pointers from the runtime profiler. | 3102 // Update JSFunction pointers from the runtime profiler. |
3115 heap()->isolate()->runtime_profiler()->UpdateSamplesAfterCompact( | 3103 heap()->isolate()->runtime_profiler()->UpdateSamplesAfterCompact( |
3116 &updating_visitor); | 3104 &updating_visitor); |
3117 } | 3105 } |
3118 | 3106 |
3119 EvacuationWeakObjectRetainer evacuation_object_retainer; | 3107 EvacuationWeakObjectRetainer evacuation_object_retainer; |
3120 heap()->ProcessWeakReferences(&evacuation_object_retainer); | 3108 heap()->ProcessWeakReferences(&evacuation_object_retainer); |
3121 | 3109 |
3122 // Visit invalidated code (we ignored all slots on it) and clear mark-bits | 3110 // Visit invalidated code (we ignored all slots on it) and clear mark-bits |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3853 while (buffer != NULL) { | 3841 while (buffer != NULL) { |
3854 SlotsBuffer* next_buffer = buffer->next(); | 3842 SlotsBuffer* next_buffer = buffer->next(); |
3855 DeallocateBuffer(buffer); | 3843 DeallocateBuffer(buffer); |
3856 buffer = next_buffer; | 3844 buffer = next_buffer; |
3857 } | 3845 } |
3858 *buffer_address = NULL; | 3846 *buffer_address = NULL; |
3859 } | 3847 } |
3860 | 3848 |
3861 | 3849 |
3862 } } // namespace v8::internal | 3850 } } // namespace v8::internal |
OLD | NEW |