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

Side by Side Diff: src/heap.cc

Issue 660448: Merge r4003 to trunk forming V8 version 2.1.2.5. (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/version.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
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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 602
627 LOG(ResourceEvent("markcompact", "end")); 603 LOG(ResourceEvent("markcompact", "end"));
628 604
629 gc_state_ = NOT_IN_GC; 605 gc_state_ = NOT_IN_GC;
630 606
631 Shrink(); 607 Shrink();
632 608
633 Counters::objs_since_last_full.Set(0); 609 Counters::objs_since_last_full.Set(0);
634 610
635 contexts_disposed_ = 0; 611 contexts_disposed_ = 0;
636 context_disposed_deprecated_pending_ = false;
637 } 612 }
638 613
639 614
640 void Heap::MarkCompactPrologue(bool is_compacting) { 615 void Heap::MarkCompactPrologue(bool is_compacting) {
641 // At any old GC clear the keyed lookup cache to enable collection of unused 616 // At any old GC clear the keyed lookup cache to enable collection of unused
642 // maps. 617 // maps.
643 KeyedLookupCache::Clear(); 618 KeyedLookupCache::Clear();
644 ContextSlotCache::Clear(); 619 ContextSlotCache::Clear();
645 DescriptorLookupCache::Clear(); 620 DescriptorLookupCache::Clear();
646 621
(...skipping 3592 matching lines...) Expand 10 before | Expand all | Expand 10 after
4239 void ExternalStringTable::TearDown() { 4214 void ExternalStringTable::TearDown() {
4240 new_space_strings_.Free(); 4215 new_space_strings_.Free();
4241 old_space_strings_.Free(); 4216 old_space_strings_.Free();
4242 } 4217 }
4243 4218
4244 4219
4245 List<Object*> ExternalStringTable::new_space_strings_; 4220 List<Object*> ExternalStringTable::new_space_strings_;
4246 List<Object*> ExternalStringTable::old_space_strings_; 4221 List<Object*> ExternalStringTable::old_space_strings_;
4247 4222
4248 } } // namespace v8::internal 4223 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698