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 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 | 862 |
863 if (collector == MARK_COMPACTOR && global_gc_prologue_callback_) { | 863 if (collector == MARK_COMPACTOR && global_gc_prologue_callback_) { |
864 ASSERT(!allocation_allowed_); | 864 ASSERT(!allocation_allowed_); |
865 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); | 865 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); |
866 global_gc_prologue_callback_(); | 866 global_gc_prologue_callback_(); |
867 } | 867 } |
868 | 868 |
869 GCType gc_type = | 869 GCType gc_type = |
870 collector == MARK_COMPACTOR ? kGCTypeMarkSweepCompact : kGCTypeScavenge; | 870 collector == MARK_COMPACTOR ? kGCTypeMarkSweepCompact : kGCTypeScavenge; |
871 | 871 |
872 for (int i = 0; i < gc_prologue_callbacks_.length(); ++i) { | 872 { |
873 if (gc_type & gc_prologue_callbacks_[i].gc_type) { | 873 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); |
874 gc_prologue_callbacks_[i].callback(gc_type, kNoGCCallbackFlags); | 874 for (int i = 0; i < gc_prologue_callbacks_.length(); ++i) { |
| 875 if (gc_type & gc_prologue_callbacks_[i].gc_type) { |
| 876 gc_prologue_callbacks_[i].callback(gc_type, kNoGCCallbackFlags); |
| 877 } |
875 } | 878 } |
876 } | 879 } |
877 | 880 |
878 EnsureFromSpaceIsCommitted(); | 881 EnsureFromSpaceIsCommitted(); |
879 | 882 |
880 int start_new_space_size = Heap::new_space()->SizeAsInt(); | 883 int start_new_space_size = Heap::new_space()->SizeAsInt(); |
881 | 884 |
882 if (IsHighSurvivalRate()) { | 885 if (IsHighSurvivalRate()) { |
883 // We speed up the incremental marker if it is running so that it | 886 // We speed up the incremental marker if it is running so that it |
884 // does not fall behind the rate of promotion, which would cause a | 887 // does not fall behind the rate of promotion, which would cause a |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 | 975 |
973 // Update relocatables. | 976 // Update relocatables. |
974 Relocatable::PostGarbageCollectionProcessing(); | 977 Relocatable::PostGarbageCollectionProcessing(); |
975 | 978 |
976 if (collector == MARK_COMPACTOR) { | 979 if (collector == MARK_COMPACTOR) { |
977 // Register the amount of external allocated memory. | 980 // Register the amount of external allocated memory. |
978 amount_of_external_allocated_memory_at_last_global_gc_ = | 981 amount_of_external_allocated_memory_at_last_global_gc_ = |
979 amount_of_external_allocated_memory_; | 982 amount_of_external_allocated_memory_; |
980 } | 983 } |
981 | 984 |
982 GCCallbackFlags callback_flags = kNoGCCallbackFlags; | 985 { |
983 for (int i = 0; i < gc_epilogue_callbacks_.length(); ++i) { | 986 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); |
984 if (gc_type & gc_epilogue_callbacks_[i].gc_type) { | 987 GCCallbackFlags callback_flags = kNoGCCallbackFlags; |
985 gc_epilogue_callbacks_[i].callback(gc_type, callback_flags); | 988 for (int i = 0; i < gc_epilogue_callbacks_.length(); ++i) { |
| 989 if (gc_type & gc_epilogue_callbacks_[i].gc_type) { |
| 990 gc_epilogue_callbacks_[i].callback(gc_type, callback_flags); |
| 991 } |
986 } | 992 } |
987 } | 993 } |
988 | 994 |
989 if (collector == MARK_COMPACTOR && global_gc_epilogue_callback_) { | 995 if (collector == MARK_COMPACTOR && global_gc_epilogue_callback_) { |
990 ASSERT(!allocation_allowed_); | 996 ASSERT(!allocation_allowed_); |
991 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); | 997 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); |
992 global_gc_epilogue_callback_(); | 998 global_gc_epilogue_callback_(); |
993 } | 999 } |
994 | 1000 |
995 #ifdef VERIFY_HEAP | 1001 #ifdef VERIFY_HEAP |
(...skipping 6360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7356 static_cast<int>(object_sizes_last_time_[index])); | 7362 static_cast<int>(object_sizes_last_time_[index])); |
7357 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7363 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7358 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7364 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7359 | 7365 |
7360 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7366 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7361 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7367 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7362 ClearObjectStats(); | 7368 ClearObjectStats(); |
7363 } | 7369 } |
7364 | 7370 |
7365 } } // namespace v8::internal | 7371 } } // namespace v8::internal |
OLD | NEW |