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 6191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6202 | 6202 |
6203 | 6203 |
6204 V8_DECLARE_ONCE(initialize_gc_once); | 6204 V8_DECLARE_ONCE(initialize_gc_once); |
6205 | 6205 |
6206 static void InitializeGCOnce() { | 6206 static void InitializeGCOnce() { |
6207 InitializeScavengingVisitorsTables(); | 6207 InitializeScavengingVisitorsTables(); |
6208 NewSpaceScavenger::Initialize(); | 6208 NewSpaceScavenger::Initialize(); |
6209 MarkCompactCollector::Initialize(); | 6209 MarkCompactCollector::Initialize(); |
6210 } | 6210 } |
6211 | 6211 |
6212 bool Heap::SetUp(bool create_heap_objects) { | 6212 bool Heap::Prepare() { |
Michael Starzinger
2013/02/21 19:39:23
I think it makes more sense to keep this method be
danno
2013/02/25 11:11:23
Done.
| |
6213 #ifdef DEBUG | 6213 #ifdef DEBUG |
6214 allocation_timeout_ = FLAG_gc_interval; | 6214 allocation_timeout_ = FLAG_gc_interval; |
6215 #endif | 6215 #endif |
6216 | 6216 |
6217 // Initialize heap spaces and initial maps and objects. Whenever something | 6217 // Initialize heap spaces and initial maps and objects. Whenever something |
6218 // goes wrong, just return false. The caller should check the results and | 6218 // goes wrong, just return false. The caller should check the results and |
6219 // call Heap::TearDown() to release allocated memory. | 6219 // call Heap::TearDown() to release allocated memory. |
6220 // | 6220 // |
6221 // If the heap is not yet configured (e.g. through the API), configure it. | 6221 // If the heap is not yet configured (e.g. through the API), configure it. |
6222 // Configuration is based on the flags new-space-size (really the semispace | 6222 // Configuration is based on the flags new-space-size (really the semispace |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6293 ASSERT(hash_seed() == 0); | 6293 ASSERT(hash_seed() == 0); |
6294 if (FLAG_randomize_hashes) { | 6294 if (FLAG_randomize_hashes) { |
6295 if (FLAG_hash_seed == 0) { | 6295 if (FLAG_hash_seed == 0) { |
6296 set_hash_seed( | 6296 set_hash_seed( |
6297 Smi::FromInt(V8::RandomPrivate(isolate()) & 0x3fffffff)); | 6297 Smi::FromInt(V8::RandomPrivate(isolate()) & 0x3fffffff)); |
6298 } else { | 6298 } else { |
6299 set_hash_seed(Smi::FromInt(FLAG_hash_seed)); | 6299 set_hash_seed(Smi::FromInt(FLAG_hash_seed)); |
6300 } | 6300 } |
6301 } | 6301 } |
6302 | 6302 |
6303 return true; | |
6304 } | |
6305 | |
6306 bool Heap::SetUp(bool create_heap_objects) { | |
6303 if (create_heap_objects) { | 6307 if (create_heap_objects) { |
6304 // Create initial maps. | 6308 // Create initial maps. |
6305 if (!CreateInitialMaps()) return false; | 6309 if (!CreateInitialMaps()) return false; |
6306 if (!CreateApiObjects()) return false; | 6310 if (!CreateApiObjects()) return false; |
6307 | 6311 |
6308 // Create initial objects | 6312 // Create initial objects |
6309 if (!CreateInitialObjects()) return false; | 6313 if (!CreateInitialObjects()) return false; |
6310 | 6314 |
6311 native_contexts_list_ = undefined_value(); | 6315 native_contexts_list_ = undefined_value(); |
6312 } | 6316 } |
6313 | 6317 |
6314 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); | 6318 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); |
6315 LOG(isolate_, IntPtrTEvent("heap-available", Available())); | 6319 LOG(isolate_, IntPtrTEvent("heap-available", Available())); |
6316 | 6320 |
6317 store_buffer()->SetUp(); | 6321 store_buffer()->SetUp(); |
Michael Starzinger
2013/02/21 19:39:23
Also is it possible to move all of the steps that
danno
2013/02/25 11:11:23
Done.
| |
6318 | 6322 |
6319 if (FLAG_parallel_recompilation) relocation_mutex_ = OS::CreateMutex(); | 6323 if (FLAG_parallel_recompilation) relocation_mutex_ = OS::CreateMutex(); |
6320 | 6324 |
6321 return true; | 6325 return true; |
6322 } | 6326 } |
6323 | 6327 |
6324 | 6328 |
6325 void Heap::SetStackLimits() { | 6329 void Heap::SetStackLimits() { |
6326 ASSERT(isolate_ != NULL); | 6330 ASSERT(isolate_ != NULL); |
6327 ASSERT(isolate_ == isolate()); | 6331 ASSERT(isolate_ == isolate()); |
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7535 static_cast<int>(object_sizes_last_time_[index])); | 7539 static_cast<int>(object_sizes_last_time_[index])); |
7536 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7540 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7537 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7541 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7538 | 7542 |
7539 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7543 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7540 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7544 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7541 ClearObjectStats(); | 7545 ClearObjectStats(); |
7542 } | 7546 } |
7543 | 7547 |
7544 } } // namespace v8::internal | 7548 } } // namespace v8::internal |
OLD | NEW |