| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 crankshaft_codegen_bytes_generated_(0), | 148 crankshaft_codegen_bytes_generated_(0), |
| 149 gcs_since_last_deopt_(0), | 149 gcs_since_last_deopt_(0), |
| 150 #ifdef VERIFY_HEAP | 150 #ifdef VERIFY_HEAP |
| 151 no_weak_object_verification_scope_depth_(0), | 151 no_weak_object_verification_scope_depth_(0), |
| 152 #endif | 152 #endif |
| 153 allocation_sites_scratchpad_length_(0), | 153 allocation_sites_scratchpad_length_(0), |
| 154 promotion_queue_(this), | 154 promotion_queue_(this), |
| 155 configured_(false), | 155 configured_(false), |
| 156 external_string_table_(this), | 156 external_string_table_(this), |
| 157 chunks_queued_for_free_(NULL), | 157 chunks_queued_for_free_(NULL), |
| 158 relocation_mutex_(NULL) { | 158 relocation_mutex_(NULL), |
| 159 gc_callbacks_depth_(0) { |
| 159 // Allow build-time customization of the max semispace size. Building | 160 // Allow build-time customization of the max semispace size. Building |
| 160 // V8 with snapshots and a non-default max semispace size is much | 161 // V8 with snapshots and a non-default max semispace size is much |
| 161 // easier if you can define it as part of the build environment. | 162 // easier if you can define it as part of the build environment. |
| 162 #if defined(V8_MAX_SEMISPACE_SIZE) | 163 #if defined(V8_MAX_SEMISPACE_SIZE) |
| 163 max_semispace_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE; | 164 max_semispace_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE; |
| 164 #endif | 165 #endif |
| 165 | 166 |
| 166 // Ensure old_generation_size_ is a multiple of kPageSize. | 167 // Ensure old_generation_size_ is a multiple of kPageSize. |
| 167 ASSERT(MB >= Page::kPageSize); | 168 ASSERT(MB >= Page::kPageSize); |
| 168 | 169 |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 | 1078 |
| 1078 #ifdef VERIFY_HEAP | 1079 #ifdef VERIFY_HEAP |
| 1079 if (FLAG_verify_heap) { | 1080 if (FLAG_verify_heap) { |
| 1080 VerifyStringTable(this); | 1081 VerifyStringTable(this); |
| 1081 } | 1082 } |
| 1082 #endif | 1083 #endif |
| 1083 | 1084 |
| 1084 GCType gc_type = | 1085 GCType gc_type = |
| 1085 collector == MARK_COMPACTOR ? kGCTypeMarkSweepCompact : kGCTypeScavenge; | 1086 collector == MARK_COMPACTOR ? kGCTypeMarkSweepCompact : kGCTypeScavenge; |
| 1086 | 1087 |
| 1087 { | 1088 { GCCallbacksScope scope(this); |
| 1088 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); | 1089 if (scope.CheckReenter()) { |
| 1089 VMState<EXTERNAL> state(isolate_); | 1090 AllowHeapAllocation allow_allocation; |
| 1090 HandleScope handle_scope(isolate_); | 1091 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); |
| 1091 CallGCPrologueCallbacks(gc_type, kNoGCCallbackFlags); | 1092 VMState<EXTERNAL> state(isolate_); |
| 1093 HandleScope handle_scope(isolate_); |
| 1094 CallGCPrologueCallbacks(gc_type, kNoGCCallbackFlags); |
| 1095 } |
| 1092 } | 1096 } |
| 1093 | 1097 |
| 1094 EnsureFromSpaceIsCommitted(); | 1098 EnsureFromSpaceIsCommitted(); |
| 1095 | 1099 |
| 1096 int start_new_space_size = Heap::new_space()->SizeAsInt(); | 1100 int start_new_space_size = Heap::new_space()->SizeAsInt(); |
| 1097 | 1101 |
| 1098 if (IsHighSurvivalRate()) { | 1102 if (IsHighSurvivalRate()) { |
| 1099 // We speed up the incremental marker if it is running so that it | 1103 // We speed up the incremental marker if it is running so that it |
| 1100 // does not fall behind the rate of promotion, which would cause a | 1104 // does not fall behind the rate of promotion, which would cause a |
| 1101 // constantly growing old space. | 1105 // constantly growing old space. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 | 1190 |
| 1187 // Update relocatables. | 1191 // Update relocatables. |
| 1188 Relocatable::PostGarbageCollectionProcessing(isolate_); | 1192 Relocatable::PostGarbageCollectionProcessing(isolate_); |
| 1189 | 1193 |
| 1190 if (collector == MARK_COMPACTOR) { | 1194 if (collector == MARK_COMPACTOR) { |
| 1191 // Register the amount of external allocated memory. | 1195 // Register the amount of external allocated memory. |
| 1192 amount_of_external_allocated_memory_at_last_global_gc_ = | 1196 amount_of_external_allocated_memory_at_last_global_gc_ = |
| 1193 amount_of_external_allocated_memory_; | 1197 amount_of_external_allocated_memory_; |
| 1194 } | 1198 } |
| 1195 | 1199 |
| 1196 { | 1200 { GCCallbacksScope scope(this); |
| 1197 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); | 1201 if (scope.CheckReenter()) { |
| 1198 VMState<EXTERNAL> state(isolate_); | 1202 AllowHeapAllocation allow_allocation; |
| 1199 HandleScope handle_scope(isolate_); | 1203 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); |
| 1200 CallGCEpilogueCallbacks(gc_type, gc_callback_flags); | 1204 VMState<EXTERNAL> state(isolate_); |
| 1205 HandleScope handle_scope(isolate_); |
| 1206 CallGCEpilogueCallbacks(gc_type, gc_callback_flags); |
| 1207 } |
| 1201 } | 1208 } |
| 1202 | 1209 |
| 1203 #ifdef VERIFY_HEAP | 1210 #ifdef VERIFY_HEAP |
| 1204 if (FLAG_verify_heap) { | 1211 if (FLAG_verify_heap) { |
| 1205 VerifyStringTable(this); | 1212 VerifyStringTable(this); |
| 1206 } | 1213 } |
| 1207 #endif | 1214 #endif |
| 1208 | 1215 |
| 1209 return next_gc_likely_to_collect_more; | 1216 return next_gc_likely_to_collect_more; |
| 1210 } | 1217 } |
| (...skipping 6532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7743 static_cast<int>(object_sizes_last_time_[index])); | 7750 static_cast<int>(object_sizes_last_time_[index])); |
| 7744 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 7751 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 7745 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7752 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 7746 | 7753 |
| 7747 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7754 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 7748 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7755 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 7749 ClearObjectStats(); | 7756 ClearObjectStats(); |
| 7750 } | 7757 } |
| 7751 | 7758 |
| 7752 } } // namespace v8::internal | 7759 } } // namespace v8::internal |
| OLD | NEW |