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

Side by Side Diff: src/heap.cc

Issue 661458: Remove the deprecated context disposal GC heuristic. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 9 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') | no next file » | 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 int Heap::survived_since_last_expansion_ = 0; 108 int Heap::survived_since_last_expansion_ = 0;
109 int Heap::external_allocation_limit_ = 0; 109 int Heap::external_allocation_limit_ = 0;
110 110
111 Heap::HeapState Heap::gc_state_ = NOT_IN_GC; 111 Heap::HeapState Heap::gc_state_ = NOT_IN_GC;
112 112
113 int Heap::mc_count_ = 0; 113 int Heap::mc_count_ = 0;
114 int Heap::gc_count_ = 0; 114 int Heap::gc_count_ = 0;
115 115
116 int Heap::always_allocate_scope_depth_ = 0; 116 int Heap::always_allocate_scope_depth_ = 0;
117 int Heap::linear_allocation_scope_depth_ = 0; 117 int Heap::linear_allocation_scope_depth_ = 0;
118
119 int Heap::contexts_disposed_ = 0; 118 int Heap::contexts_disposed_ = 0;
120 bool Heap::context_disposed_use_deprecated_heuristic_ = true;
121 bool Heap::context_disposed_deprecated_pending_ = false;
122 119
123 #ifdef DEBUG 120 #ifdef DEBUG
124 bool Heap::allocation_allowed_ = true; 121 bool Heap::allocation_allowed_ = true;
125 122
126 int Heap::allocation_timeout_ = 0; 123 int Heap::allocation_timeout_ = 0;
127 bool Heap::disallow_allocation_failure_ = false; 124 bool Heap::disallow_allocation_failure_ = false;
128 #endif // DEBUG 125 #endif // DEBUG
129 126
130 127
131 int Heap::Capacity() { 128 int Heap::Capacity() {
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 void Heap::CollectAllGarbage(bool force_compaction) { 364 void Heap::CollectAllGarbage(bool force_compaction) {
368 // Since we are ignoring the return value, the exact choice of space does 365 // Since we are ignoring the return value, the exact choice of space does
369 // not matter, so long as we do not specify NEW_SPACE, which would not 366 // not matter, so long as we do not specify NEW_SPACE, which would not
370 // cause a full GC. 367 // cause a full GC.
371 MarkCompactCollector::SetForceCompaction(force_compaction); 368 MarkCompactCollector::SetForceCompaction(force_compaction);
372 CollectGarbage(0, OLD_POINTER_SPACE); 369 CollectGarbage(0, OLD_POINTER_SPACE);
373 MarkCompactCollector::SetForceCompaction(false); 370 MarkCompactCollector::SetForceCompaction(false);
374 } 371 }
375 372
376 373
377 void Heap::CollectAllGarbageIfContextDisposedDeprecated() {
378 if (!context_disposed_use_deprecated_heuristic_) return;
379 // If the garbage collector interface is exposed through the global
380 // gc() function, we avoid being clever about forcing GCs when
381 // contexts are disposed and leave it to the embedder to make
382 // informed decisions about when to force a collection.
383 if (!FLAG_expose_gc && context_disposed_deprecated_pending_) {
384 HistogramTimerScope scope(&Counters::gc_context);
385 CollectAllGarbage(false);
386 }
387 context_disposed_deprecated_pending_ = false;
388 }
389
390
391 void Heap::NotifyContextDisposed() { 374 void Heap::NotifyContextDisposed() {
392 context_disposed_use_deprecated_heuristic_ = false;
393 contexts_disposed_++; 375 contexts_disposed_++;
394 } 376 }
395 377
396 378
397 void Heap::NotifyContextDisposedDeprecated() {
398 if (!context_disposed_use_deprecated_heuristic_) return;
399 context_disposed_deprecated_pending_ = true;
400 }
401
402
403 bool Heap::CollectGarbage(int requested_size, AllocationSpace space) { 379 bool Heap::CollectGarbage(int requested_size, AllocationSpace space) {
404 // The VM is in the GC state until exiting this function. 380 // The VM is in the GC state until exiting this function.
405 VMState state(GC); 381 VMState state(GC);
406 382
407 #ifdef DEBUG 383 #ifdef DEBUG
408 // Reset the allocation timeout to the GC interval, but make sure to 384 // Reset the allocation timeout to the GC interval, but make sure to
409 // allow at least a few allocations after a collection. The reason 385 // allow at least a few allocations after a collection. The reason
410 // for this is that we have a lot of allocation sequences and we 386 // for this is that we have a lot of allocation sequences and we
411 // assume that a garbage collection will allow the subsequent 387 // assume that a garbage collection will allow the subsequent
412 // allocation attempts to go through. 388 // allocation attempts to go through.
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 613
638 LOG(ResourceEvent("markcompact", "end")); 614 LOG(ResourceEvent("markcompact", "end"));
639 615
640 gc_state_ = NOT_IN_GC; 616 gc_state_ = NOT_IN_GC;
641 617
642 Shrink(); 618 Shrink();
643 619
644 Counters::objs_since_last_full.Set(0); 620 Counters::objs_since_last_full.Set(0);
645 621
646 contexts_disposed_ = 0; 622 contexts_disposed_ = 0;
647 context_disposed_deprecated_pending_ = false;
648 } 623 }
649 624
650 625
651 void Heap::MarkCompactPrologue(bool is_compacting) { 626 void Heap::MarkCompactPrologue(bool is_compacting) {
652 // At any old GC clear the keyed lookup cache to enable collection of unused 627 // At any old GC clear the keyed lookup cache to enable collection of unused
653 // maps. 628 // maps.
654 KeyedLookupCache::Clear(); 629 KeyedLookupCache::Clear();
655 ContextSlotCache::Clear(); 630 ContextSlotCache::Clear();
656 DescriptorLookupCache::Clear(); 631 DescriptorLookupCache::Clear();
657 632
(...skipping 3592 matching lines...) Expand 10 before | Expand all | Expand 10 after
4250 void ExternalStringTable::TearDown() { 4225 void ExternalStringTable::TearDown() {
4251 new_space_strings_.Free(); 4226 new_space_strings_.Free();
4252 old_space_strings_.Free(); 4227 old_space_strings_.Free();
4253 } 4228 }
4254 4229
4255 4230
4256 List<Object*> ExternalStringTable::new_space_strings_; 4231 List<Object*> ExternalStringTable::new_space_strings_;
4257 List<Object*> ExternalStringTable::old_space_strings_; 4232 List<Object*> ExternalStringTable::old_space_strings_;
4258 4233
4259 } } // namespace v8::internal 4234 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698