| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 producer_pos_->enqueue_pos = buffer_; | 67 producer_pos_->enqueue_pos = buffer_; |
| 68 | 68 |
| 69 consumer_pos_ = reinterpret_cast<ConsumerPosition*>( | 69 consumer_pos_ = reinterpret_cast<ConsumerPosition*>( |
| 70 reinterpret_cast<byte*>(producer_pos_) + kProcessorCacheLineSize); | 70 reinterpret_cast<byte*>(producer_pos_) + kProcessorCacheLineSize); |
| 71 ASSERT(reinterpret_cast<byte*>(consumer_pos_ + 1) <= | 71 ASSERT(reinterpret_cast<byte*>(consumer_pos_ + 1) <= |
| 72 positions_ + positions_size); | 72 positions_ + positions_size); |
| 73 consumer_pos_->dequeue_chunk_pos = buffer_; | 73 consumer_pos_->dequeue_chunk_pos = buffer_; |
| 74 // The distance ensures that producer and consumer never step on | 74 // The distance ensures that producer and consumer never step on |
| 75 // each other's chunks and helps eviction of produced data from | 75 // each other's chunks and helps eviction of produced data from |
| 76 // the CPU cache (having that chunk size is bigger than the cache.) | 76 // the CPU cache (having that chunk size is bigger than the cache.) |
| 77 const int producer_consumer_distance = (2 * chunk_size_); | 77 const size_t producer_consumer_distance = (2 * chunk_size_); |
| 78 consumer_pos_->dequeue_chunk_poll_pos = buffer_ + producer_consumer_distance; | 78 consumer_pos_->dequeue_chunk_poll_pos = buffer_ + producer_consumer_distance; |
| 79 consumer_pos_->dequeue_pos = NULL; | 79 consumer_pos_->dequeue_pos = NULL; |
| 80 } | 80 } |
| 81 | 81 |
| 82 | 82 |
| 83 SamplingCircularQueue::~SamplingCircularQueue() { | 83 SamplingCircularQueue::~SamplingCircularQueue() { |
| 84 DeleteArray(positions_); | 84 DeleteArray(positions_); |
| 85 DeleteArray(buffer_); | 85 DeleteArray(buffer_); |
| 86 } | 86 } |
| 87 | 87 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 116 } | 116 } |
| 117 | 117 |
| 118 | 118 |
| 119 void SamplingCircularQueue::FlushResidualRecords() { | 119 void SamplingCircularQueue::FlushResidualRecords() { |
| 120 // Eliminate producer / consumer distance. | 120 // Eliminate producer / consumer distance. |
| 121 consumer_pos_->dequeue_chunk_poll_pos = consumer_pos_->dequeue_chunk_pos; | 121 consumer_pos_->dequeue_chunk_poll_pos = consumer_pos_->dequeue_chunk_pos; |
| 122 } | 122 } |
| 123 | 123 |
| 124 | 124 |
| 125 } } // namespace v8::internal | 125 } } // namespace v8::internal |
| OLD | NEW |