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

Side by Side Diff: src/heap.cc

Issue 795003: Version 2.1.2.7... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
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') | src/ia32/codegen-ia32.cc » ('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 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
118 int Heap::contexts_disposed_ = 0; 119 int Heap::contexts_disposed_ = 0;
120 bool Heap::context_disposed_use_deprecated_heuristic_ = true;
121 bool Heap::context_disposed_deprecated_pending_ = false;
119 122
120 #ifdef DEBUG 123 #ifdef DEBUG
121 bool Heap::allocation_allowed_ = true; 124 bool Heap::allocation_allowed_ = true;
122 125
123 int Heap::allocation_timeout_ = 0; 126 int Heap::allocation_timeout_ = 0;
124 bool Heap::disallow_allocation_failure_ = false; 127 bool Heap::disallow_allocation_failure_ = false;
125 #endif // DEBUG 128 #endif // DEBUG
126 129
127 130
128 int Heap::Capacity() { 131 int Heap::Capacity() {
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 void Heap::CollectAllGarbage(bool force_compaction) { 367 void Heap::CollectAllGarbage(bool force_compaction) {
365 // Since we are ignoring the return value, the exact choice of space does 368 // Since we are ignoring the return value, the exact choice of space does
366 // not matter, so long as we do not specify NEW_SPACE, which would not 369 // not matter, so long as we do not specify NEW_SPACE, which would not
367 // cause a full GC. 370 // cause a full GC.
368 MarkCompactCollector::SetForceCompaction(force_compaction); 371 MarkCompactCollector::SetForceCompaction(force_compaction);
369 CollectGarbage(0, OLD_POINTER_SPACE); 372 CollectGarbage(0, OLD_POINTER_SPACE);
370 MarkCompactCollector::SetForceCompaction(false); 373 MarkCompactCollector::SetForceCompaction(false);
371 } 374 }
372 375
373 376
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
374 void Heap::NotifyContextDisposed() { 391 void Heap::NotifyContextDisposed() {
392 context_disposed_use_deprecated_heuristic_ = false;
375 contexts_disposed_++; 393 contexts_disposed_++;
376 } 394 }
377 395
378 396
397 void Heap::NotifyContextDisposedDeprecated() {
398 if (!context_disposed_use_deprecated_heuristic_) return;
399 context_disposed_deprecated_pending_ = true;
400 }
401
402
379 bool Heap::CollectGarbage(int requested_size, AllocationSpace space) { 403 bool Heap::CollectGarbage(int requested_size, AllocationSpace space) {
380 // The VM is in the GC state until exiting this function. 404 // The VM is in the GC state until exiting this function.
381 VMState state(GC); 405 VMState state(GC);
382 406
383 #ifdef DEBUG 407 #ifdef DEBUG
384 // Reset the allocation timeout to the GC interval, but make sure to 408 // Reset the allocation timeout to the GC interval, but make sure to
385 // allow at least a few allocations after a collection. The reason 409 // allow at least a few allocations after a collection. The reason
386 // for this is that we have a lot of allocation sequences and we 410 // for this is that we have a lot of allocation sequences and we
387 // assume that a garbage collection will allow the subsequent 411 // assume that a garbage collection will allow the subsequent
388 // allocation attempts to go through. 412 // allocation attempts to go through.
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 626
603 LOG(ResourceEvent("markcompact", "end")); 627 LOG(ResourceEvent("markcompact", "end"));
604 628
605 gc_state_ = NOT_IN_GC; 629 gc_state_ = NOT_IN_GC;
606 630
607 Shrink(); 631 Shrink();
608 632
609 Counters::objs_since_last_full.Set(0); 633 Counters::objs_since_last_full.Set(0);
610 634
611 contexts_disposed_ = 0; 635 contexts_disposed_ = 0;
636 context_disposed_deprecated_pending_ = false;
612 } 637 }
613 638
614 639
615 void Heap::MarkCompactPrologue(bool is_compacting) { 640 void Heap::MarkCompactPrologue(bool is_compacting) {
616 // At any old GC clear the keyed lookup cache to enable collection of unused 641 // At any old GC clear the keyed lookup cache to enable collection of unused
617 // maps. 642 // maps.
618 KeyedLookupCache::Clear(); 643 KeyedLookupCache::Clear();
619 ContextSlotCache::Clear(); 644 ContextSlotCache::Clear();
620 DescriptorLookupCache::Clear(); 645 DescriptorLookupCache::Clear();
621 646
(...skipping 3592 matching lines...) Expand 10 before | Expand all | Expand 10 after
4214 void ExternalStringTable::TearDown() { 4239 void ExternalStringTable::TearDown() {
4215 new_space_strings_.Free(); 4240 new_space_strings_.Free();
4216 old_space_strings_.Free(); 4241 old_space_strings_.Free();
4217 } 4242 }
4218 4243
4219 4244
4220 List<Object*> ExternalStringTable::new_space_strings_; 4245 List<Object*> ExternalStringTable::new_space_strings_;
4221 List<Object*> ExternalStringTable::old_space_strings_; 4246 List<Object*> ExternalStringTable::old_space_strings_;
4222 4247
4223 } } // namespace v8::internal 4248 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698