OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 3326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3337 page->RSetStart(), copy_object_func); | 3337 page->RSetStart(), copy_object_func); |
3338 if (paged_rset_histogram != NULL) { | 3338 if (paged_rset_histogram != NULL) { |
3339 StatsTable::AddHistogramSample(paged_rset_histogram, count); | 3339 StatsTable::AddHistogramSample(paged_rset_histogram, count); |
3340 } | 3340 } |
3341 } | 3341 } |
3342 } | 3342 } |
3343 | 3343 |
3344 | 3344 |
3345 void Heap::IterateRoots(ObjectVisitor* v, VisitMode mode) { | 3345 void Heap::IterateRoots(ObjectVisitor* v, VisitMode mode) { |
3346 IterateStrongRoots(v, mode); | 3346 IterateStrongRoots(v, mode); |
| 3347 IterateWeakRoots(v, mode); |
| 3348 } |
| 3349 |
| 3350 |
| 3351 void Heap::IterateWeakRoots(ObjectVisitor* v, VisitMode mode) { |
3347 v->VisitPointer(reinterpret_cast<Object**>(&roots_[kSymbolTableRootIndex])); | 3352 v->VisitPointer(reinterpret_cast<Object**>(&roots_[kSymbolTableRootIndex])); |
3348 v->Synchronize("symbol_table"); | 3353 v->Synchronize("symbol_table"); |
3349 if (mode != VISIT_ALL_IN_SCAVENGE) { | 3354 if (mode != VISIT_ALL_IN_SCAVENGE) { |
3350 // Scavenge collections have special processing for this. | 3355 // Scavenge collections have special processing for this. |
3351 ExternalStringTable::Iterate(v); | 3356 ExternalStringTable::Iterate(v); |
3352 } | 3357 } |
3353 v->Synchronize("external_string_table"); | 3358 v->Synchronize("external_string_table"); |
3354 } | 3359 } |
3355 | 3360 |
3356 | 3361 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3391 if (mode == VISIT_ONLY_STRONG) { | 3396 if (mode == VISIT_ONLY_STRONG) { |
3392 GlobalHandles::IterateStrongRoots(v); | 3397 GlobalHandles::IterateStrongRoots(v); |
3393 } else { | 3398 } else { |
3394 GlobalHandles::IterateAllRoots(v); | 3399 GlobalHandles::IterateAllRoots(v); |
3395 } | 3400 } |
3396 v->Synchronize("globalhandles"); | 3401 v->Synchronize("globalhandles"); |
3397 | 3402 |
3398 // Iterate over pointers being held by inactive threads. | 3403 // Iterate over pointers being held by inactive threads. |
3399 ThreadManager::Iterate(v); | 3404 ThreadManager::Iterate(v); |
3400 v->Synchronize("threadmanager"); | 3405 v->Synchronize("threadmanager"); |
| 3406 |
| 3407 // Iterate over the pointers the Serialization/Deserialization code is |
| 3408 // holding. |
| 3409 // During garbage collection this keeps the partial snapshot cache alive. |
| 3410 // During deserialization of the startup snapshot this creates the partial |
| 3411 // snapshot cache and deserializes the objects it refers to. During |
| 3412 // serialization this does nothing, since the partial snapshot cache is |
| 3413 // empty. However the next thing we do is create the partial snapshot, |
| 3414 // filling up the partial snapshot cache with objects it needs as we go. |
| 3415 SerializerDeserializer::Iterate(v); |
| 3416 // We don't do a v->Synchronize call here, because in debug mode that will |
| 3417 // output a flag to the snapshot. However at this point the serializer and |
| 3418 // deserializer are deliberately a little unsynchronized (see above) so the |
| 3419 // checking of the sync flag in the snapshot would fail. |
3401 } | 3420 } |
3402 | 3421 |
3403 | 3422 |
3404 // Flag is set when the heap has been configured. The heap can be repeatedly | 3423 // Flag is set when the heap has been configured. The heap can be repeatedly |
3405 // configured through the API until it is setup. | 3424 // configured through the API until it is setup. |
3406 static bool heap_configured = false; | 3425 static bool heap_configured = false; |
3407 | 3426 |
3408 // TODO(1236194): Since the heap size is configurable on the command line | 3427 // TODO(1236194): Since the heap size is configurable on the command line |
3409 // and through the API, we should gracefully handle the case that the heap | 3428 // and through the API, we should gracefully handle the case that the heap |
3410 // size is not big enough to fit all the initial objects. | 3429 // size is not big enough to fit all the initial objects. |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4193 void ExternalStringTable::TearDown() { | 4212 void ExternalStringTable::TearDown() { |
4194 new_space_strings_.Free(); | 4213 new_space_strings_.Free(); |
4195 old_space_strings_.Free(); | 4214 old_space_strings_.Free(); |
4196 } | 4215 } |
4197 | 4216 |
4198 | 4217 |
4199 List<Object*> ExternalStringTable::new_space_strings_; | 4218 List<Object*> ExternalStringTable::new_space_strings_; |
4200 List<Object*> ExternalStringTable::old_space_strings_; | 4219 List<Object*> ExternalStringTable::old_space_strings_; |
4201 | 4220 |
4202 } } // namespace v8::internal | 4221 } } // namespace v8::internal |
OLD | NEW |