Cleanup extra initialization of TickSample fields.
R=vitalyr@chromium.org BUG=1293 Review URL: http://codereview.chromium.org/7203005 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8368 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
8e7405800e
commit
650df48c55
@ -32,6 +32,7 @@
|
||||
|
||||
#ifdef ENABLE_LOGGING_AND_PROFILING
|
||||
|
||||
#include <new>
|
||||
#include "circular-queue-inl.h"
|
||||
#include "profile-generator-inl.h"
|
||||
#include "unbound-queue-inl.h"
|
||||
@ -62,24 +63,10 @@ void SharedFunctionInfoMoveEventRecord::UpdateCodeMap(CodeMap* code_map) {
|
||||
}
|
||||
|
||||
|
||||
TickSampleEventRecord* TickSampleEventRecord::init(void* value) {
|
||||
TickSampleEventRecord* result =
|
||||
reinterpret_cast<TickSampleEventRecord*>(value);
|
||||
result->filler = 1;
|
||||
ASSERT(result->filler != SamplingCircularQueue::kClear);
|
||||
// Init the required fields only.
|
||||
result->sample.pc = NULL;
|
||||
result->sample.frames_count = 0;
|
||||
result->sample.has_external_callback = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
TickSample* ProfilerEventsProcessor::TickSampleEvent() {
|
||||
generator_->Tick();
|
||||
TickSampleEventRecord* evt =
|
||||
TickSampleEventRecord::init(ticks_buffer_.Enqueue());
|
||||
evt->order = enqueue_order_; // No increment!
|
||||
new(ticks_buffer_.Enqueue()) TickSampleEventRecord(enqueue_order_);
|
||||
return &evt->sample;
|
||||
}
|
||||
|
||||
|
@ -181,20 +181,16 @@ void ProfilerEventsProcessor::RegExpCodeCreateEvent(
|
||||
|
||||
|
||||
void ProfilerEventsProcessor::AddCurrentStack() {
|
||||
TickSampleEventRecord record;
|
||||
TickSampleEventRecord record(enqueue_order_);
|
||||
TickSample* sample = &record.sample;
|
||||
Isolate* isolate = Isolate::Current();
|
||||
sample->state = isolate->current_vm_state();
|
||||
sample->pc = reinterpret_cast<Address>(sample); // Not NULL.
|
||||
sample->tos = NULL;
|
||||
sample->has_external_callback = false;
|
||||
sample->frames_count = 0;
|
||||
for (StackTraceFrameIterator it(isolate);
|
||||
!it.done() && sample->frames_count < TickSample::kMaxFramesCount;
|
||||
it.Advance()) {
|
||||
sample->stack[sample->frames_count++] = it.frame()->pc();
|
||||
}
|
||||
record.order = enqueue_order_;
|
||||
ticks_from_vm_buffer_.Enqueue(record);
|
||||
}
|
||||
|
||||
|
@ -106,10 +106,14 @@ class SharedFunctionInfoMoveEventRecord : public CodeEventRecord {
|
||||
};
|
||||
|
||||
|
||||
class TickSampleEventRecord BASE_EMBEDDED {
|
||||
class TickSampleEventRecord {
|
||||
public:
|
||||
TickSampleEventRecord()
|
||||
: filler(1) {
|
||||
// The parameterless constructor is used when we dequeue data from
|
||||
// the ticks buffer.
|
||||
TickSampleEventRecord() { }
|
||||
explicit TickSampleEventRecord(unsigned order)
|
||||
: filler(1),
|
||||
order(order) {
|
||||
ASSERT(filler != SamplingCircularQueue::kClear);
|
||||
}
|
||||
|
||||
@ -125,8 +129,6 @@ class TickSampleEventRecord BASE_EMBEDDED {
|
||||
static TickSampleEventRecord* cast(void* value) {
|
||||
return reinterpret_cast<TickSampleEventRecord*>(value);
|
||||
}
|
||||
|
||||
INLINE(static TickSampleEventRecord* init(void* value));
|
||||
};
|
||||
|
||||
|
||||
|
@ -149,10 +149,6 @@ class Profiler: public Thread {
|
||||
void StackTracer::Trace(Isolate* isolate, TickSample* sample) {
|
||||
ASSERT(isolate->IsInitialized());
|
||||
|
||||
sample->tos = NULL;
|
||||
sample->frames_count = 0;
|
||||
sample->has_external_callback = false;
|
||||
|
||||
// Avoid collecting traces while doing GC.
|
||||
if (sample->state == GC) return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user