| 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 24 matching lines...) Expand all Loading... |
| 35 namespace v8 { | 35 namespace v8 { |
| 36 namespace internal { | 36 namespace internal { |
| 37 | 37 |
| 38 | 38 |
| 39 IncrementalMarking::IncrementalMarking(Heap* heap) | 39 IncrementalMarking::IncrementalMarking(Heap* heap) |
| 40 : heap_(heap), | 40 : heap_(heap), |
| 41 state_(STOPPED), | 41 state_(STOPPED), |
| 42 marking_deque_memory_(NULL), | 42 marking_deque_memory_(NULL), |
| 43 steps_count_(0), | 43 steps_count_(0), |
| 44 steps_took_(0), | 44 steps_took_(0), |
| 45 longest_step_(0.0), |
| 45 steps_count_since_last_gc_(0), | 46 steps_count_since_last_gc_(0), |
| 46 steps_took_since_last_gc_(0), | 47 steps_took_since_last_gc_(0), |
| 47 should_hurry_(false), | 48 should_hurry_(false), |
| 48 allocation_marking_factor_(0), | 49 allocation_marking_factor_(0), |
| 49 allocated_(0) { | 50 allocated_(0) { |
| 50 } | 51 } |
| 51 | 52 |
| 52 | 53 |
| 53 void IncrementalMarking::TearDown() { | 54 void IncrementalMarking::TearDown() { |
| 54 delete marking_deque_memory_; | 55 delete marking_deque_memory_; |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 array[new_top] = obj; | 460 array[new_top] = obj; |
| 460 new_top = ((new_top + 1) & mask); | 461 new_top = ((new_top + 1) & mask); |
| 461 ASSERT(new_top != marking_deque_.bottom()); | 462 ASSERT(new_top != marking_deque_.bottom()); |
| 462 ASSERT(Marking::IsGrey(Marking::MarkBitFrom(obj))); | 463 ASSERT(Marking::IsGrey(Marking::MarkBitFrom(obj))); |
| 463 } | 464 } |
| 464 } | 465 } |
| 465 marking_deque_.set_top(new_top); | 466 marking_deque_.set_top(new_top); |
| 466 | 467 |
| 467 steps_took_since_last_gc_ = 0; | 468 steps_took_since_last_gc_ = 0; |
| 468 steps_count_since_last_gc_ = 0; | 469 steps_count_since_last_gc_ = 0; |
| 470 longest_step_ = 0.0; |
| 469 } | 471 } |
| 470 | 472 |
| 471 | 473 |
| 472 void IncrementalMarking::Hurry() { | 474 void IncrementalMarking::Hurry() { |
| 473 if (state() == MARKING) { | 475 if (state() == MARKING) { |
| 474 double start = 0.0; | 476 double start = 0.0; |
| 475 if (FLAG_trace_incremental_marking) { | 477 if (FLAG_trace_incremental_marking) { |
| 476 PrintF("[IncrementalMarking] Hurry\n"); | 478 PrintF("[IncrementalMarking] Hurry\n"); |
| 477 start = OS::TimeCurrentMillis(); | 479 start = OS::TimeCurrentMillis(); |
| 478 } | 480 } |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 allocation_marking_factor_ = | 617 allocation_marking_factor_ = |
| 616 static_cast<int>(allocation_marking_factor_ * 1.3); | 618 static_cast<int>(allocation_marking_factor_ * 1.3); |
| 617 if (FLAG_trace_gc) { | 619 if (FLAG_trace_gc) { |
| 618 PrintF("Marking speed increased to %d\n", allocation_marking_factor_); | 620 PrintF("Marking speed increased to %d\n", allocation_marking_factor_); |
| 619 } | 621 } |
| 620 } | 622 } |
| 621 | 623 |
| 622 if (FLAG_trace_incremental_marking || FLAG_trace_gc) { | 624 if (FLAG_trace_incremental_marking || FLAG_trace_gc) { |
| 623 double end = OS::TimeCurrentMillis(); | 625 double end = OS::TimeCurrentMillis(); |
| 624 double delta = (end - start); | 626 double delta = (end - start); |
| 627 longest_step_ = Max(longest_step_, delta); |
| 625 steps_took_ += delta; | 628 steps_took_ += delta; |
| 626 steps_took_since_last_gc_ += delta; | 629 steps_took_since_last_gc_ += delta; |
| 627 } | 630 } |
| 628 } | 631 } |
| 629 | 632 |
| 630 | 633 |
| 631 } } // namespace v8::internal | 634 } } // namespace v8::internal |
| OLD | NEW |