Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: src/heap.cc

Issue 11953043: Implicit references are missing in heap profiles (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap.h ('k') | src/profile-generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 if (collector != SCAVENGER) { 875 if (collector != SCAVENGER) {
876 PROFILE(isolate_, CodeMovingGCEvent()); 876 PROFILE(isolate_, CodeMovingGCEvent());
877 } 877 }
878 878
879 #ifdef VERIFY_HEAP 879 #ifdef VERIFY_HEAP
880 if (FLAG_verify_heap) { 880 if (FLAG_verify_heap) {
881 VerifySymbolTable(); 881 VerifySymbolTable();
882 } 882 }
883 #endif 883 #endif
884 884
885 if (collector == MARK_COMPACTOR && global_gc_prologue_callback_) {
886 ASSERT(!allocation_allowed_);
887 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL);
888 VMState state(isolate_, EXTERNAL);
889 global_gc_prologue_callback_();
890 }
891
892 GCType gc_type = 885 GCType gc_type =
893 collector == MARK_COMPACTOR ? kGCTypeMarkSweepCompact : kGCTypeScavenge; 886 collector == MARK_COMPACTOR ? kGCTypeMarkSweepCompact : kGCTypeScavenge;
894 887
895 { 888 {
896 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); 889 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL);
897 VMState state(isolate_, EXTERNAL); 890 VMState state(isolate_, EXTERNAL);
898 for (int i = 0; i < gc_prologue_callbacks_.length(); ++i) { 891 CallGCPrologueCallbacks(gc_type);
899 if (gc_type & gc_prologue_callbacks_[i].gc_type) {
900 gc_prologue_callbacks_[i].callback(gc_type, kNoGCCallbackFlags);
901 }
902 }
903 } 892 }
904 893
905 EnsureFromSpaceIsCommitted(); 894 EnsureFromSpaceIsCommitted();
906 895
907 int start_new_space_size = Heap::new_space()->SizeAsInt(); 896 int start_new_space_size = Heap::new_space()->SizeAsInt();
908 897
909 if (IsHighSurvivalRate()) { 898 if (IsHighSurvivalRate()) {
910 // We speed up the incremental marker if it is running so that it 899 // We speed up the incremental marker if it is running so that it
911 // does not fall behind the rate of promotion, which would cause a 900 // does not fall behind the rate of promotion, which would cause a
912 // constantly growing old space. 901 // constantly growing old space.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 991
1003 if (collector == MARK_COMPACTOR) { 992 if (collector == MARK_COMPACTOR) {
1004 // Register the amount of external allocated memory. 993 // Register the amount of external allocated memory.
1005 amount_of_external_allocated_memory_at_last_global_gc_ = 994 amount_of_external_allocated_memory_at_last_global_gc_ =
1006 amount_of_external_allocated_memory_; 995 amount_of_external_allocated_memory_;
1007 } 996 }
1008 997
1009 { 998 {
1010 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); 999 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL);
1011 VMState state(isolate_, EXTERNAL); 1000 VMState state(isolate_, EXTERNAL);
1012 GCCallbackFlags callback_flags = kNoGCCallbackFlags; 1001 CallGCEpilogueCallbacks(gc_type);
1013 for (int i = 0; i < gc_epilogue_callbacks_.length(); ++i) {
1014 if (gc_type & gc_epilogue_callbacks_[i].gc_type) {
1015 gc_epilogue_callbacks_[i].callback(gc_type, callback_flags);
1016 }
1017 }
1018 }
1019
1020 if (collector == MARK_COMPACTOR && global_gc_epilogue_callback_) {
1021 ASSERT(!allocation_allowed_);
1022 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL);
1023 VMState state(isolate_, EXTERNAL);
1024 global_gc_epilogue_callback_();
1025 } 1002 }
1026 1003
1027 #ifdef VERIFY_HEAP 1004 #ifdef VERIFY_HEAP
1028 if (FLAG_verify_heap) { 1005 if (FLAG_verify_heap) {
1029 VerifySymbolTable(); 1006 VerifySymbolTable();
1030 } 1007 }
1031 #endif 1008 #endif
1032 1009
1033 return next_gc_likely_to_collect_more; 1010 return next_gc_likely_to_collect_more;
1034 } 1011 }
1035 1012
1036 1013
1014 void Heap::CallGCPrologueCallbacks(GCType gc_type) {
1015 if (gc_type == kGCTypeMarkSweepCompact && global_gc_prologue_callback_) {
1016 global_gc_prologue_callback_();
1017 }
1018 for (int i = 0; i < gc_prologue_callbacks_.length(); ++i) {
1019 if (gc_type & gc_prologue_callbacks_[i].gc_type) {
1020 gc_prologue_callbacks_[i].callback(gc_type, kNoGCCallbackFlags);
1021 }
1022 }
1023 }
1024
1025
1026 void Heap::CallGCEpilogueCallbacks(GCType gc_type) {
1027 for (int i = 0; i < gc_epilogue_callbacks_.length(); ++i) {
1028 if (gc_type & gc_epilogue_callbacks_[i].gc_type) {
1029 gc_epilogue_callbacks_[i].callback(gc_type, kNoGCCallbackFlags);
1030 }
1031 }
1032 if (gc_type == kGCTypeMarkSweepCompact && global_gc_epilogue_callback_) {
1033 global_gc_epilogue_callback_();
1034 }
1035 }
1036
1037
1037 void Heap::MarkCompact(GCTracer* tracer) { 1038 void Heap::MarkCompact(GCTracer* tracer) {
1038 gc_state_ = MARK_COMPACT; 1039 gc_state_ = MARK_COMPACT;
1039 LOG(isolate_, ResourceEvent("markcompact", "begin")); 1040 LOG(isolate_, ResourceEvent("markcompact", "begin"));
1040 1041
1041 mark_compact_collector_.Prepare(tracer); 1042 mark_compact_collector_.Prepare(tracer);
1042 1043
1043 ms_count_++; 1044 ms_count_++;
1044 tracer->set_full_gc_count(ms_count_); 1045 tracer->set_full_gc_count(ms_count_);
1045 1046
1046 MarkCompactPrologue(); 1047 MarkCompactPrologue();
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 // Scavenge object reachable from the native contexts list directly. 1370 // Scavenge object reachable from the native contexts list directly.
1370 scavenge_visitor.VisitPointer(BitCast<Object**>(&native_contexts_list_)); 1371 scavenge_visitor.VisitPointer(BitCast<Object**>(&native_contexts_list_));
1371 1372
1372 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); 1373 new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
1373 1374
1374 while (isolate()->global_handles()->IterateObjectGroups( 1375 while (isolate()->global_handles()->IterateObjectGroups(
1375 &scavenge_visitor, &IsUnscavengedHeapObject)) { 1376 &scavenge_visitor, &IsUnscavengedHeapObject)) {
1376 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); 1377 new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
1377 } 1378 }
1378 isolate()->global_handles()->RemoveObjectGroups(); 1379 isolate()->global_handles()->RemoveObjectGroups();
1380 isolate()->global_handles()->RemoveImplicitRefGroups();
1379 1381
1380 isolate_->global_handles()->IdentifyNewSpaceWeakIndependentHandles( 1382 isolate_->global_handles()->IdentifyNewSpaceWeakIndependentHandles(
1381 &IsUnscavengedHeapObject); 1383 &IsUnscavengedHeapObject);
1382 isolate_->global_handles()->IterateNewSpaceWeakIndependentRoots( 1384 isolate_->global_handles()->IterateNewSpaceWeakIndependentRoots(
1383 &scavenge_visitor); 1385 &scavenge_visitor);
1384 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); 1386 new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
1385 1387
1386 UpdateNewSpaceReferencesInExternalStringTable( 1388 UpdateNewSpaceReferencesInExternalStringTable(
1387 &UpdateNewSpaceReferenceInExternalStringTableEntry); 1389 &UpdateNewSpaceReferenceInExternalStringTableEntry);
1388 1390
(...skipping 6119 matching lines...) Expand 10 before | Expand all | Expand 10 after
7508 static_cast<int>(object_sizes_last_time_[index])); 7510 static_cast<int>(object_sizes_last_time_[index]));
7509 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7511 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7510 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7512 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7511 7513
7512 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7514 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7513 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7515 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7514 ClearObjectStats(); 7516 ClearObjectStats();
7515 } 7517 }
7516 7518
7517 } } // namespace v8::internal 7519 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698