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

Side by Side Diff: src/heap.cc

Issue 10807024: Optimize functions on a second thread. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 5 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 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 incremental_marking_(this), 148 incremental_marking_(this),
149 number_idle_notifications_(0), 149 number_idle_notifications_(0),
150 last_idle_notification_gc_count_(0), 150 last_idle_notification_gc_count_(0),
151 last_idle_notification_gc_count_init_(false), 151 last_idle_notification_gc_count_init_(false),
152 mark_sweeps_since_idle_round_started_(0), 152 mark_sweeps_since_idle_round_started_(0),
153 ms_count_at_last_idle_notification_(0), 153 ms_count_at_last_idle_notification_(0),
154 gc_count_at_last_idle_gc_(0), 154 gc_count_at_last_idle_gc_(0),
155 scavenges_since_last_idle_round_(kIdleScavengeThreshold), 155 scavenges_since_last_idle_round_(kIdleScavengeThreshold),
156 promotion_queue_(this), 156 promotion_queue_(this),
157 configured_(false), 157 configured_(false),
158 chunks_queued_for_free_(NULL) { 158 chunks_queued_for_free_(NULL),
159 relocation_mutex_(NULL) {
159 // Allow build-time customization of the max semispace size. Building 160 // Allow build-time customization of the max semispace size. Building
160 // V8 with snapshots and a non-default max semispace size is much 161 // V8 with snapshots and a non-default max semispace size is much
161 // easier if you can define it as part of the build environment. 162 // easier if you can define it as part of the build environment.
162 #if defined(V8_MAX_SEMISPACE_SIZE) 163 #if defined(V8_MAX_SEMISPACE_SIZE)
163 max_semispace_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE; 164 max_semispace_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE;
164 #endif 165 #endif
165 166
166 intptr_t max_virtual = OS::MaxVirtualMemory(); 167 intptr_t max_virtual = OS::MaxVirtualMemory();
167 168
168 if (max_virtual > 0) { 169 if (max_virtual > 0) {
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 } 1193 }
1193 return NULL; 1194 return NULL;
1194 } 1195 }
1195 1196
1196 private: 1197 private:
1197 Heap* heap_; 1198 Heap* heap_;
1198 }; 1199 };
1199 1200
1200 1201
1201 void Heap::Scavenge() { 1202 void Heap::Scavenge() {
1203 RelocationLock relocation_lock(this);
1202 #ifdef DEBUG 1204 #ifdef DEBUG
1203 if (FLAG_verify_heap) VerifyNonPointerSpacePointers(); 1205 if (FLAG_verify_heap) VerifyNonPointerSpacePointers();
1204 #endif 1206 #endif
1205 1207
1206 gc_state_ = SCAVENGE; 1208 gc_state_ = SCAVENGE;
1207 1209
1208 // Implements Cheney's copying algorithm 1210 // Implements Cheney's copying algorithm
1209 LOG(isolate_, ResourceEvent("scavenge", "begin")); 1211 LOG(isolate_, ResourceEvent("scavenge", "begin"));
1210 1212
1211 // Clear descriptor cache. 1213 // Clear descriptor cache.
(...skipping 4937 matching lines...) Expand 10 before | Expand all | Expand 10 after
6149 if (!CreateInitialObjects()) return false; 6151 if (!CreateInitialObjects()) return false;
6150 6152
6151 global_contexts_list_ = undefined_value(); 6153 global_contexts_list_ = undefined_value();
6152 } 6154 }
6153 6155
6154 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); 6156 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity()));
6155 LOG(isolate_, IntPtrTEvent("heap-available", Available())); 6157 LOG(isolate_, IntPtrTEvent("heap-available", Available()));
6156 6158
6157 store_buffer()->SetUp(); 6159 store_buffer()->SetUp();
6158 6160
6161 if (FLAG_parallel_recompilation) relocation_mutex_ = OS::CreateMutex();
6162
6159 return true; 6163 return true;
6160 } 6164 }
6161 6165
6162 6166
6163 void Heap::SetStackLimits() { 6167 void Heap::SetStackLimits() {
6164 ASSERT(isolate_ != NULL); 6168 ASSERT(isolate_ != NULL);
6165 ASSERT(isolate_ == isolate()); 6169 ASSERT(isolate_ == isolate());
6166 // On 64 bit machines, pointers are generally out of range of Smis. We write 6170 // On 64 bit machines, pointers are generally out of range of Smis. We write
6167 // something that looks like an out of range Smi to the GC. 6171 // something that looks like an out of range Smi to the GC.
6168 6172
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
6234 lo_space_->TearDown(); 6238 lo_space_->TearDown();
6235 delete lo_space_; 6239 delete lo_space_;
6236 lo_space_ = NULL; 6240 lo_space_ = NULL;
6237 } 6241 }
6238 6242
6239 store_buffer()->TearDown(); 6243 store_buffer()->TearDown();
6240 incremental_marking()->TearDown(); 6244 incremental_marking()->TearDown();
6241 6245
6242 isolate_->memory_allocator()->TearDown(); 6246 isolate_->memory_allocator()->TearDown();
6243 6247
6248 delete relocation_mutex_;
6249
6244 #ifdef DEBUG 6250 #ifdef DEBUG
6245 delete debug_utils_; 6251 delete debug_utils_;
6246 debug_utils_ = NULL; 6252 debug_utils_ = NULL;
6247 #endif 6253 #endif
6248 } 6254 }
6249 6255
6250 6256
6251 void Heap::Shrink() { 6257 void Heap::Shrink() {
6252 // Try to shrink all paged spaces. 6258 // Try to shrink all paged spaces.
6253 PagedSpaces spaces; 6259 PagedSpaces spaces;
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after
7218 static_cast<int>(object_sizes_last_time_[index])); 7224 static_cast<int>(object_sizes_last_time_[index]));
7219 CODE_KIND_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7225 CODE_KIND_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7220 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7226 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7221 7227
7222 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7228 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7223 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7229 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7224 ClearObjectStats(); 7230 ClearObjectStats();
7225 } 7231 }
7226 7232
7227 } } // namespace v8::internal 7233 } } // 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