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