OLD | NEW |
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 23 matching lines...) Expand all Loading... |
34 #include "v8conversions.h" | 34 #include "v8conversions.h" |
35 | 35 |
36 namespace v8 { | 36 namespace v8 { |
37 namespace internal { | 37 namespace internal { |
38 | 38 |
39 | 39 |
40 IncrementalMarking::IncrementalMarking(Heap* heap) | 40 IncrementalMarking::IncrementalMarking(Heap* heap) |
41 : heap_(heap), | 41 : heap_(heap), |
42 state_(STOPPED), | 42 state_(STOPPED), |
43 marking_deque_memory_(NULL), | 43 marking_deque_memory_(NULL), |
| 44 marking_deque_memory_committed_(false), |
44 steps_count_(0), | 45 steps_count_(0), |
45 steps_took_(0), | 46 steps_took_(0), |
46 longest_step_(0.0), | 47 longest_step_(0.0), |
47 old_generation_space_available_at_start_of_incremental_(0), | 48 old_generation_space_available_at_start_of_incremental_(0), |
48 old_generation_space_used_at_start_of_incremental_(0), | 49 old_generation_space_used_at_start_of_incremental_(0), |
49 steps_count_since_last_gc_(0), | 50 steps_count_since_last_gc_(0), |
50 steps_took_since_last_gc_(0), | 51 steps_took_since_last_gc_(0), |
51 should_hurry_(false), | 52 should_hurry_(false), |
52 allocation_marking_factor_(0), | 53 allocation_marking_factor_(0), |
53 allocated_(0) { | 54 allocated_(0) { |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 } | 364 } |
364 } | 365 } |
365 } | 366 } |
366 } | 367 } |
367 } | 368 } |
368 | 369 |
369 | 370 |
370 void IncrementalMarking::EnsureMarkingDequeIsCommitted() { | 371 void IncrementalMarking::EnsureMarkingDequeIsCommitted() { |
371 if (marking_deque_memory_ == NULL) { | 372 if (marking_deque_memory_ == NULL) { |
372 marking_deque_memory_ = new VirtualMemory(4 * MB); | 373 marking_deque_memory_ = new VirtualMemory(4 * MB); |
373 marking_deque_memory_->Commit( | 374 } |
| 375 if (!marking_deque_memory_committed_) { |
| 376 bool success = marking_deque_memory_->Commit( |
374 reinterpret_cast<Address>(marking_deque_memory_->address()), | 377 reinterpret_cast<Address>(marking_deque_memory_->address()), |
375 marking_deque_memory_->size(), | 378 marking_deque_memory_->size(), |
376 false); // Not executable. | 379 false); // Not executable. |
| 380 CHECK(success); |
| 381 marking_deque_memory_committed_ = true; |
377 } | 382 } |
378 } | 383 } |
379 | 384 |
| 385 void IncrementalMarking::UncommitMarkingDeque() { |
| 386 ASSERT(state_ == STOPPED); |
| 387 if (marking_deque_memory_committed_) { |
| 388 bool success = marking_deque_memory_->Uncommit( |
| 389 reinterpret_cast<Address>(marking_deque_memory_->address()), |
| 390 marking_deque_memory_->size()); |
| 391 CHECK(success); |
| 392 marking_deque_memory_committed_ = false; |
| 393 } |
| 394 } |
| 395 |
380 | 396 |
381 void IncrementalMarking::Start() { | 397 void IncrementalMarking::Start() { |
382 if (FLAG_trace_incremental_marking) { | 398 if (FLAG_trace_incremental_marking) { |
383 PrintF("[IncrementalMarking] Start\n"); | 399 PrintF("[IncrementalMarking] Start\n"); |
384 } | 400 } |
385 ASSERT(FLAG_incremental_marking); | 401 ASSERT(FLAG_incremental_marking); |
386 ASSERT(state_ == STOPPED); | 402 ASSERT(state_ == STOPPED); |
387 | 403 |
388 ResetStepCounters(); | 404 ResetStepCounters(); |
389 | 405 |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 bytes_rescanned_ = 0; | 810 bytes_rescanned_ = 0; |
795 allocation_marking_factor_ = kInitialAllocationMarkingFactor; | 811 allocation_marking_factor_ = kInitialAllocationMarkingFactor; |
796 } | 812 } |
797 | 813 |
798 | 814 |
799 int64_t IncrementalMarking::SpaceLeftInOldSpace() { | 815 int64_t IncrementalMarking::SpaceLeftInOldSpace() { |
800 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSize(); | 816 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSize(); |
801 } | 817 } |
802 | 818 |
803 } } // namespace v8::internal | 819 } } // namespace v8::internal |
OLD | NEW |