Fix a error in SamplingCircularQueue found using Valgrind memcheck.

Review URL: http://codereview.chromium.org/3251004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5373 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mikhail.naganov@gmail.com 2010-08-30 13:30:54 +00:00
parent 19dc35c13f
commit 18c7882ea2

View File

@ -47,8 +47,9 @@ SamplingCircularQueue::SamplingCircularQueue(int record_size_in_bytes,
producer_consumer_distance_(2 * chunk_size_),
buffer_(NewArray<Cell>(buffer_size_ + 1)) {
ASSERT(buffer_size_in_chunks > 2);
// Only need to keep the first cell of a chunk clean.
for (int i = 0; i < buffer_size_; i += chunk_size_) {
// Clean up the whole buffer to avoid encountering a random kEnd
// while enqueuing.
for (int i = 0; i < buffer_size_; ++i) {
buffer_[i] = kClear;
}
buffer_[buffer_size_] = kEnd;