| Index: src/cpu-profiler.cc
|
| ===================================================================
|
| --- src/cpu-profiler.cc (revision 7180)
|
| +++ src/cpu-profiler.cc (working copy)
|
| @@ -53,16 +53,10 @@
|
| ticks_buffer_(sizeof(TickSampleEventRecord),
|
| kTickSamplesBufferChunkSize,
|
| kTickSamplesBufferChunksCount),
|
| - enqueue_order_(0),
|
| - known_functions_(new HashMap(AddressesMatch)) {
|
| + enqueue_order_(0) {
|
| }
|
|
|
|
|
| -ProfilerEventsProcessor::~ProfilerEventsProcessor() {
|
| - delete known_functions_;
|
| -}
|
| -
|
| -
|
| void ProfilerEventsProcessor::CallbackCreateEvent(Logger::LogEventsAndTags tag,
|
| const char* prefix,
|
| String* name,
|
| @@ -75,6 +69,7 @@
|
| rec->start = start;
|
| rec->entry = generator_->NewCodeEntry(tag, prefix, name);
|
| rec->size = 1;
|
| + rec->shared = NULL;
|
| events_buffer_.Enqueue(evt_rec);
|
| }
|
|
|
| @@ -84,7 +79,8 @@
|
| String* resource_name,
|
| int line_number,
|
| Address start,
|
| - unsigned size) {
|
| + unsigned size,
|
| + Address shared) {
|
| if (FilterOutCodeCreateEvent(tag)) return;
|
| CodeEventsContainer evt_rec;
|
| CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
|
| @@ -93,6 +89,7 @@
|
| rec->start = start;
|
| rec->entry = generator_->NewCodeEntry(tag, name, resource_name, line_number);
|
| rec->size = size;
|
| + rec->shared = shared;
|
| events_buffer_.Enqueue(evt_rec);
|
| }
|
|
|
| @@ -109,6 +106,7 @@
|
| rec->start = start;
|
| rec->entry = generator_->NewCodeEntry(tag, name);
|
| rec->size = size;
|
| + rec->shared = NULL;
|
| events_buffer_.Enqueue(evt_rec);
|
| }
|
|
|
| @@ -125,6 +123,7 @@
|
| rec->start = start;
|
| rec->entry = generator_->NewCodeEntry(tag, args_count);
|
| rec->size = size;
|
| + rec->shared = NULL;
|
| events_buffer_.Enqueue(evt_rec);
|
| }
|
|
|
| @@ -150,60 +149,19 @@
|
| }
|
|
|
|
|
| -void ProfilerEventsProcessor::FunctionCreateEvent(Address alias,
|
| - Address start,
|
| - int security_token_id) {
|
| +void ProfilerEventsProcessor::SharedFunctionInfoMoveEvent(Address from,
|
| + Address to) {
|
| CodeEventsContainer evt_rec;
|
| - CodeAliasEventRecord* rec = &evt_rec.CodeAliasEventRecord_;
|
| - rec->type = CodeEventRecord::CODE_ALIAS;
|
| + SharedFunctionInfoMoveEventRecord* rec =
|
| + &evt_rec.SharedFunctionInfoMoveEventRecord_;
|
| + rec->type = CodeEventRecord::SHARED_FUNC_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);
|
| -}
|
| -
|
| -
|
| void ProfilerEventsProcessor::RegExpCodeCreateEvent(
|
| Logger::LogEventsAndTags tag,
|
| const char* prefix,
|
| @@ -227,13 +185,12 @@
|
| TickSample* sample = &record.sample;
|
| sample->state = Top::current_vm_state();
|
| sample->pc = reinterpret_cast<Address>(sample); // Not NULL.
|
| + sample->tos = 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 +350,38 @@
|
| 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,
|
| + 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,
|
| + String* source, int line) {
|
| + singleton_->processor_->CodeCreateEvent(
|
| + tag,
|
| + shared->DebugName(),
|
| source,
|
| line,
|
| code->address(),
|
| - code->ExecutableSize());
|
| + code->ExecutableSize(),
|
| + shared->address());
|
| }
|
|
|
|
|
| @@ -430,47 +405,11 @@
|
| }
|
|
|
|
|
| -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::SharedFunctionInfoMoveEvent(Address from, Address to) {
|
| + singleton_->processor_->SharedFunctionInfoMoveEvent(from, to);
|
| }
|
|
|
|
|
| -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::GetterCallbackEvent(String* name, Address entry_point) {
|
| singleton_->processor_->CallbackCreateEvent(
|
| Logger::CALLBACK_TAG, "get ", name, entry_point);
|
| @@ -539,7 +478,6 @@
|
| FLAG_log_code = saved_log_code_flag;
|
| }
|
| Logger::LogCompiledFunctions();
|
| - Logger::LogFunctionObjects();
|
| Logger::LogAccessorCallbacks();
|
| }
|
| // Enable stack sampling.
|
|
|