| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 #elif defined(DEBUG) | 294 #elif defined(DEBUG) |
| 295 if (FLAG_heap_stats) ReportHeapStatistics("After GC"); | 295 if (FLAG_heap_stats) ReportHeapStatistics("After GC"); |
| 296 #elif defined(ENABLE_LOGGING_AND_PROFILING) | 296 #elif defined(ENABLE_LOGGING_AND_PROFILING) |
| 297 if (FLAG_log_gc) new_space_.ReportStatistics(); | 297 if (FLAG_log_gc) new_space_.ReportStatistics(); |
| 298 #endif | 298 #endif |
| 299 } | 299 } |
| 300 #endif // defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) | 300 #endif // defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) |
| 301 | 301 |
| 302 | 302 |
| 303 void Heap::GarbageCollectionPrologue() { | 303 void Heap::GarbageCollectionPrologue() { |
| 304 Isolate::Current()->transcendental_cache()->Clear(); | 304 isolate_->transcendental_cache()->Clear(); |
| 305 ClearJSFunctionResultCaches(); | 305 ClearJSFunctionResultCaches(); |
| 306 gc_count_++; | 306 gc_count_++; |
| 307 unflattened_strings_length_ = 0; | 307 unflattened_strings_length_ = 0; |
| 308 #ifdef DEBUG | 308 #ifdef DEBUG |
| 309 ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC); | 309 ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC); |
| 310 allow_allocation(false); | 310 allow_allocation(false); |
| 311 | 311 |
| 312 if (FLAG_verify_heap) { | 312 if (FLAG_verify_heap) { |
| 313 Verify(); | 313 Verify(); |
| 314 } | 314 } |
| (...skipping 3443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3758 } | 3758 } |
| 3759 | 3759 |
| 3760 | 3760 |
| 3761 void Heap::IterateStrongRoots(ObjectVisitor* v, VisitMode mode) { | 3761 void Heap::IterateStrongRoots(ObjectVisitor* v, VisitMode mode) { |
| 3762 v->VisitPointers(&roots_[0], &roots_[kStrongRootListLength]); | 3762 v->VisitPointers(&roots_[0], &roots_[kStrongRootListLength]); |
| 3763 v->Synchronize("strong_root_list"); | 3763 v->Synchronize("strong_root_list"); |
| 3764 | 3764 |
| 3765 v->VisitPointer(BitCast<Object**, String**>(&hidden_symbol_)); | 3765 v->VisitPointer(BitCast<Object**, String**>(&hidden_symbol_)); |
| 3766 v->Synchronize("symbol"); | 3766 v->Synchronize("symbol"); |
| 3767 | 3767 |
| 3768 Isolate* isolate = Isolate::Current(); | 3768 isolate_->bootstrapper()->Iterate(v); |
| 3769 isolate->bootstrapper()->Iterate(v); | |
| 3770 v->Synchronize("bootstrapper"); | 3769 v->Synchronize("bootstrapper"); |
| 3771 Top::Iterate(v); | 3770 Top::Iterate(v); |
| 3772 v->Synchronize("top"); | 3771 v->Synchronize("top"); |
| 3773 Relocatable::Iterate(v); | 3772 Relocatable::Iterate(v); |
| 3774 v->Synchronize("relocatable"); | 3773 v->Synchronize("relocatable"); |
| 3775 | 3774 |
| 3776 #ifdef ENABLE_DEBUGGER_SUPPORT | 3775 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 3777 Debug::Iterate(v); | 3776 Debug::Iterate(v); |
| 3778 #endif | 3777 #endif |
| 3779 v->Synchronize("debug"); | 3778 v->Synchronize("debug"); |
| 3780 CompilationCache::Iterate(v); | 3779 CompilationCache::Iterate(v); |
| 3781 v->Synchronize("compilationcache"); | 3780 v->Synchronize("compilationcache"); |
| 3782 | 3781 |
| 3783 // Iterate over local handles in handle scopes. | 3782 // Iterate over local handles in handle scopes. |
| 3784 isolate->handle_scope_implementer()->Iterate(v); | 3783 isolate_->handle_scope_implementer()->Iterate(v); |
| 3785 v->Synchronize("handlescope"); | 3784 v->Synchronize("handlescope"); |
| 3786 | 3785 |
| 3787 // Iterate over the builtin code objects and code stubs in the | 3786 // Iterate over the builtin code objects and code stubs in the |
| 3788 // heap. Note that it is not necessary to iterate over code objects | 3787 // heap. Note that it is not necessary to iterate over code objects |
| 3789 // on scavenge collections. | 3788 // on scavenge collections. |
| 3790 if (mode != VISIT_ALL_IN_SCAVENGE) { | 3789 if (mode != VISIT_ALL_IN_SCAVENGE) { |
| 3791 Builtins::IterateBuiltins(v); | 3790 Builtins::IterateBuiltins(v); |
| 3792 } | 3791 } |
| 3793 v->Synchronize("builtins"); | 3792 v->Synchronize("builtins"); |
| 3794 | 3793 |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4157 public: | 4156 public: |
| 4158 void VisitPointers(Object** start, Object** end) { | 4157 void VisitPointers(Object** start, Object** end) { |
| 4159 for (Object** p = start; p < end; p++) | 4158 for (Object** p = start; p < end; p++) |
| 4160 PrintF(" handle %p to %p\n", p, *p); | 4159 PrintF(" handle %p to %p\n", p, *p); |
| 4161 } | 4160 } |
| 4162 }; | 4161 }; |
| 4163 | 4162 |
| 4164 void Heap::PrintHandles() { | 4163 void Heap::PrintHandles() { |
| 4165 PrintF("Handles:\n"); | 4164 PrintF("Handles:\n"); |
| 4166 PrintHandleVisitor v; | 4165 PrintHandleVisitor v; |
| 4167 Isolate::Current()->handle_scope_implementer()->Iterate(&v); | 4166 isolate_->handle_scope_implementer()->Iterate(&v); |
| 4168 } | 4167 } |
| 4169 | 4168 |
| 4170 #endif | 4169 #endif |
| 4171 | 4170 |
| 4172 | 4171 |
| 4173 Space* AllSpaces::next() { | 4172 Space* AllSpaces::next() { |
| 4174 switch (counter_++) { | 4173 switch (counter_++) { |
| 4175 case NEW_SPACE: | 4174 case NEW_SPACE: |
| 4176 return HEAP->new_space(); | 4175 return HEAP->new_space(); |
| 4177 case OLD_POINTER_SPACE: | 4176 case OLD_POINTER_SPACE: |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4735 void ExternalStringTable::TearDown() { | 4734 void ExternalStringTable::TearDown() { |
| 4736 new_space_strings_.Free(); | 4735 new_space_strings_.Free(); |
| 4737 old_space_strings_.Free(); | 4736 old_space_strings_.Free(); |
| 4738 } | 4737 } |
| 4739 | 4738 |
| 4740 | 4739 |
| 4741 List<Object*> ExternalStringTable::new_space_strings_; | 4740 List<Object*> ExternalStringTable::new_space_strings_; |
| 4742 List<Object*> ExternalStringTable::old_space_strings_; | 4741 List<Object*> ExternalStringTable::old_space_strings_; |
| 4743 | 4742 |
| 4744 } } // namespace v8::internal | 4743 } } // namespace v8::internal |
| OLD | NEW |