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

Side by Side Diff: src/heap.cc

Issue 14139033: Clean up VMState a little bit. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fixed mistake Created 7 years, 8 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/handles.cc ('k') | src/ia32/macro-assembler-ia32.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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 UncommitFromSpace(); 599 UncommitFromSpace();
600 incremental_marking()->UncommitMarkingDeque(); 600 incremental_marking()->UncommitMarkingDeque();
601 } 601 }
602 602
603 603
604 bool Heap::CollectGarbage(AllocationSpace space, 604 bool Heap::CollectGarbage(AllocationSpace space,
605 GarbageCollector collector, 605 GarbageCollector collector,
606 const char* gc_reason, 606 const char* gc_reason,
607 const char* collector_reason) { 607 const char* collector_reason) {
608 // The VM is in the GC state until exiting this function. 608 // The VM is in the GC state until exiting this function.
609 VMState state(isolate_, GC); 609 VMState<GC> state(isolate_);
610 610
611 #ifdef DEBUG 611 #ifdef DEBUG
612 // Reset the allocation timeout to the GC interval, but make sure to 612 // Reset the allocation timeout to the GC interval, but make sure to
613 // allow at least a few allocations after a collection. The reason 613 // allow at least a few allocations after a collection. The reason
614 // for this is that we have a lot of allocation sequences and we 614 // for this is that we have a lot of allocation sequences and we
615 // assume that a garbage collection will allow the subsequent 615 // assume that a garbage collection will allow the subsequent
616 // allocation attempts to go through. 616 // allocation attempts to go through.
617 allocation_timeout_ = Max(6, FLAG_gc_interval); 617 allocation_timeout_ = Max(6, FLAG_gc_interval);
618 #endif 618 #endif
619 619
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 if (FLAG_verify_heap) { 885 if (FLAG_verify_heap) {
886 VerifyStringTable(); 886 VerifyStringTable();
887 } 887 }
888 #endif 888 #endif
889 889
890 GCType gc_type = 890 GCType gc_type =
891 collector == MARK_COMPACTOR ? kGCTypeMarkSweepCompact : kGCTypeScavenge; 891 collector == MARK_COMPACTOR ? kGCTypeMarkSweepCompact : kGCTypeScavenge;
892 892
893 { 893 {
894 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); 894 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL);
895 VMState state(isolate_, EXTERNAL); 895 VMState<EXTERNAL> state(isolate_);
896 CallGCPrologueCallbacks(gc_type); 896 CallGCPrologueCallbacks(gc_type);
897 } 897 }
898 898
899 EnsureFromSpaceIsCommitted(); 899 EnsureFromSpaceIsCommitted();
900 900
901 int start_new_space_size = Heap::new_space()->SizeAsInt(); 901 int start_new_space_size = Heap::new_space()->SizeAsInt();
902 902
903 if (IsHighSurvivalRate()) { 903 if (IsHighSurvivalRate()) {
904 // We speed up the incremental marker if it is running so that it 904 // We speed up the incremental marker if it is running so that it
905 // does not fall behind the rate of promotion, which would cause a 905 // does not fall behind the rate of promotion, which would cause a
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 Relocatable::PostGarbageCollectionProcessing(); 1007 Relocatable::PostGarbageCollectionProcessing();
1008 1008
1009 if (collector == MARK_COMPACTOR) { 1009 if (collector == MARK_COMPACTOR) {
1010 // Register the amount of external allocated memory. 1010 // Register the amount of external allocated memory.
1011 amount_of_external_allocated_memory_at_last_global_gc_ = 1011 amount_of_external_allocated_memory_at_last_global_gc_ =
1012 amount_of_external_allocated_memory_; 1012 amount_of_external_allocated_memory_;
1013 } 1013 }
1014 1014
1015 { 1015 {
1016 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); 1016 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL);
1017 VMState state(isolate_, EXTERNAL); 1017 VMState<EXTERNAL> state(isolate_);
1018 CallGCEpilogueCallbacks(gc_type); 1018 CallGCEpilogueCallbacks(gc_type);
1019 } 1019 }
1020 1020
1021 #ifdef VERIFY_HEAP 1021 #ifdef VERIFY_HEAP
1022 if (FLAG_verify_heap) { 1022 if (FLAG_verify_heap) {
1023 VerifyStringTable(); 1023 VerifyStringTable();
1024 } 1024 }
1025 #endif 1025 #endif
1026 1026
1027 return next_gc_likely_to_collect_more; 1027 return next_gc_likely_to_collect_more;
(...skipping 6832 matching lines...) Expand 10 before | Expand all | Expand 10 after
7860 static_cast<int>(object_sizes_last_time_[index])); 7860 static_cast<int>(object_sizes_last_time_[index]));
7861 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7861 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7862 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7862 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7863 7863
7864 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7864 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7865 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7865 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7866 ClearObjectStats(); 7866 ClearObjectStats();
7867 } 7867 }
7868 7868
7869 } } // namespace v8::internal 7869 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.cc ('k') | src/ia32/macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698