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

Side by Side Diff: src/heap.cc

Issue 3089008: Backport http://code.google.com/p/v8/source/detail?r=5181 to 2.2.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/2.2/
Patch Set: Created 10 years, 4 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/heap-inl.h » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 4093 matching lines...) Expand 10 before | Expand all | Expand 10 after
4104 heap_configured = true; 4104 heap_configured = true;
4105 return true; 4105 return true;
4106 } 4106 }
4107 4107
4108 4108
4109 bool Heap::ConfigureHeapDefault() { 4109 bool Heap::ConfigureHeapDefault() {
4110 return ConfigureHeap(FLAG_max_new_space_size / 2, FLAG_max_old_space_size); 4110 return ConfigureHeap(FLAG_max_new_space_size / 2, FLAG_max_old_space_size);
4111 } 4111 }
4112 4112
4113 4113
4114 void Heap::RecordStats(HeapStats* stats) { 4114 void Heap::RecordStats(HeapStats* stats, bool take_snapshot) {
4115 *stats->start_marker = 0xDECADE00; 4115 *stats->start_marker = 0xDECADE00;
4116 *stats->end_marker = 0xDECADE01; 4116 *stats->end_marker = 0xDECADE01;
4117 *stats->new_space_size = new_space_.Size(); 4117 *stats->new_space_size = new_space_.Size();
4118 *stats->new_space_capacity = new_space_.Capacity(); 4118 *stats->new_space_capacity = new_space_.Capacity();
4119 *stats->old_pointer_space_size = old_pointer_space_->Size(); 4119 *stats->old_pointer_space_size = old_pointer_space_->Size();
4120 *stats->old_pointer_space_capacity = old_pointer_space_->Capacity(); 4120 *stats->old_pointer_space_capacity = old_pointer_space_->Capacity();
4121 *stats->old_data_space_size = old_data_space_->Size(); 4121 *stats->old_data_space_size = old_data_space_->Size();
4122 *stats->old_data_space_capacity = old_data_space_->Capacity(); 4122 *stats->old_data_space_capacity = old_data_space_->Capacity();
4123 *stats->code_space_size = code_space_->Size(); 4123 *stats->code_space_size = code_space_->Size();
4124 *stats->code_space_capacity = code_space_->Capacity(); 4124 *stats->code_space_capacity = code_space_->Capacity();
4125 *stats->map_space_size = map_space_->Size(); 4125 *stats->map_space_size = map_space_->Size();
4126 *stats->map_space_capacity = map_space_->Capacity(); 4126 *stats->map_space_capacity = map_space_->Capacity();
4127 *stats->cell_space_size = cell_space_->Size(); 4127 *stats->cell_space_size = cell_space_->Size();
4128 *stats->cell_space_capacity = cell_space_->Capacity(); 4128 *stats->cell_space_capacity = cell_space_->Capacity();
4129 *stats->lo_space_size = lo_space_->Size(); 4129 *stats->lo_space_size = lo_space_->Size();
4130 GlobalHandles::RecordStats(stats); 4130 GlobalHandles::RecordStats(stats);
4131 *stats->memory_allocator_size = MemoryAllocator::Size();
4132 *stats->memory_allocator_capacity =
4133 MemoryAllocator::Size() + MemoryAllocator::Available();
4134 if (take_snapshot) {
4135 HeapIterator iterator;
4136 for (HeapObject* obj = iterator.next();
4137 obj != NULL;
4138 obj = iterator.next()) {
4139 // Note: snapshot won't be precise because IsFreeListNode returns true
4140 // for any bytearray.
4141 if (FreeListNode::IsFreeListNode(obj)) continue;
4142 InstanceType type = obj->map()->instance_type();
4143 ASSERT(0 <= type && type <= LAST_TYPE);
4144 stats->objects_per_type[type]++;
4145 stats->size_per_type[type] += obj->Size();
4146 }
4147 }
4131 } 4148 }
4132 4149
4133 4150
4134 int Heap::PromotedSpaceSize() { 4151 int Heap::PromotedSpaceSize() {
4135 return old_pointer_space_->Size() 4152 return old_pointer_space_->Size()
4136 + old_data_space_->Size() 4153 + old_data_space_->Size()
4137 + code_space_->Size() 4154 + code_space_->Size()
4138 + map_space_->Size() 4155 + map_space_->Size()
4139 + cell_space_->Size() 4156 + cell_space_->Size()
4140 + lo_space_->Size(); 4157 + lo_space_->Size();
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
4989 void ExternalStringTable::TearDown() { 5006 void ExternalStringTable::TearDown() {
4990 new_space_strings_.Free(); 5007 new_space_strings_.Free();
4991 old_space_strings_.Free(); 5008 old_space_strings_.Free();
4992 } 5009 }
4993 5010
4994 5011
4995 List<Object*> ExternalStringTable::new_space_strings_; 5012 List<Object*> ExternalStringTable::new_space_strings_;
4996 List<Object*> ExternalStringTable::old_space_strings_; 5013 List<Object*> ExternalStringTable::old_space_strings_;
4997 5014
4998 } } // namespace v8::internal 5015 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698