| 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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 void MarkCompactCollector::Finish() { | 827 void MarkCompactCollector::Finish() { |
| 828 #ifdef DEBUG | 828 #ifdef DEBUG |
| 829 ASSERT(state_ == SWEEP_SPACES || state_ == RELOCATE_OBJECTS); | 829 ASSERT(state_ == SWEEP_SPACES || state_ == RELOCATE_OBJECTS); |
| 830 state_ = IDLE; | 830 state_ = IDLE; |
| 831 #endif | 831 #endif |
| 832 // The stub cache is not traversed during GC; clear the cache to | 832 // The stub cache is not traversed during GC; clear the cache to |
| 833 // force lazy re-initialization of it. This must be done after the | 833 // force lazy re-initialization of it. This must be done after the |
| 834 // GC, because it relies on the new address of certain old space | 834 // GC, because it relies on the new address of certain old space |
| 835 // objects (empty string, illegal builtin). | 835 // objects (empty string, illegal builtin). |
| 836 heap()->isolate()->stub_cache()->Clear(); | 836 heap()->isolate()->stub_cache()->Clear(); |
| 837 | |
| 838 heap()->external_string_table_.CleanUp(); | |
| 839 } | 837 } |
| 840 | 838 |
| 841 | 839 |
| 842 // ------------------------------------------------------------------------- | 840 // ------------------------------------------------------------------------- |
| 843 // Phase 1: tracing and marking live objects. | 841 // Phase 1: tracing and marking live objects. |
| 844 // before: all objects are in normal state. | 842 // before: all objects are in normal state. |
| 845 // after: a live object's map pointer is marked as '00'. | 843 // after: a live object's map pointer is marked as '00'. |
| 846 | 844 |
| 847 // Marking all live objects in the heap as part of mark-sweep or mark-compact | 845 // Marking all live objects in the heap as part of mark-sweep or mark-compact |
| 848 // collection. Before marking, all objects are in their normal state. After | 846 // collection. Before marking, all objects are in their normal state. After |
| (...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2055 | 2053 |
| 2056 // Prune the symbol table removing all symbols only pointed to by the | 2054 // Prune the symbol table removing all symbols only pointed to by the |
| 2057 // symbol table. Cannot use symbol_table() here because the symbol | 2055 // symbol table. Cannot use symbol_table() here because the symbol |
| 2058 // table is marked. | 2056 // table is marked. |
| 2059 SymbolTable* symbol_table = heap()->symbol_table(); | 2057 SymbolTable* symbol_table = heap()->symbol_table(); |
| 2060 SymbolTableCleaner v(heap()); | 2058 SymbolTableCleaner v(heap()); |
| 2061 symbol_table->IterateElements(&v); | 2059 symbol_table->IterateElements(&v); |
| 2062 symbol_table->ElementsRemoved(v.PointersRemoved()); | 2060 symbol_table->ElementsRemoved(v.PointersRemoved()); |
| 2063 heap()->external_string_table_.Iterate(&v); | 2061 heap()->external_string_table_.Iterate(&v); |
| 2064 heap()->external_string_table_.CleanUp(); | 2062 heap()->external_string_table_.CleanUp(); |
| 2063 heap()->error_object_list_.RemoveUnmarked(heap()); |
| 2065 | 2064 |
| 2066 // Process the weak references. | 2065 // Process the weak references. |
| 2067 MarkCompactWeakObjectRetainer mark_compact_object_retainer; | 2066 MarkCompactWeakObjectRetainer mark_compact_object_retainer; |
| 2068 heap()->ProcessWeakReferences(&mark_compact_object_retainer); | 2067 heap()->ProcessWeakReferences(&mark_compact_object_retainer); |
| 2069 | 2068 |
| 2070 // Remove object groups after marking phase. | 2069 // Remove object groups after marking phase. |
| 2071 heap()->isolate()->global_handles()->RemoveObjectGroups(); | 2070 heap()->isolate()->global_handles()->RemoveObjectGroups(); |
| 2072 heap()->isolate()->global_handles()->RemoveImplicitRefGroups(); | 2071 heap()->isolate()->global_handles()->RemoveImplicitRefGroups(); |
| 2073 | 2072 |
| 2074 // Flush code from collected candidates. | 2073 // Flush code from collected candidates. |
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3094 | 3093 |
| 3095 // Update pointer from the native contexts list. | 3094 // Update pointer from the native contexts list. |
| 3096 updating_visitor.VisitPointer(heap_->native_contexts_list_address()); | 3095 updating_visitor.VisitPointer(heap_->native_contexts_list_address()); |
| 3097 | 3096 |
| 3098 heap_->symbol_table()->Iterate(&updating_visitor); | 3097 heap_->symbol_table()->Iterate(&updating_visitor); |
| 3099 | 3098 |
| 3100 // Update pointers from external string table. | 3099 // Update pointers from external string table. |
| 3101 heap_->UpdateReferencesInExternalStringTable( | 3100 heap_->UpdateReferencesInExternalStringTable( |
| 3102 &UpdateReferenceInExternalStringTableEntry); | 3101 &UpdateReferenceInExternalStringTableEntry); |
| 3103 | 3102 |
| 3103 // Update pointers in the new error object list. |
| 3104 heap_->error_object_list()->UpdateReferences(); |
| 3105 |
| 3104 if (!FLAG_watch_ic_patching) { | 3106 if (!FLAG_watch_ic_patching) { |
| 3105 // Update JSFunction pointers from the runtime profiler. | 3107 // Update JSFunction pointers from the runtime profiler. |
| 3106 heap()->isolate()->runtime_profiler()->UpdateSamplesAfterCompact( | 3108 heap()->isolate()->runtime_profiler()->UpdateSamplesAfterCompact( |
| 3107 &updating_visitor); | 3109 &updating_visitor); |
| 3108 } | 3110 } |
| 3109 | 3111 |
| 3110 EvacuationWeakObjectRetainer evacuation_object_retainer; | 3112 EvacuationWeakObjectRetainer evacuation_object_retainer; |
| 3111 heap()->ProcessWeakReferences(&evacuation_object_retainer); | 3113 heap()->ProcessWeakReferences(&evacuation_object_retainer); |
| 3112 | 3114 |
| 3113 // Visit invalidated code (we ignored all slots on it) and clear mark-bits | 3115 // Visit invalidated code (we ignored all slots on it) and clear mark-bits |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3852 while (buffer != NULL) { | 3854 while (buffer != NULL) { |
| 3853 SlotsBuffer* next_buffer = buffer->next(); | 3855 SlotsBuffer* next_buffer = buffer->next(); |
| 3854 DeallocateBuffer(buffer); | 3856 DeallocateBuffer(buffer); |
| 3855 buffer = next_buffer; | 3857 buffer = next_buffer; |
| 3856 } | 3858 } |
| 3857 *buffer_address = NULL; | 3859 *buffer_address = NULL; |
| 3858 } | 3860 } |
| 3859 | 3861 |
| 3860 | 3862 |
| 3861 } } // namespace v8::internal | 3863 } } // namespace v8::internal |
| OLD | NEW |