| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 unflattened_strings_length_(0), | 106 unflattened_strings_length_(0), |
| 107 #ifdef DEBUG | 107 #ifdef DEBUG |
| 108 allocation_timeout_(0), | 108 allocation_timeout_(0), |
| 109 #endif // DEBUG | 109 #endif // DEBUG |
| 110 old_generation_allocation_limit_(initial_old_generation_size_), | 110 old_generation_allocation_limit_(initial_old_generation_size_), |
| 111 old_gen_exhausted_(false), | 111 old_gen_exhausted_(false), |
| 112 optimize_for_memory_usage_(false), | 112 optimize_for_memory_usage_(false), |
| 113 inline_allocation_disabled_(false), | 113 inline_allocation_disabled_(false), |
| 114 store_buffer_rebuilder_(store_buffer()), | 114 store_buffer_rebuilder_(store_buffer()), |
| 115 hidden_string_(NULL), | 115 hidden_string_(NULL), |
| 116 gc_safe_size_of_old_object_(NULL), | |
| 117 total_regexp_code_generated_(0), | 116 total_regexp_code_generated_(0), |
| 118 tracer_(this), | 117 tracer_(this), |
| 119 high_survival_rate_period_length_(0), | 118 high_survival_rate_period_length_(0), |
| 120 promoted_objects_size_(0), | 119 promoted_objects_size_(0), |
| 121 promotion_ratio_(0), | 120 promotion_ratio_(0), |
| 122 semi_space_copied_object_size_(0), | 121 semi_space_copied_object_size_(0), |
| 123 previous_semi_space_copied_object_size_(0), | 122 previous_semi_space_copied_object_size_(0), |
| 124 semi_space_copied_rate_(0), | 123 semi_space_copied_rate_(0), |
| 125 nodes_died_in_new_space_(0), | 124 nodes_died_in_new_space_(0), |
| 126 nodes_copied_in_new_space_(0), | 125 nodes_copied_in_new_space_(0), |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 return total; | 239 return total; |
| 241 } | 240 } |
| 242 | 241 |
| 243 | 242 |
| 244 bool Heap::HasBeenSetUp() { | 243 bool Heap::HasBeenSetUp() { |
| 245 return old_space_ != NULL && code_space_ != NULL && map_space_ != NULL && | 244 return old_space_ != NULL && code_space_ != NULL && map_space_ != NULL && |
| 246 lo_space_ != NULL; | 245 lo_space_ != NULL; |
| 247 } | 246 } |
| 248 | 247 |
| 249 | 248 |
| 250 int Heap::GcSafeSizeOfOldObject(HeapObject* object) { | |
| 251 if (IntrusiveMarking::IsMarked(object)) { | |
| 252 return IntrusiveMarking::SizeOfMarkedObject(object); | |
| 253 } | |
| 254 return object->SizeFromMap(object->map()); | |
| 255 } | |
| 256 | |
| 257 | |
| 258 GarbageCollector Heap::SelectGarbageCollector(AllocationSpace space, | 249 GarbageCollector Heap::SelectGarbageCollector(AllocationSpace space, |
| 259 const char** reason) { | 250 const char** reason) { |
| 260 // Is global GC requested? | 251 // Is global GC requested? |
| 261 if (space != NEW_SPACE) { | 252 if (space != NEW_SPACE) { |
| 262 isolate_->counters()->gc_compactor_caused_by_request()->Increment(); | 253 isolate_->counters()->gc_compactor_caused_by_request()->Increment(); |
| 263 *reason = "GC in old space requested"; | 254 *reason = "GC in old space requested"; |
| 264 return MARK_COMPACTOR; | 255 return MARK_COMPACTOR; |
| 265 } | 256 } |
| 266 | 257 |
| 267 if (FLAG_gc_global || (FLAG_stress_compaction && (gc_count_ & 1) != 0)) { | 258 if (FLAG_gc_global || (FLAG_stress_compaction && (gc_count_ & 1) != 0)) { |
| (...skipping 5484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5752 // size) and old-space-size if set or the initial values of semispace_size_ | 5743 // size) and old-space-size if set or the initial values of semispace_size_ |
| 5753 // and old_generation_size_ otherwise. | 5744 // and old_generation_size_ otherwise. |
| 5754 if (!configured_) { | 5745 if (!configured_) { |
| 5755 if (!ConfigureHeapDefault()) return false; | 5746 if (!ConfigureHeapDefault()) return false; |
| 5756 } | 5747 } |
| 5757 | 5748 |
| 5758 concurrent_sweeping_enabled_ = FLAG_concurrent_sweeping; | 5749 concurrent_sweeping_enabled_ = FLAG_concurrent_sweeping; |
| 5759 | 5750 |
| 5760 base::CallOnce(&initialize_gc_once, &InitializeGCOnce); | 5751 base::CallOnce(&initialize_gc_once, &InitializeGCOnce); |
| 5761 | 5752 |
| 5762 MarkMapPointersAsEncoded(false); | |
| 5763 | |
| 5764 // Set up memory allocator. | 5753 // Set up memory allocator. |
| 5765 if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize())) | 5754 if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize())) |
| 5766 return false; | 5755 return false; |
| 5767 | 5756 |
| 5768 // Set up new space. | 5757 // Set up new space. |
| 5769 if (!new_space_.SetUp(reserved_semispace_size_, max_semi_space_size_)) { | 5758 if (!new_space_.SetUp(reserved_semispace_size_, max_semi_space_size_)) { |
| 5770 return false; | 5759 return false; |
| 5771 } | 5760 } |
| 5772 new_space_top_after_last_gc_ = new_space()->top(); | 5761 new_space_top_after_last_gc_ = new_space()->top(); |
| 5773 | 5762 |
| (...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6921 *object_type = "CODE_TYPE"; \ | 6910 *object_type = "CODE_TYPE"; \ |
| 6922 *object_sub_type = "CODE_AGE/" #name; \ | 6911 *object_sub_type = "CODE_AGE/" #name; \ |
| 6923 return true; | 6912 return true; |
| 6924 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6913 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
| 6925 #undef COMPARE_AND_RETURN_NAME | 6914 #undef COMPARE_AND_RETURN_NAME |
| 6926 } | 6915 } |
| 6927 return false; | 6916 return false; |
| 6928 } | 6917 } |
| 6929 } // namespace internal | 6918 } // namespace internal |
| 6930 } // namespace v8 | 6919 } // namespace v8 |
| OLD | NEW |