OLD | NEW |
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 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 } | 1192 } |
1193 return NULL; | 1193 return NULL; |
1194 } | 1194 } |
1195 | 1195 |
1196 private: | 1196 private: |
1197 Heap* heap_; | 1197 Heap* heap_; |
1198 }; | 1198 }; |
1199 | 1199 |
1200 | 1200 |
1201 void Heap::Scavenge() { | 1201 void Heap::Scavenge() { |
| 1202 RelocationLock relocation_lock(this); |
1202 #ifdef DEBUG | 1203 #ifdef DEBUG |
1203 if (FLAG_verify_heap) VerifyNonPointerSpacePointers(); | 1204 if (FLAG_verify_heap) VerifyNonPointerSpacePointers(); |
1204 #endif | 1205 #endif |
1205 | 1206 |
1206 gc_state_ = SCAVENGE; | 1207 gc_state_ = SCAVENGE; |
1207 | 1208 |
1208 // Implements Cheney's copying algorithm | 1209 // Implements Cheney's copying algorithm |
1209 LOG(isolate_, ResourceEvent("scavenge", "begin")); | 1210 LOG(isolate_, ResourceEvent("scavenge", "begin")); |
1210 | 1211 |
1211 // Clear descriptor cache. | 1212 // Clear descriptor cache. |
(...skipping 4937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6149 if (!CreateInitialObjects()) return false; | 6150 if (!CreateInitialObjects()) return false; |
6150 | 6151 |
6151 global_contexts_list_ = undefined_value(); | 6152 global_contexts_list_ = undefined_value(); |
6152 } | 6153 } |
6153 | 6154 |
6154 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); | 6155 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); |
6155 LOG(isolate_, IntPtrTEvent("heap-available", Available())); | 6156 LOG(isolate_, IntPtrTEvent("heap-available", Available())); |
6156 | 6157 |
6157 store_buffer()->SetUp(); | 6158 store_buffer()->SetUp(); |
6158 | 6159 |
| 6160 if (FLAG_parallel_recompilation) relocation_mutex_ = OS::CreateMutex(); |
| 6161 |
6159 return true; | 6162 return true; |
6160 } | 6163 } |
6161 | 6164 |
6162 | 6165 |
6163 void Heap::SetStackLimits() { | 6166 void Heap::SetStackLimits() { |
6164 ASSERT(isolate_ != NULL); | 6167 ASSERT(isolate_ != NULL); |
6165 ASSERT(isolate_ == isolate()); | 6168 ASSERT(isolate_ == isolate()); |
6166 // On 64 bit machines, pointers are generally out of range of Smis. We write | 6169 // 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. | 6170 // something that looks like an out of range Smi to the GC. |
6168 | 6171 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6234 lo_space_->TearDown(); | 6237 lo_space_->TearDown(); |
6235 delete lo_space_; | 6238 delete lo_space_; |
6236 lo_space_ = NULL; | 6239 lo_space_ = NULL; |
6237 } | 6240 } |
6238 | 6241 |
6239 store_buffer()->TearDown(); | 6242 store_buffer()->TearDown(); |
6240 incremental_marking()->TearDown(); | 6243 incremental_marking()->TearDown(); |
6241 | 6244 |
6242 isolate_->memory_allocator()->TearDown(); | 6245 isolate_->memory_allocator()->TearDown(); |
6243 | 6246 |
| 6247 delete relocation_mutex_; |
| 6248 |
6244 #ifdef DEBUG | 6249 #ifdef DEBUG |
6245 delete debug_utils_; | 6250 delete debug_utils_; |
6246 debug_utils_ = NULL; | 6251 debug_utils_ = NULL; |
6247 #endif | 6252 #endif |
6248 } | 6253 } |
6249 | 6254 |
6250 | 6255 |
6251 void Heap::Shrink() { | 6256 void Heap::Shrink() { |
6252 // Try to shrink all paged spaces. | 6257 // Try to shrink all paged spaces. |
6253 PagedSpaces spaces; | 6258 PagedSpaces spaces; |
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7218 static_cast<int>(object_sizes_last_time_[index])); | 7223 static_cast<int>(object_sizes_last_time_[index])); |
7219 CODE_KIND_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7224 CODE_KIND_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7220 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7225 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7221 | 7226 |
7222 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7227 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7223 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7228 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7224 ClearObjectStats(); | 7229 ClearObjectStats(); |
7225 } | 7230 } |
7226 | 7231 |
7227 } } // namespace v8::internal | 7232 } } // namespace v8::internal |
OLD | NEW |