| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 previous_survival_rate_trend_(Heap::STABLE), | 127 previous_survival_rate_trend_(Heap::STABLE), |
| 128 survival_rate_trend_(Heap::STABLE), | 128 survival_rate_trend_(Heap::STABLE), |
| 129 max_gc_pause_(0.0), | 129 max_gc_pause_(0.0), |
| 130 total_gc_time_ms_(0.0), | 130 total_gc_time_ms_(0.0), |
| 131 max_alive_after_gc_(0), | 131 max_alive_after_gc_(0), |
| 132 min_in_mutator_(kMaxInt), | 132 min_in_mutator_(kMaxInt), |
| 133 alive_after_last_gc_(0), | 133 alive_after_last_gc_(0), |
| 134 last_gc_end_timestamp_(0.0), | 134 last_gc_end_timestamp_(0.0), |
| 135 marking_time_(0.0), | 135 marking_time_(0.0), |
| 136 sweeping_time_(0.0), | 136 sweeping_time_(0.0), |
| 137 mark_compact_collector_(this), |
| 137 store_buffer_(this), | 138 store_buffer_(this), |
| 138 marking_(this), | 139 marking_(this), |
| 139 incremental_marking_(this), | 140 incremental_marking_(this), |
| 140 number_idle_notifications_(0), | 141 number_idle_notifications_(0), |
| 141 last_idle_notification_gc_count_(0), | 142 last_idle_notification_gc_count_(0), |
| 142 last_idle_notification_gc_count_init_(false), | 143 last_idle_notification_gc_count_init_(false), |
| 143 mark_sweeps_since_idle_round_started_(0), | 144 mark_sweeps_since_idle_round_started_(0), |
| 144 gc_count_at_last_idle_gc_(0), | 145 gc_count_at_last_idle_gc_(0), |
| 145 scavenges_since_last_idle_round_(kIdleScavengeThreshold), | 146 scavenges_since_last_idle_round_(kIdleScavengeThreshold), |
| 146 full_codegen_bytes_generated_(0), | 147 full_codegen_bytes_generated_(0), |
| 147 crankshaft_codegen_bytes_generated_(0), | 148 crankshaft_codegen_bytes_generated_(0), |
| 148 gcs_since_last_deopt_(0), | 149 gcs_since_last_deopt_(0), |
| 149 #ifdef VERIFY_HEAP | 150 #ifdef VERIFY_HEAP |
| 150 no_weak_object_verification_scope_depth_(0), | 151 no_weak_object_verification_scope_depth_(0), |
| 151 #endif | 152 #endif |
| 152 allocation_sites_scratchpad_length(0), | 153 allocation_sites_scratchpad_length(0), |
| 153 promotion_queue_(this), | 154 promotion_queue_(this), |
| 154 configured_(false), | 155 configured_(false), |
| 156 external_string_table_(this), |
| 155 chunks_queued_for_free_(NULL), | 157 chunks_queued_for_free_(NULL), |
| 156 relocation_mutex_(NULL) { | 158 relocation_mutex_(NULL) { |
| 157 // Allow build-time customization of the max semispace size. Building | 159 // Allow build-time customization of the max semispace size. Building |
| 158 // V8 with snapshots and a non-default max semispace size is much | 160 // V8 with snapshots and a non-default max semispace size is much |
| 159 // easier if you can define it as part of the build environment. | 161 // easier if you can define it as part of the build environment. |
| 160 #if defined(V8_MAX_SEMISPACE_SIZE) | 162 #if defined(V8_MAX_SEMISPACE_SIZE) |
| 161 max_semispace_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE; | 163 max_semispace_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE; |
| 162 #endif | 164 #endif |
| 163 | 165 |
| 164 // Ensure old_generation_size_ is a multiple of kPageSize. | 166 // Ensure old_generation_size_ is a multiple of kPageSize. |
| 165 ASSERT(MB >= Page::kPageSize); | 167 ASSERT(MB >= Page::kPageSize); |
| 166 | 168 |
| 167 intptr_t max_virtual = OS::MaxVirtualMemory(); | 169 intptr_t max_virtual = OS::MaxVirtualMemory(); |
| 168 | 170 |
| 169 if (max_virtual > 0) { | 171 if (max_virtual > 0) { |
| 170 if (code_range_size_ > 0) { | 172 if (code_range_size_ > 0) { |
| 171 // Reserve no more than 1/8 of the memory for the code range. | 173 // Reserve no more than 1/8 of the memory for the code range. |
| 172 code_range_size_ = Min(code_range_size_, max_virtual >> 3); | 174 code_range_size_ = Min(code_range_size_, max_virtual >> 3); |
| 173 } | 175 } |
| 174 } | 176 } |
| 175 | 177 |
| 176 memset(roots_, 0, sizeof(roots_[0]) * kRootListLength); | 178 memset(roots_, 0, sizeof(roots_[0]) * kRootListLength); |
| 177 native_contexts_list_ = NULL; | 179 native_contexts_list_ = NULL; |
| 178 array_buffers_list_ = Smi::FromInt(0); | 180 array_buffers_list_ = Smi::FromInt(0); |
| 179 allocation_sites_list_ = Smi::FromInt(0); | 181 allocation_sites_list_ = Smi::FromInt(0); |
| 180 mark_compact_collector_.heap_ = this; | |
| 181 external_string_table_.heap_ = this; | |
| 182 // Put a dummy entry in the remembered pages so we can find the list the | 182 // Put a dummy entry in the remembered pages so we can find the list the |
| 183 // minidump even if there are no real unmapped pages. | 183 // minidump even if there are no real unmapped pages. |
| 184 RememberUnmappedPage(NULL, false); | 184 RememberUnmappedPage(NULL, false); |
| 185 | 185 |
| 186 ClearObjectStats(true); | 186 ClearObjectStats(true); |
| 187 } | 187 } |
| 188 | 188 |
| 189 | 189 |
| 190 intptr_t Heap::Capacity() { | 190 intptr_t Heap::Capacity() { |
| 191 if (!HasBeenSetUp()) return 0; | 191 if (!HasBeenSetUp()) return 0; |
| (...skipping 7545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7737 static_cast<int>(object_sizes_last_time_[index])); | 7737 static_cast<int>(object_sizes_last_time_[index])); |
| 7738 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 7738 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 7739 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7739 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 7740 | 7740 |
| 7741 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7741 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 7742 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7742 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 7743 ClearObjectStats(); | 7743 ClearObjectStats(); |
| 7744 } | 7744 } |
| 7745 | 7745 |
| 7746 } } // namespace v8::internal | 7746 } } // namespace v8::internal |
| OLD | NEW |