OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 LargeObjectSpace* Heap::lo_space_ = NULL; | 64 LargeObjectSpace* Heap::lo_space_ = NULL; |
65 | 65 |
66 static const int kMinimumPromotionLimit = 2*MB; | 66 static const int kMinimumPromotionLimit = 2*MB; |
67 static const int kMinimumAllocationLimit = 8*MB; | 67 static const int kMinimumAllocationLimit = 8*MB; |
68 | 68 |
69 int Heap::old_gen_promotion_limit_ = kMinimumPromotionLimit; | 69 int Heap::old_gen_promotion_limit_ = kMinimumPromotionLimit; |
70 int Heap::old_gen_allocation_limit_ = kMinimumAllocationLimit; | 70 int Heap::old_gen_allocation_limit_ = kMinimumAllocationLimit; |
71 | 71 |
72 int Heap::old_gen_exhausted_ = false; | 72 int Heap::old_gen_exhausted_ = false; |
73 | 73 |
74 bool Heap::has_store_ics_ = false; | |
75 | |
76 int Heap::amount_of_external_allocated_memory_ = 0; | 74 int Heap::amount_of_external_allocated_memory_ = 0; |
77 int Heap::amount_of_external_allocated_memory_at_last_global_gc_ = 0; | 75 int Heap::amount_of_external_allocated_memory_at_last_global_gc_ = 0; |
78 | 76 |
79 // semispace_size_ should be a power of 2 and old_generation_size_ should be | 77 // semispace_size_ should be a power of 2 and old_generation_size_ should be |
80 // a multiple of Page::kPageSize. | 78 // a multiple of Page::kPageSize. |
81 int Heap::semispace_size_ = 2*MB; | 79 int Heap::semispace_size_ = 2*MB; |
82 int Heap::old_generation_size_ = 512*MB; | 80 int Heap::old_generation_size_ = 512*MB; |
83 int Heap::initial_semispace_size_ = 256*KB; | 81 int Heap::initial_semispace_size_ = 256*KB; |
84 | 82 |
85 GCCallback Heap::global_gc_prologue_callback_ = NULL; | 83 GCCallback Heap::global_gc_prologue_callback_ = NULL; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 285 |
288 | 286 |
289 void Heap::CollectAllGarbage() { | 287 void Heap::CollectAllGarbage() { |
290 // Since we are ignoring the return value, the exact choice of space does | 288 // Since we are ignoring the return value, the exact choice of space does |
291 // not matter, so long as we do not specify NEW_SPACE, which would not | 289 // not matter, so long as we do not specify NEW_SPACE, which would not |
292 // cause a full GC. | 290 // cause a full GC. |
293 CollectGarbage(0, OLD_POINTER_SPACE); | 291 CollectGarbage(0, OLD_POINTER_SPACE); |
294 } | 292 } |
295 | 293 |
296 | 294 |
297 void Heap::ClearStoreICs() { | |
298 if (has_store_ics_) { | |
299 Counters::clear_store_ic.Increment(); | |
300 CollectAllGarbage(); | |
301 } | |
302 } | |
303 | |
304 | |
305 void Heap::CollectAllGarbageIfContextDisposed() { | 295 void Heap::CollectAllGarbageIfContextDisposed() { |
306 // If the garbage collector interface is exposed through the global | 296 // If the garbage collector interface is exposed through the global |
307 // gc() function, we avoid being clever about forcing GCs when | 297 // gc() function, we avoid being clever about forcing GCs when |
308 // contexts are disposed and leave it to the embedder to make | 298 // contexts are disposed and leave it to the embedder to make |
309 // informed decisions about when to force a collection. | 299 // informed decisions about when to force a collection. |
310 if (!FLAG_expose_gc && context_disposed_pending_) { | 300 if (!FLAG_expose_gc && context_disposed_pending_) { |
311 HistogramTimerScope scope(&Counters::gc_context); | 301 HistogramTimerScope scope(&Counters::gc_context); |
312 CollectAllGarbage(); | 302 CollectAllGarbage(); |
313 } | 303 } |
314 context_disposed_pending_ = false; | 304 context_disposed_pending_ = false; |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 CompilationCache::MarkCompactPrologue(); | 465 CompilationCache::MarkCompactPrologue(); |
476 | 466 |
477 Top::MarkCompactPrologue(is_compacting); | 467 Top::MarkCompactPrologue(is_compacting); |
478 ThreadManager::MarkCompactPrologue(is_compacting); | 468 ThreadManager::MarkCompactPrologue(is_compacting); |
479 } | 469 } |
480 | 470 |
481 | 471 |
482 void Heap::MarkCompactEpilogue(bool is_compacting) { | 472 void Heap::MarkCompactEpilogue(bool is_compacting) { |
483 Top::MarkCompactEpilogue(is_compacting); | 473 Top::MarkCompactEpilogue(is_compacting); |
484 ThreadManager::MarkCompactEpilogue(is_compacting); | 474 ThreadManager::MarkCompactEpilogue(is_compacting); |
485 Heap::has_store_ics_ = false; | |
486 } | 475 } |
487 | 476 |
488 | 477 |
489 Object* Heap::FindCodeObject(Address a) { | 478 Object* Heap::FindCodeObject(Address a) { |
490 Object* obj = code_space_->FindObject(a); | 479 Object* obj = code_space_->FindObject(a); |
491 if (obj->IsFailure()) { | 480 if (obj->IsFailure()) { |
492 obj = lo_space_->FindObject(a); | 481 obj = lo_space_->FindObject(a); |
493 } | 482 } |
494 ASSERT(!obj->IsFailure()); | 483 ASSERT(!obj->IsFailure()); |
495 return obj; | 484 return obj; |
(...skipping 2828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3324 #ifdef DEBUG | 3313 #ifdef DEBUG |
3325 bool Heap::GarbageCollectionGreedyCheck() { | 3314 bool Heap::GarbageCollectionGreedyCheck() { |
3326 ASSERT(FLAG_gc_greedy); | 3315 ASSERT(FLAG_gc_greedy); |
3327 if (Bootstrapper::IsActive()) return true; | 3316 if (Bootstrapper::IsActive()) return true; |
3328 if (disallow_allocation_failure()) return true; | 3317 if (disallow_allocation_failure()) return true; |
3329 return CollectGarbage(0, NEW_SPACE); | 3318 return CollectGarbage(0, NEW_SPACE); |
3330 } | 3319 } |
3331 #endif | 3320 #endif |
3332 | 3321 |
3333 } } // namespace v8::internal | 3322 } } // namespace v8::internal |
OLD | NEW |