OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HEAP_SPACES_H_ | 5 #ifndef V8_HEAP_SPACES_H_ |
6 #define V8_HEAP_SPACES_H_ | 6 #define V8_HEAP_SPACES_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/atomic-utils.h" | 9 #include "src/atomic-utils.h" |
10 #include "src/base/atomicops.h" | 10 #include "src/base/atomicops.h" |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 | 588 |
589 // Manage live byte count (count of bytes known to be live, | 589 // Manage live byte count (count of bytes known to be live, |
590 // because they are marked black). | 590 // because they are marked black). |
591 void ResetLiveBytes() { | 591 void ResetLiveBytes() { |
592 if (FLAG_gc_verbose) { | 592 if (FLAG_gc_verbose) { |
593 PrintF("ResetLiveBytes:%p:%x->0\n", static_cast<void*>(this), | 593 PrintF("ResetLiveBytes:%p:%x->0\n", static_cast<void*>(this), |
594 live_byte_count_); | 594 live_byte_count_); |
595 } | 595 } |
596 live_byte_count_ = 0; | 596 live_byte_count_ = 0; |
597 } | 597 } |
| 598 |
598 void IncrementLiveBytes(int by) { | 599 void IncrementLiveBytes(int by) { |
599 if (FLAG_gc_verbose) { | 600 if (FLAG_gc_verbose) { |
600 printf("UpdateLiveBytes:%p:%x%c=%x->%x\n", static_cast<void*>(this), | 601 printf("UpdateLiveBytes:%p:%x%c=%x->%x\n", static_cast<void*>(this), |
601 live_byte_count_, ((by < 0) ? '-' : '+'), ((by < 0) ? -by : by), | 602 live_byte_count_, ((by < 0) ? '-' : '+'), ((by < 0) ? -by : by), |
602 live_byte_count_ + by); | 603 live_byte_count_ + by); |
603 } | 604 } |
604 live_byte_count_ += by; | 605 live_byte_count_ += by; |
| 606 DCHECK_GE(live_byte_count_, 0); |
605 DCHECK_LE(static_cast<unsigned>(live_byte_count_), size_); | 607 DCHECK_LE(static_cast<unsigned>(live_byte_count_), size_); |
606 } | 608 } |
| 609 |
607 int LiveBytes() { | 610 int LiveBytes() { |
608 DCHECK(static_cast<unsigned>(live_byte_count_) <= size_); | 611 DCHECK_LE(static_cast<unsigned>(live_byte_count_), size_); |
609 return live_byte_count_; | 612 return live_byte_count_; |
610 } | 613 } |
611 | 614 |
612 int write_barrier_counter() { | 615 int write_barrier_counter() { |
613 return static_cast<int>(write_barrier_counter_); | 616 return static_cast<int>(write_barrier_counter_); |
614 } | 617 } |
615 | 618 |
616 void set_write_barrier_counter(int counter) { | 619 void set_write_barrier_counter(int counter) { |
617 write_barrier_counter_ = counter; | 620 write_barrier_counter_ = counter; |
618 } | 621 } |
(...skipping 2601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3220 count = 0; | 3223 count = 0; |
3221 } | 3224 } |
3222 // Must be small, since an iteration is used for lookup. | 3225 // Must be small, since an iteration is used for lookup. |
3223 static const int kMaxComments = 64; | 3226 static const int kMaxComments = 64; |
3224 }; | 3227 }; |
3225 #endif | 3228 #endif |
3226 } // namespace internal | 3229 } // namespace internal |
3227 } // namespace v8 | 3230 } // namespace v8 |
3228 | 3231 |
3229 #endif // V8_HEAP_SPACES_H_ | 3232 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |