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 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 | 2023 |
2022 // Prune the symbol table removing all symbols only pointed to by the | 2024 // Prune the symbol table removing all symbols only pointed to by the |
2023 // symbol table. Cannot use symbol_table() here because the symbol | 2025 // symbol table. Cannot use symbol_table() here because the symbol |
2024 // table is marked. | 2026 // table is marked. |
2025 SymbolTable* symbol_table = heap()->symbol_table(); | 2027 SymbolTable* symbol_table = heap()->symbol_table(); |
2026 SymbolTableCleaner v(heap()); | 2028 SymbolTableCleaner v(heap()); |
2027 symbol_table->IterateElements(&v); | 2029 symbol_table->IterateElements(&v); |
2028 symbol_table->ElementsRemoved(v.PointersRemoved()); | 2030 symbol_table->ElementsRemoved(v.PointersRemoved()); |
2029 heap()->external_string_table_.Iterate(&v); | 2031 heap()->external_string_table_.Iterate(&v); |
2030 heap()->external_string_table_.CleanUp(); | 2032 heap()->external_string_table_.CleanUp(); |
2031 heap()->error_object_list_.RemoveUnmarked(heap()); | |
2032 | 2033 |
2033 // Process the weak references. | 2034 // Process the weak references. |
2034 MarkCompactWeakObjectRetainer mark_compact_object_retainer; | 2035 MarkCompactWeakObjectRetainer mark_compact_object_retainer; |
2035 heap()->ProcessWeakReferences(&mark_compact_object_retainer); | 2036 heap()->ProcessWeakReferences(&mark_compact_object_retainer); |
2036 | 2037 |
2037 // Remove object groups after marking phase. | 2038 // Remove object groups after marking phase. |
2038 heap()->isolate()->global_handles()->RemoveObjectGroups(); | 2039 heap()->isolate()->global_handles()->RemoveObjectGroups(); |
2039 heap()->isolate()->global_handles()->RemoveImplicitRefGroups(); | 2040 heap()->isolate()->global_handles()->RemoveImplicitRefGroups(); |
2040 | 2041 |
2041 // Flush code from collected candidates. | 2042 // Flush code from collected candidates. |
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3061 | 3062 |
3062 // Update pointer from the native contexts list. | 3063 // Update pointer from the native contexts list. |
3063 updating_visitor.VisitPointer(heap_->native_contexts_list_address()); | 3064 updating_visitor.VisitPointer(heap_->native_contexts_list_address()); |
3064 | 3065 |
3065 heap_->symbol_table()->Iterate(&updating_visitor); | 3066 heap_->symbol_table()->Iterate(&updating_visitor); |
3066 | 3067 |
3067 // Update pointers from external string table. | 3068 // Update pointers from external string table. |
3068 heap_->UpdateReferencesInExternalStringTable( | 3069 heap_->UpdateReferencesInExternalStringTable( |
3069 &UpdateReferenceInExternalStringTableEntry); | 3070 &UpdateReferenceInExternalStringTableEntry); |
3070 | 3071 |
3071 // Update pointers in the new error object list. | |
3072 heap_->error_object_list()->UpdateReferences(); | |
3073 | |
3074 if (!FLAG_watch_ic_patching) { | 3072 if (!FLAG_watch_ic_patching) { |
3075 // Update JSFunction pointers from the runtime profiler. | 3073 // Update JSFunction pointers from the runtime profiler. |
3076 heap()->isolate()->runtime_profiler()->UpdateSamplesAfterCompact( | 3074 heap()->isolate()->runtime_profiler()->UpdateSamplesAfterCompact( |
3077 &updating_visitor); | 3075 &updating_visitor); |
3078 } | 3076 } |
3079 | 3077 |
3080 EvacuationWeakObjectRetainer evacuation_object_retainer; | 3078 EvacuationWeakObjectRetainer evacuation_object_retainer; |
3081 heap()->ProcessWeakReferences(&evacuation_object_retainer); | 3079 heap()->ProcessWeakReferences(&evacuation_object_retainer); |
3082 | 3080 |
3083 // Visit invalidated code (we ignored all slots on it) and clear mark-bits | 3081 // 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... |
3814 while (buffer != NULL) { | 3812 while (buffer != NULL) { |
3815 SlotsBuffer* next_buffer = buffer->next(); | 3813 SlotsBuffer* next_buffer = buffer->next(); |
3816 DeallocateBuffer(buffer); | 3814 DeallocateBuffer(buffer); |
3817 buffer = next_buffer; | 3815 buffer = next_buffer; |
3818 } | 3816 } |
3819 *buffer_address = NULL; | 3817 *buffer_address = NULL; |
3820 } | 3818 } |
3821 | 3819 |
3822 | 3820 |
3823 } } // namespace v8::internal | 3821 } } // namespace v8::internal |
OLD | NEW |