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

Side by Side Diff: src/heap.cc

Issue 11232065: Expose gc(true) to JavaScript, which triggers a scavenger GC. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Fix styles Created 8 years, 1 month 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
« src/heap.h ('K') | « src/heap.h ('k') | no next file » | 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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 if (incremental_marking()->IsStopped()) { 664 if (incremental_marking()->IsStopped()) {
665 if (incremental_marking()->WorthActivating() && NextGCIsLikelyToBeFull()) { 665 if (incremental_marking()->WorthActivating() && NextGCIsLikelyToBeFull()) {
666 incremental_marking()->Start(); 666 incremental_marking()->Start();
667 } 667 }
668 } 668 }
669 669
670 return next_gc_likely_to_collect_more; 670 return next_gc_likely_to_collect_more;
671 } 671 }
672 672
673 673
674 void Heap::PerformScavenge() { 674 void Heap::PerformScavenge(bool force_scavenge) {
Michael Starzinger 2012/10/25 11:47:29 This change becomes obsolete then.
haraken 2012/10/25 11:54:49 Done.
675 GCTracer tracer(this, NULL, NULL); 675 GCTracer tracer(this, NULL, NULL);
676 if (incremental_marking()->IsStopped()) { 676 if (force_scavenge || incremental_marking()->IsStopped()) {
677 PerformGarbageCollection(SCAVENGER, &tracer); 677 PerformGarbageCollection(SCAVENGER, &tracer);
678 } else { 678 } else {
679 PerformGarbageCollection(MARK_COMPACTOR, &tracer); 679 PerformGarbageCollection(MARK_COMPACTOR, &tracer);
680 } 680 }
681 } 681 }
682 682
683 683
684 #ifdef VERIFY_HEAP 684 #ifdef VERIFY_HEAP
685 // Helper class for verifying the symbol table. 685 // Helper class for verifying the symbol table.
686 class SymbolTableVerifier : public ObjectVisitor { 686 class SymbolTableVerifier : public ObjectVisitor {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 set_survival_rate_trend(INCREASING); 845 set_survival_rate_trend(INCREASING);
846 } else { 846 } else {
847 set_survival_rate_trend(STABLE); 847 set_survival_rate_trend(STABLE);
848 } 848 }
849 849
850 survival_rate_ = survival_rate; 850 survival_rate_ = survival_rate;
851 } 851 }
852 852
853 bool Heap::PerformGarbageCollection(GarbageCollector collector, 853 bool Heap::PerformGarbageCollection(GarbageCollector collector,
854 GCTracer* tracer) { 854 GCTracer* tracer) {
855 if (collector == SCAVENGER)
Michael Starzinger 2012/10/25 11:47:29 Looks like leftover debugging code.
haraken 2012/10/25 11:54:49 Done.
856 fprintf(stderr, "SCAVENGER\n");
857 else
858 fprintf(stderr, "MARK_AND_COMPACT\n");
855 bool next_gc_likely_to_collect_more = false; 859 bool next_gc_likely_to_collect_more = false;
856 860
857 if (collector != SCAVENGER) { 861 if (collector != SCAVENGER) {
858 PROFILE(isolate_, CodeMovingGCEvent()); 862 PROFILE(isolate_, CodeMovingGCEvent());
859 } 863 }
860 864
861 #ifdef VERIFY_HEAP 865 #ifdef VERIFY_HEAP
862 if (FLAG_verify_heap) { 866 if (FLAG_verify_heap) {
863 VerifySymbolTable(); 867 VerifySymbolTable();
864 } 868 }
(...skipping 6495 matching lines...) Expand 10 before | Expand all | Expand 10 after
7360 static_cast<int>(object_sizes_last_time_[index])); 7364 static_cast<int>(object_sizes_last_time_[index]));
7361 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7365 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7362 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7366 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7363 7367
7364 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7368 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7365 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7369 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7366 ClearObjectStats(); 7370 ClearObjectStats();
7367 } 7371 }
7368 7372
7369 } } // namespace v8::internal 7373 } } // namespace v8::internal
OLDNEW
« src/heap.h ('K') | « src/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698