Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: src/heap.cc

Issue 8822019: Reapply r10158: Distinguish weak references in heap snapshots, group GC roots. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/bootstrapper.cc ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 5133 matching lines...) Expand 10 before | Expand all | Expand 10 after
5144 5144
5145 5145
5146 void Heap::IterateRoots(ObjectVisitor* v, VisitMode mode) { 5146 void Heap::IterateRoots(ObjectVisitor* v, VisitMode mode) {
5147 IterateStrongRoots(v, mode); 5147 IterateStrongRoots(v, mode);
5148 IterateWeakRoots(v, mode); 5148 IterateWeakRoots(v, mode);
5149 } 5149 }
5150 5150
5151 5151
5152 void Heap::IterateWeakRoots(ObjectVisitor* v, VisitMode mode) { 5152 void Heap::IterateWeakRoots(ObjectVisitor* v, VisitMode mode) {
5153 v->VisitPointer(reinterpret_cast<Object**>(&roots_[kSymbolTableRootIndex])); 5153 v->VisitPointer(reinterpret_cast<Object**>(&roots_[kSymbolTableRootIndex]));
5154 v->Synchronize("symbol_table"); 5154 v->Synchronize(VisitorSynchronization::kSymbolTable);
5155 if (mode != VISIT_ALL_IN_SCAVENGE && 5155 if (mode != VISIT_ALL_IN_SCAVENGE &&
5156 mode != VISIT_ALL_IN_SWEEP_NEWSPACE) { 5156 mode != VISIT_ALL_IN_SWEEP_NEWSPACE) {
5157 // Scavenge collections have special processing for this. 5157 // Scavenge collections have special processing for this.
5158 external_string_table_.Iterate(v); 5158 external_string_table_.Iterate(v);
5159 } 5159 }
5160 v->Synchronize("external_string_table"); 5160 v->Synchronize(VisitorSynchronization::kExternalStringsTable);
5161 } 5161 }
5162 5162
5163 5163
5164 void Heap::IterateStrongRoots(ObjectVisitor* v, VisitMode mode) { 5164 void Heap::IterateStrongRoots(ObjectVisitor* v, VisitMode mode) {
5165 v->VisitPointers(&roots_[0], &roots_[kStrongRootListLength]); 5165 v->VisitPointers(&roots_[0], &roots_[kStrongRootListLength]);
5166 v->Synchronize("strong_root_list"); 5166 v->Synchronize(VisitorSynchronization::kStrongRootList);
5167 5167
5168 v->VisitPointer(BitCast<Object**>(&hidden_symbol_)); 5168 v->VisitPointer(BitCast<Object**>(&hidden_symbol_));
5169 v->Synchronize("symbol"); 5169 v->Synchronize(VisitorSynchronization::kSymbol);
5170 5170
5171 isolate_->bootstrapper()->Iterate(v); 5171 isolate_->bootstrapper()->Iterate(v);
5172 v->Synchronize("bootstrapper"); 5172 v->Synchronize(VisitorSynchronization::kBootstrapper);
5173 isolate_->Iterate(v); 5173 isolate_->Iterate(v);
5174 v->Synchronize("top"); 5174 v->Synchronize(VisitorSynchronization::kTop);
5175 Relocatable::Iterate(v); 5175 Relocatable::Iterate(v);
5176 v->Synchronize("relocatable"); 5176 v->Synchronize(VisitorSynchronization::kRelocatable);
5177 5177
5178 #ifdef ENABLE_DEBUGGER_SUPPORT 5178 #ifdef ENABLE_DEBUGGER_SUPPORT
5179 isolate_->debug()->Iterate(v); 5179 isolate_->debug()->Iterate(v);
5180 if (isolate_->deoptimizer_data() != NULL) { 5180 if (isolate_->deoptimizer_data() != NULL) {
5181 isolate_->deoptimizer_data()->Iterate(v); 5181 isolate_->deoptimizer_data()->Iterate(v);
5182 } 5182 }
5183 #endif 5183 #endif
5184 v->Synchronize("debug"); 5184 v->Synchronize(VisitorSynchronization::kDebug);
5185 isolate_->compilation_cache()->Iterate(v); 5185 isolate_->compilation_cache()->Iterate(v);
5186 v->Synchronize("compilationcache"); 5186 v->Synchronize(VisitorSynchronization::kCompilationCache);
5187 5187
5188 // Iterate over local handles in handle scopes. 5188 // Iterate over local handles in handle scopes.
5189 isolate_->handle_scope_implementer()->Iterate(v); 5189 isolate_->handle_scope_implementer()->Iterate(v);
5190 v->Synchronize("handlescope"); 5190 v->Synchronize(VisitorSynchronization::kHandleScope);
5191 5191
5192 // Iterate over the builtin code objects and code stubs in the 5192 // Iterate over the builtin code objects and code stubs in the
5193 // heap. Note that it is not necessary to iterate over code objects 5193 // heap. Note that it is not necessary to iterate over code objects
5194 // on scavenge collections. 5194 // on scavenge collections.
5195 if (mode != VISIT_ALL_IN_SCAVENGE) { 5195 if (mode != VISIT_ALL_IN_SCAVENGE) {
5196 isolate_->builtins()->IterateBuiltins(v); 5196 isolate_->builtins()->IterateBuiltins(v);
5197 } 5197 }
5198 v->Synchronize("builtins"); 5198 v->Synchronize(VisitorSynchronization::kBuiltins);
5199 5199
5200 // Iterate over global handles. 5200 // Iterate over global handles.
5201 switch (mode) { 5201 switch (mode) {
5202 case VISIT_ONLY_STRONG: 5202 case VISIT_ONLY_STRONG:
5203 isolate_->global_handles()->IterateStrongRoots(v); 5203 isolate_->global_handles()->IterateStrongRoots(v);
5204 break; 5204 break;
5205 case VISIT_ALL_IN_SCAVENGE: 5205 case VISIT_ALL_IN_SCAVENGE:
5206 isolate_->global_handles()->IterateNewSpaceStrongAndDependentRoots(v); 5206 isolate_->global_handles()->IterateNewSpaceStrongAndDependentRoots(v);
5207 break; 5207 break;
5208 case VISIT_ALL_IN_SWEEP_NEWSPACE: 5208 case VISIT_ALL_IN_SWEEP_NEWSPACE:
5209 case VISIT_ALL: 5209 case VISIT_ALL:
5210 isolate_->global_handles()->IterateAllRoots(v); 5210 isolate_->global_handles()->IterateAllRoots(v);
5211 break; 5211 break;
5212 } 5212 }
5213 v->Synchronize("globalhandles"); 5213 v->Synchronize(VisitorSynchronization::kGlobalHandles);
5214 5214
5215 // Iterate over pointers being held by inactive threads. 5215 // Iterate over pointers being held by inactive threads.
5216 isolate_->thread_manager()->Iterate(v); 5216 isolate_->thread_manager()->Iterate(v);
5217 v->Synchronize("threadmanager"); 5217 v->Synchronize(VisitorSynchronization::kThreadManager);
5218 5218
5219 // Iterate over the pointers the Serialization/Deserialization code is 5219 // Iterate over the pointers the Serialization/Deserialization code is
5220 // holding. 5220 // holding.
5221 // During garbage collection this keeps the partial snapshot cache alive. 5221 // During garbage collection this keeps the partial snapshot cache alive.
5222 // During deserialization of the startup snapshot this creates the partial 5222 // During deserialization of the startup snapshot this creates the partial
5223 // snapshot cache and deserializes the objects it refers to. During 5223 // snapshot cache and deserializes the objects it refers to. During
5224 // serialization this does nothing, since the partial snapshot cache is 5224 // serialization this does nothing, since the partial snapshot cache is
5225 // empty. However the next thing we do is create the partial snapshot, 5225 // empty. However the next thing we do is create the partial snapshot,
5226 // filling up the partial snapshot cache with objects it needs as we go. 5226 // filling up the partial snapshot cache with objects it needs as we go.
5227 SerializerDeserializer::Iterate(v); 5227 SerializerDeserializer::Iterate(v);
(...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after
6583 isolate_->heap()->store_buffer()->Compact(); 6583 isolate_->heap()->store_buffer()->Compact();
6584 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); 6584 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED);
6585 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { 6585 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) {
6586 next = chunk->next_chunk(); 6586 next = chunk->next_chunk();
6587 isolate_->memory_allocator()->Free(chunk); 6587 isolate_->memory_allocator()->Free(chunk);
6588 } 6588 }
6589 chunks_queued_for_free_ = NULL; 6589 chunks_queued_for_free_ = NULL;
6590 } 6590 }
6591 6591
6592 } } // namespace v8::internal 6592 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698