Index: src/cpu-profiler.cc |
diff --git a/src/cpu-profiler.cc b/src/cpu-profiler.cc |
index fcf539f3bdf4b213205053c8e603afaa28157a87..81759f9c9e75440ec55b84063eb6d5cfa9f29386 100644 |
--- a/src/cpu-profiler.cc |
+++ b/src/cpu-profiler.cc |
@@ -53,13 +53,7 @@ ProfilerEventsProcessor::ProfilerEventsProcessor(ProfileGenerator* generator) |
ticks_buffer_(sizeof(TickSampleEventRecord), |
kTickSamplesBufferChunkSize, |
kTickSamplesBufferChunksCount), |
- enqueue_order_(0), |
- known_functions_(new HashMap(AddressesMatch)) { |
-} |
- |
- |
-ProfilerEventsProcessor::~ProfilerEventsProcessor() { |
- delete known_functions_; |
+ enqueue_order_(0) { |
} |
@@ -75,6 +69,7 @@ void ProfilerEventsProcessor::CallbackCreateEvent(Logger::LogEventsAndTags tag, |
rec->start = start; |
rec->entry = generator_->NewCodeEntry(tag, prefix, name); |
rec->size = 1; |
+ rec->sfi_address = NULL; |
events_buffer_.Enqueue(evt_rec); |
} |
@@ -84,7 +79,8 @@ void ProfilerEventsProcessor::CodeCreateEvent(Logger::LogEventsAndTags tag, |
String* resource_name, |
int line_number, |
Address start, |
- unsigned size) { |
+ unsigned size, |
+ Address sfi_address) { |
if (FilterOutCodeCreateEvent(tag)) return; |
CodeEventsContainer evt_rec; |
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
@@ -93,6 +89,7 @@ void ProfilerEventsProcessor::CodeCreateEvent(Logger::LogEventsAndTags tag, |
rec->start = start; |
rec->entry = generator_->NewCodeEntry(tag, name, resource_name, line_number); |
rec->size = size; |
+ rec->sfi_address = sfi_address; |
events_buffer_.Enqueue(evt_rec); |
} |
@@ -109,6 +106,7 @@ void ProfilerEventsProcessor::CodeCreateEvent(Logger::LogEventsAndTags tag, |
rec->start = start; |
rec->entry = generator_->NewCodeEntry(tag, name); |
rec->size = size; |
+ rec->sfi_address = NULL; |
events_buffer_.Enqueue(evt_rec); |
} |
@@ -125,6 +123,7 @@ void ProfilerEventsProcessor::CodeCreateEvent(Logger::LogEventsAndTags tag, |
rec->start = start; |
rec->entry = generator_->NewCodeEntry(tag, args_count); |
rec->size = size; |
+ rec->sfi_address = NULL; |
events_buffer_.Enqueue(evt_rec); |
} |
@@ -150,57 +149,14 @@ void ProfilerEventsProcessor::CodeDeleteEvent(Address from) { |
} |
-void ProfilerEventsProcessor::FunctionCreateEvent(Address alias, |
- Address start, |
- int security_token_id) { |
+void ProfilerEventsProcessor::SFIMoveEvent(Address from, Address to) { |
CodeEventsContainer evt_rec; |
- CodeAliasEventRecord* rec = &evt_rec.CodeAliasEventRecord_; |
- rec->type = CodeEventRecord::CODE_ALIAS; |
+ SFIMoveEventRecord* rec = &evt_rec.SFIMoveEventRecord_; |
+ rec->type = CodeEventRecord::SFI_MOVE; |
rec->order = ++enqueue_order_; |
- rec->start = alias; |
- rec->entry = generator_->NewCodeEntry(security_token_id); |
- rec->code_start = start; |
+ rec->from = from; |
+ rec->to = to; |
events_buffer_.Enqueue(evt_rec); |
- |
- known_functions_->Lookup(alias, AddressHash(alias), true); |
-} |
- |
- |
-void ProfilerEventsProcessor::FunctionMoveEvent(Address from, Address to) { |
- CodeMoveEvent(from, to); |
- |
- if (IsKnownFunction(from)) { |
- known_functions_->Remove(from, AddressHash(from)); |
- known_functions_->Lookup(to, AddressHash(to), true); |
- } |
-} |
- |
- |
-void ProfilerEventsProcessor::FunctionDeleteEvent(Address from) { |
- CodeDeleteEvent(from); |
- |
- known_functions_->Remove(from, AddressHash(from)); |
-} |
- |
- |
-bool ProfilerEventsProcessor::IsKnownFunction(Address start) { |
- HashMap::Entry* entry = |
- known_functions_->Lookup(start, AddressHash(start), false); |
- return entry != NULL; |
-} |
- |
- |
-void ProfilerEventsProcessor::ProcessMovedFunctions() { |
- for (int i = 0; i < moved_functions_.length(); ++i) { |
- JSFunction* function = moved_functions_[i]; |
- CpuProfiler::FunctionCreateEvent(function); |
- } |
- moved_functions_.Clear(); |
-} |
- |
- |
-void ProfilerEventsProcessor::RememberMovedFunction(JSFunction* function) { |
- moved_functions_.Add(function); |
} |
@@ -227,13 +183,12 @@ void ProfilerEventsProcessor::AddCurrentStack() { |
TickSample* sample = &record.sample; |
sample->state = Top::current_vm_state(); |
sample->pc = reinterpret_cast<Address>(sample); // Not NULL. |
+ sample->function = NULL; |
sample->frames_count = 0; |
for (StackTraceFrameIterator it; |
!it.done() && sample->frames_count < TickSample::kMaxFramesCount; |
it.Advance()) { |
- JavaScriptFrame* frame = it.frame(); |
- sample->stack[sample->frames_count++] = |
- reinterpret_cast<Address>(frame->function()); |
+ sample->stack[sample->frames_count++] = it.frame()->pc(); |
} |
record.order = enqueue_order_; |
ticks_from_vm_buffer_.Enqueue(record); |
@@ -393,20 +348,38 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
Heap::empty_string(), |
v8::CpuProfileNode::kNoLineNumberInfo, |
code->address(), |
- code->ExecutableSize()); |
+ code->ExecutableSize(), |
+ NULL); |
} |
void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
- Code* code, String* name, |
- String* source, int line) { |
+ Code* code, |
+ SharedFunctionInfo *shared, |
Vitaly Repeshko
2011/02/22 15:11:19
nit: Move *.
mnaganov (inactive)
2011/02/22 16:18:22
Done.
|
+ String* name) { |
singleton_->processor_->CodeCreateEvent( |
tag, |
name, |
+ Heap::empty_string(), |
+ v8::CpuProfileNode::kNoLineNumberInfo, |
+ code->address(), |
+ code->ExecutableSize(), |
+ shared->address()); |
+} |
+ |
+ |
+void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
+ Code* code, |
+ SharedFunctionInfo *shared, |
Vitaly Repeshko
2011/02/22 15:11:19
Same nit.
mnaganov (inactive)
2011/02/22 16:18:22
Done.
|
+ String* source, int line) { |
+ singleton_->processor_->CodeCreateEvent( |
+ tag, |
+ shared->DebugName(), |
source, |
line, |
code->address(), |
- code->ExecutableSize()); |
+ code->ExecutableSize(), |
+ shared->address()); |
} |
@@ -430,44 +403,8 @@ void CpuProfiler::CodeDeleteEvent(Address from) { |
} |
-void CpuProfiler::FunctionCreateEvent(JSFunction* function) { |
- int security_token_id = TokenEnumerator::kNoSecurityToken; |
- if (function->unchecked_context()->IsContext()) { |
- security_token_id = singleton_->token_enumerator_->GetTokenId( |
- function->context()->global_context()->security_token()); |
- } |
- singleton_->processor_->FunctionCreateEvent( |
- function->address(), |
- function->shared()->code()->address(), |
- security_token_id); |
-} |
- |
- |
-void CpuProfiler::ProcessMovedFunctions() { |
- singleton_->processor_->ProcessMovedFunctions(); |
-} |
- |
- |
-void CpuProfiler::FunctionCreateEventFromMove(JSFunction* function) { |
- // This function is called from GC iterators (during Scavenge, |
- // MC, and MS), so marking bits can be set on objects. That's |
- // why unchecked accessors are used here. |
- |
- // The same function can be reported several times. |
- if (function->unchecked_code() == Builtins::builtin(Builtins::LazyCompile) |
- || singleton_->processor_->IsKnownFunction(function->address())) return; |
- |
- singleton_->processor_->RememberMovedFunction(function); |
-} |
- |
- |
-void CpuProfiler::FunctionMoveEvent(Address from, Address to) { |
- singleton_->processor_->FunctionMoveEvent(from, to); |
-} |
- |
- |
-void CpuProfiler::FunctionDeleteEvent(Address from) { |
- singleton_->processor_->FunctionDeleteEvent(from); |
+void CpuProfiler::SFIMoveEvent(Address from, Address to) { |
+ singleton_->processor_->SFIMoveEvent(from, to); |
} |
@@ -539,7 +476,6 @@ void CpuProfiler::StartProcessorIfNotStarted() { |
FLAG_log_code = saved_log_code_flag; |
} |
Logger::LogCompiledFunctions(); |
- Logger::LogFunctionObjects(); |
Logger::LogAccessorCallbacks(); |
} |
// Enable stack sampling. |