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 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2052 | 2050 |
2053 // Prune the symbol table removing all symbols only pointed to by the | 2051 // Prune the symbol table removing all symbols only pointed to by the |
2054 // symbol table. Cannot use symbol_table() here because the symbol | 2052 // symbol table. Cannot use symbol_table() here because the symbol |
2055 // table is marked. | 2053 // table is marked. |
2056 SymbolTable* symbol_table = heap()->symbol_table(); | 2054 SymbolTable* symbol_table = heap()->symbol_table(); |
2057 SymbolTableCleaner v(heap()); | 2055 SymbolTableCleaner v(heap()); |
2058 symbol_table->IterateElements(&v); | 2056 symbol_table->IterateElements(&v); |
2059 symbol_table->ElementsRemoved(v.PointersRemoved()); | 2057 symbol_table->ElementsRemoved(v.PointersRemoved()); |
2060 heap()->external_string_table_.Iterate(&v); | 2058 heap()->external_string_table_.Iterate(&v); |
2061 heap()->external_string_table_.CleanUp(); | 2059 heap()->external_string_table_.CleanUp(); |
| 2060 heap()->error_object_list_.RemoveUnmarked(heap()); |
2062 | 2061 |
2063 // Process the weak references. | 2062 // Process the weak references. |
2064 MarkCompactWeakObjectRetainer mark_compact_object_retainer; | 2063 MarkCompactWeakObjectRetainer mark_compact_object_retainer; |
2065 heap()->ProcessWeakReferences(&mark_compact_object_retainer); | 2064 heap()->ProcessWeakReferences(&mark_compact_object_retainer); |
2066 | 2065 |
2067 // Remove object groups after marking phase. | 2066 // Remove object groups after marking phase. |
2068 heap()->isolate()->global_handles()->RemoveObjectGroups(); | 2067 heap()->isolate()->global_handles()->RemoveObjectGroups(); |
2069 heap()->isolate()->global_handles()->RemoveImplicitRefGroups(); | 2068 heap()->isolate()->global_handles()->RemoveImplicitRefGroups(); |
2070 | 2069 |
2071 // Flush code from collected candidates. | 2070 // Flush code from collected candidates. |
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3091 | 3090 |
3092 // Update pointer from the native contexts list. | 3091 // Update pointer from the native contexts list. |
3093 updating_visitor.VisitPointer(heap_->native_contexts_list_address()); | 3092 updating_visitor.VisitPointer(heap_->native_contexts_list_address()); |
3094 | 3093 |
3095 heap_->symbol_table()->Iterate(&updating_visitor); | 3094 heap_->symbol_table()->Iterate(&updating_visitor); |
3096 | 3095 |
3097 // Update pointers from external string table. | 3096 // Update pointers from external string table. |
3098 heap_->UpdateReferencesInExternalStringTable( | 3097 heap_->UpdateReferencesInExternalStringTable( |
3099 &UpdateReferenceInExternalStringTableEntry); | 3098 &UpdateReferenceInExternalStringTableEntry); |
3100 | 3099 |
| 3100 // Update pointers in the new error object list. |
| 3101 heap_->error_object_list()->UpdateReferences(); |
| 3102 |
3101 if (!FLAG_watch_ic_patching) { | 3103 if (!FLAG_watch_ic_patching) { |
3102 // Update JSFunction pointers from the runtime profiler. | 3104 // Update JSFunction pointers from the runtime profiler. |
3103 heap()->isolate()->runtime_profiler()->UpdateSamplesAfterCompact( | 3105 heap()->isolate()->runtime_profiler()->UpdateSamplesAfterCompact( |
3104 &updating_visitor); | 3106 &updating_visitor); |
3105 } | 3107 } |
3106 | 3108 |
3107 EvacuationWeakObjectRetainer evacuation_object_retainer; | 3109 EvacuationWeakObjectRetainer evacuation_object_retainer; |
3108 heap()->ProcessWeakReferences(&evacuation_object_retainer); | 3110 heap()->ProcessWeakReferences(&evacuation_object_retainer); |
3109 | 3111 |
3110 // Visit invalidated code (we ignored all slots on it) and clear mark-bits | 3112 // 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... |
3841 while (buffer != NULL) { | 3843 while (buffer != NULL) { |
3842 SlotsBuffer* next_buffer = buffer->next(); | 3844 SlotsBuffer* next_buffer = buffer->next(); |
3843 DeallocateBuffer(buffer); | 3845 DeallocateBuffer(buffer); |
3844 buffer = next_buffer; | 3846 buffer = next_buffer; |
3845 } | 3847 } |
3846 *buffer_address = NULL; | 3848 *buffer_address = NULL; |
3847 } | 3849 } |
3848 | 3850 |
3849 | 3851 |
3850 } } // namespace v8::internal | 3852 } } // namespace v8::internal |
OLD | NEW |