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

Side by Side Diff: src/heap.cc

Issue 8084002: Start incremental marking on idle notification. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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/incremental-marking.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 previous_survival_rate_trend_(Heap::STABLE), 133 previous_survival_rate_trend_(Heap::STABLE),
134 survival_rate_trend_(Heap::STABLE), 134 survival_rate_trend_(Heap::STABLE),
135 max_gc_pause_(0), 135 max_gc_pause_(0),
136 max_alive_after_gc_(0), 136 max_alive_after_gc_(0),
137 min_in_mutator_(kMaxInt), 137 min_in_mutator_(kMaxInt),
138 alive_after_last_gc_(0), 138 alive_after_last_gc_(0),
139 last_gc_end_timestamp_(0.0), 139 last_gc_end_timestamp_(0.0),
140 store_buffer_(this), 140 store_buffer_(this),
141 marking_(this), 141 marking_(this),
142 incremental_marking_(this), 142 incremental_marking_(this),
143 idle_work_(IDLE_INCREMENTAL_MARKING),
143 number_idle_notifications_(0), 144 number_idle_notifications_(0),
144 last_idle_notification_gc_count_(0), 145 last_idle_notification_gc_count_(0),
145 last_idle_notification_gc_count_init_(false), 146 last_idle_notification_gc_count_init_(false),
146 configured_(false), 147 configured_(false),
147 chunks_queued_for_free_(NULL) { 148 chunks_queued_for_free_(NULL) {
148 // Allow build-time customization of the max semispace size. Building 149 // Allow build-time customization of the max semispace size. Building
149 // V8 with snapshots and a non-default max semispace size is much 150 // V8 with snapshots and a non-default max semispace size is much
150 // easier if you can define it as part of the build environment. 151 // easier if you can define it as part of the build environment.
151 #if defined(V8_MAX_SEMISPACE_SIZE) 152 #if defined(V8_MAX_SEMISPACE_SIZE)
152 max_semispace_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE; 153 max_semispace_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE;
(...skipping 4355 matching lines...) Expand 10 before | Expand all | Expand 10 after
4508 void Heap::EnsureHeapIsIterable() { 4509 void Heap::EnsureHeapIsIterable() {
4509 ASSERT(IsAllocationAllowed()); 4510 ASSERT(IsAllocationAllowed());
4510 if (!IsHeapIterable()) { 4511 if (!IsHeapIterable()) {
4511 CollectAllGarbage(kMakeHeapIterableMask); 4512 CollectAllGarbage(kMakeHeapIterableMask);
4512 } 4513 }
4513 ASSERT(IsHeapIterable()); 4514 ASSERT(IsHeapIterable());
4514 } 4515 }
4515 4516
4516 4517
4517 bool Heap::IdleNotification() { 4518 bool Heap::IdleNotification() {
4519 switch (idle_work_) {
4520 case IDLE_INCREMENTAL_MARKING:
4521 if (IdleIncrementalMarking()) {
4522 idle_work_ = IDLE_GLOBAL_GC;
4523 }
4524 break;
4525 case IDLE_GLOBAL_GC:
4526 if (IdleGlobalGC()) {
4527 idle_work_ = IDLE_INCREMENTAL_MARKING;
4528 return true;
4529 }
4530 break;
4531 default:
4532 UNREACHABLE();
4533 }
4534 return false;
4535 }
4536
4537 bool Heap::IdleIncrementalMarking() {
4538 if (incremental_marking()->IsStopped()) {
4539 if (!incremental_marking()->WorthActivating()) {
4540 return true;
4541 }
4542 incremental_marking()->Start();
4543 }
4544 incremental_marking()->Step(IncrementalMarking::kStepFakeAllocatedBytes);
4545 return incremental_marking()->IsComplete();
Vyacheslav Egorov (Chromium) 2011/10/12 07:41:00 when it's complete it makes sense to do a finishin
4546 }
4547
4548 bool Heap::IdleGlobalGC() {
4518 static const int kIdlesBeforeScavenge = 4; 4549 static const int kIdlesBeforeScavenge = 4;
4519 static const int kIdlesBeforeMarkSweep = 7; 4550 static const int kIdlesBeforeMarkSweep = 7;
4520 static const int kIdlesBeforeMarkCompact = 8; 4551 static const int kIdlesBeforeMarkCompact = 8;
4521 static const int kMaxIdleCount = kIdlesBeforeMarkCompact + 1; 4552 static const int kMaxIdleCount = kIdlesBeforeMarkCompact + 1;
4522 static const unsigned int kGCsBetweenCleanup = 4; 4553 static const unsigned int kGCsBetweenCleanup = 4;
4523 4554
4524 if (!last_idle_notification_gc_count_init_) { 4555 if (!last_idle_notification_gc_count_init_) {
4525 last_idle_notification_gc_count_ = gc_count_; 4556 last_idle_notification_gc_count_ = gc_count_;
4526 last_idle_notification_gc_count_init_ = true; 4557 last_idle_notification_gc_count_init_ = true;
4527 } 4558 }
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after
6470 isolate_->heap()->store_buffer()->Compact(); 6501 isolate_->heap()->store_buffer()->Compact();
6471 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); 6502 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED);
6472 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { 6503 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) {
6473 next = chunk->next_chunk(); 6504 next = chunk->next_chunk();
6474 isolate_->memory_allocator()->Free(chunk); 6505 isolate_->memory_allocator()->Free(chunk);
6475 } 6506 }
6476 chunks_queued_for_free_ = NULL; 6507 chunks_queued_for_free_ = NULL;
6477 } 6508 }
6478 6509
6479 } } // namespace v8::internal 6510 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/incremental-marking.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698