2011-09-19 18:36:47 +00:00
|
|
|
// Copyright 2011 the V8 project authors. All rights reserved.
|
2010-03-15 14:11:19 +00:00
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are
|
|
|
|
// met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright
|
|
|
|
// notice, this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above
|
|
|
|
// copyright notice, this list of conditions and the following
|
|
|
|
// disclaimer in the documentation and/or other materials provided
|
|
|
|
// with the distribution.
|
|
|
|
// * Neither the name of Google Inc. nor the names of its
|
|
|
|
// contributors may be used to endorse or promote products derived
|
|
|
|
// from this software without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
#ifndef V8_PROFILE_GENERATOR_H_
|
|
|
|
#define V8_PROFILE_GENERATOR_H_
|
|
|
|
|
2011-05-06 06:50:20 +00:00
|
|
|
#include "allocation.h"
|
2010-03-15 14:11:19 +00:00
|
|
|
#include "hashmap.h"
|
2010-06-11 16:34:59 +00:00
|
|
|
#include "../include/v8-profiler.h"
|
2010-03-15 14:11:19 +00:00
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
2013-05-14 22:51:33 +00:00
|
|
|
struct OffsetRange;
|
|
|
|
|
2010-06-09 07:00:33 +00:00
|
|
|
// Provides a storage of strings allocated in C++ heap, to hold them
|
|
|
|
// forever, even if they disappear from JS heap or external storage.
|
|
|
|
class StringsStorage {
|
|
|
|
public:
|
2013-09-11 07:14:41 +00:00
|
|
|
explicit StringsStorage(Heap* heap);
|
2010-06-09 07:00:33 +00:00
|
|
|
~StringsStorage();
|
|
|
|
|
2011-03-10 12:05:31 +00:00
|
|
|
const char* GetCopy(const char* src);
|
|
|
|
const char* GetFormatted(const char* format, ...);
|
|
|
|
const char* GetVFormatted(const char* format, va_list args);
|
2013-03-04 15:00:57 +00:00
|
|
|
const char* GetName(Name* name);
|
2010-10-18 09:15:38 +00:00
|
|
|
const char* GetName(int index);
|
2013-03-04 15:00:57 +00:00
|
|
|
inline const char* GetFunctionName(Name* name);
|
2010-08-18 08:19:29 +00:00
|
|
|
inline const char* GetFunctionName(const char* name);
|
2012-06-13 11:02:24 +00:00
|
|
|
size_t GetUsedMemorySize() const;
|
2010-06-09 07:00:33 +00:00
|
|
|
|
|
|
|
private:
|
2011-11-09 12:15:35 +00:00
|
|
|
static const int kMaxNameSize = 1024;
|
|
|
|
|
2010-06-09 07:00:33 +00:00
|
|
|
INLINE(static bool StringsMatch(void* key1, void* key2)) {
|
|
|
|
return strcmp(reinterpret_cast<char*>(key1),
|
|
|
|
reinterpret_cast<char*>(key2)) == 0;
|
|
|
|
}
|
2011-03-10 12:05:31 +00:00
|
|
|
const char* AddOrDisposeString(char* str, uint32_t hash);
|
2010-06-09 07:00:33 +00:00
|
|
|
|
2010-07-15 13:21:50 +00:00
|
|
|
// Mapping of strings by String::Hash to const char* strings.
|
2013-09-11 07:14:41 +00:00
|
|
|
uint32_t hash_seed_;
|
2010-06-09 07:00:33 +00:00
|
|
|
HashMap names_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(StringsStorage);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-03-15 14:11:19 +00:00
|
|
|
class CodeEntry {
|
|
|
|
public:
|
2010-03-19 09:46:53 +00:00
|
|
|
// CodeEntry doesn't own name strings, just references them.
|
2010-04-06 10:36:38 +00:00
|
|
|
INLINE(CodeEntry(Logger::LogEventsAndTags tag,
|
|
|
|
const char* name,
|
2013-07-01 10:12:03 +00:00
|
|
|
const char* name_prefix = CodeEntry::kEmptyNamePrefix,
|
2013-06-26 16:04:25 +00:00
|
|
|
const char* resource_name = CodeEntry::kEmptyResourceName,
|
2013-10-10 13:15:47 +00:00
|
|
|
int line_number = v8::CpuProfileNode::kNoLineNumberInfo,
|
|
|
|
int column_number =
|
|
|
|
v8::CpuProfileNode::kNoColumnNumberInfo));
|
2013-05-14 22:51:33 +00:00
|
|
|
~CodeEntry();
|
2010-04-06 10:36:38 +00:00
|
|
|
|
2010-04-07 14:18:26 +00:00
|
|
|
INLINE(bool is_js_function() const) { return is_js_function_tag(tag_); }
|
2010-04-06 10:36:38 +00:00
|
|
|
INLINE(const char* name_prefix() const) { return name_prefix_; }
|
|
|
|
INLINE(bool has_name_prefix() const) { return name_prefix_[0] != '\0'; }
|
|
|
|
INLINE(const char* name() const) { return name_; }
|
|
|
|
INLINE(const char* resource_name() const) { return resource_name_; }
|
|
|
|
INLINE(int line_number() const) { return line_number_; }
|
2013-10-10 13:15:47 +00:00
|
|
|
int column_number() const { return column_number_; }
|
2011-02-22 16:31:24 +00:00
|
|
|
INLINE(void set_shared_id(int shared_id)) { shared_id_ = shared_id; }
|
2013-07-02 06:14:01 +00:00
|
|
|
INLINE(int script_id() const) { return script_id_; }
|
|
|
|
INLINE(void set_script_id(int script_id)) { script_id_ = script_id; }
|
2013-09-05 13:20:51 +00:00
|
|
|
INLINE(void set_bailout_reason(const char* bailout_reason)) {
|
|
|
|
bailout_reason_ = bailout_reason;
|
|
|
|
}
|
|
|
|
INLINE(const char* bailout_reason() const) { return bailout_reason_; }
|
2010-04-06 10:36:38 +00:00
|
|
|
|
2010-04-07 14:18:26 +00:00
|
|
|
INLINE(static bool is_js_function_tag(Logger::LogEventsAndTags tag));
|
|
|
|
|
2013-05-14 22:51:33 +00:00
|
|
|
List<OffsetRange>* no_frame_ranges() const { return no_frame_ranges_; }
|
|
|
|
void set_no_frame_ranges(List<OffsetRange>* ranges) {
|
|
|
|
no_frame_ranges_ = ranges;
|
|
|
|
}
|
|
|
|
|
2013-07-02 07:51:09 +00:00
|
|
|
void SetBuiltinId(Builtins::Name id);
|
|
|
|
Builtins::Name builtin_id() const { return builtin_id_; }
|
|
|
|
|
2010-05-18 14:19:33 +00:00
|
|
|
void CopyData(const CodeEntry& source);
|
2010-09-20 09:29:12 +00:00
|
|
|
uint32_t GetCallUid() const;
|
|
|
|
bool IsSameAs(CodeEntry* entry) const;
|
2010-05-18 14:19:33 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
static const char* const kEmptyNamePrefix;
|
2013-06-26 16:04:25 +00:00
|
|
|
static const char* const kEmptyResourceName;
|
2013-09-05 13:20:51 +00:00
|
|
|
static const char* const kEmptyBailoutReason;
|
2010-03-15 14:11:19 +00:00
|
|
|
|
|
|
|
private:
|
2013-07-02 07:51:09 +00:00
|
|
|
Logger::LogEventsAndTags tag_ : 8;
|
|
|
|
Builtins::Name builtin_id_ : 8;
|
2010-04-06 10:36:38 +00:00
|
|
|
const char* name_prefix_;
|
2010-03-15 14:11:19 +00:00
|
|
|
const char* name_;
|
|
|
|
const char* resource_name_;
|
|
|
|
int line_number_;
|
2013-10-10 13:15:47 +00:00
|
|
|
int column_number_;
|
2011-02-22 16:31:24 +00:00
|
|
|
int shared_id_;
|
2013-07-02 06:14:01 +00:00
|
|
|
int script_id_;
|
2013-05-14 22:51:33 +00:00
|
|
|
List<OffsetRange>* no_frame_ranges_;
|
2013-09-05 13:20:51 +00:00
|
|
|
const char* bailout_reason_;
|
2010-03-15 14:11:19 +00:00
|
|
|
|
2010-03-19 09:46:53 +00:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(CodeEntry);
|
2010-03-15 14:11:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-04-15 11:37:29 +00:00
|
|
|
class ProfileTree;
|
|
|
|
|
2010-03-15 14:11:19 +00:00
|
|
|
class ProfileNode {
|
|
|
|
public:
|
2010-04-15 11:37:29 +00:00
|
|
|
INLINE(ProfileNode(ProfileTree* tree, CodeEntry* entry));
|
2010-03-15 14:11:19 +00:00
|
|
|
|
|
|
|
ProfileNode* FindChild(CodeEntry* entry);
|
|
|
|
ProfileNode* FindOrAddChild(CodeEntry* entry);
|
|
|
|
INLINE(void IncrementSelfTicks()) { ++self_ticks_; }
|
2010-05-18 14:19:33 +00:00
|
|
|
INLINE(void IncreaseSelfTicks(unsigned amount)) { self_ticks_ += amount; }
|
2010-03-15 14:11:19 +00:00
|
|
|
|
2010-03-19 13:51:01 +00:00
|
|
|
INLINE(CodeEntry* entry() const) { return entry_; }
|
|
|
|
INLINE(unsigned self_ticks() const) { return self_ticks_; }
|
2010-03-30 11:38:39 +00:00
|
|
|
INLINE(const List<ProfileNode*>* children() const) { return &children_list_; }
|
2013-04-02 07:48:25 +00:00
|
|
|
unsigned id() const { return id_; }
|
2010-03-15 14:11:19 +00:00
|
|
|
|
|
|
|
void Print(int indent);
|
|
|
|
|
|
|
|
private:
|
2010-03-19 09:46:53 +00:00
|
|
|
INLINE(static bool CodeEntriesMatch(void* entry1, void* entry2)) {
|
2010-09-20 09:29:12 +00:00
|
|
|
return reinterpret_cast<CodeEntry*>(entry1)->IsSameAs(
|
|
|
|
reinterpret_cast<CodeEntry*>(entry2));
|
2010-03-15 14:11:19 +00:00
|
|
|
}
|
|
|
|
|
2010-03-19 09:46:53 +00:00
|
|
|
INLINE(static uint32_t CodeEntryHash(CodeEntry* entry)) {
|
2010-09-20 09:29:12 +00:00
|
|
|
return entry->GetCallUid();
|
2010-03-15 14:11:19 +00:00
|
|
|
}
|
|
|
|
|
2010-04-15 11:37:29 +00:00
|
|
|
ProfileTree* tree_;
|
2010-03-15 14:11:19 +00:00
|
|
|
CodeEntry* entry_;
|
|
|
|
unsigned self_ticks_;
|
2010-07-15 13:21:50 +00:00
|
|
|
// Mapping from CodeEntry* to ProfileNode*
|
2010-03-15 14:11:19 +00:00
|
|
|
HashMap children_;
|
2010-03-30 11:38:39 +00:00
|
|
|
List<ProfileNode*> children_list_;
|
2013-04-02 07:48:25 +00:00
|
|
|
unsigned id_;
|
2010-03-15 14:11:19 +00:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(ProfileNode);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-03-30 11:38:39 +00:00
|
|
|
class ProfileTree {
|
2010-03-15 14:11:19 +00:00
|
|
|
public:
|
2010-04-06 14:54:20 +00:00
|
|
|
ProfileTree();
|
2010-03-15 14:11:19 +00:00
|
|
|
~ProfileTree();
|
|
|
|
|
2013-04-02 07:48:25 +00:00
|
|
|
ProfileNode* AddPathFromEnd(const Vector<CodeEntry*>& path);
|
2010-03-15 14:11:19 +00:00
|
|
|
void AddPathFromStart(const Vector<CodeEntry*>& path);
|
2010-03-30 11:38:39 +00:00
|
|
|
ProfileNode* root() const { return root_; }
|
2013-04-02 07:48:25 +00:00
|
|
|
unsigned next_node_id() { return next_node_id_++; }
|
|
|
|
|
2010-03-15 14:11:19 +00:00
|
|
|
void Print() {
|
|
|
|
root_->Print(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
template <typename Callback>
|
2010-05-18 14:19:33 +00:00
|
|
|
void TraverseDepthFirst(Callback* callback);
|
2010-03-15 14:11:19 +00:00
|
|
|
|
2010-04-06 14:54:20 +00:00
|
|
|
CodeEntry root_entry_;
|
2013-04-02 07:48:25 +00:00
|
|
|
unsigned next_node_id_;
|
2010-03-15 14:11:19 +00:00
|
|
|
ProfileNode* root_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(ProfileTree);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-03-19 09:46:53 +00:00
|
|
|
class CpuProfile {
|
2010-03-15 14:11:19 +00:00
|
|
|
public:
|
2013-07-30 07:01:16 +00:00
|
|
|
CpuProfile(const char* title, unsigned uid, bool record_samples);
|
2010-03-30 11:38:39 +00:00
|
|
|
|
2010-03-15 14:11:19 +00:00
|
|
|
// Add pc -> ... -> main() call path to the profile.
|
|
|
|
void AddPath(const Vector<CodeEntry*>& path);
|
2013-07-30 07:01:16 +00:00
|
|
|
void CalculateTotalTicksAndSamplingRate();
|
2010-03-15 14:11:19 +00:00
|
|
|
|
2013-08-05 07:17:08 +00:00
|
|
|
const char* title() const { return title_; }
|
|
|
|
unsigned uid() const { return uid_; }
|
|
|
|
const ProfileTree* top_down() const { return &top_down_; }
|
2010-03-19 09:46:53 +00:00
|
|
|
|
2013-08-05 07:17:08 +00:00
|
|
|
int samples_count() const { return samples_.length(); }
|
|
|
|
ProfileNode* sample(int index) const { return samples_.at(index); }
|
|
|
|
|
2013-08-29 09:15:13 +00:00
|
|
|
Time start_time() const { return start_time_; }
|
|
|
|
Time end_time() const { return end_time_; }
|
2013-04-02 07:48:25 +00:00
|
|
|
|
2010-04-15 11:37:29 +00:00
|
|
|
void UpdateTicksScale();
|
|
|
|
|
2010-03-15 14:11:19 +00:00
|
|
|
void Print();
|
|
|
|
|
|
|
|
private:
|
2010-03-30 11:38:39 +00:00
|
|
|
const char* title_;
|
|
|
|
unsigned uid_;
|
2013-04-02 07:48:25 +00:00
|
|
|
bool record_samples_;
|
2013-08-29 09:15:13 +00:00
|
|
|
Time start_time_;
|
|
|
|
Time end_time_;
|
|
|
|
ElapsedTimer timer_;
|
2013-04-02 07:48:25 +00:00
|
|
|
List<ProfileNode*> samples_;
|
2010-03-15 14:11:19 +00:00
|
|
|
ProfileTree top_down_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CpuProfile);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-03-30 11:38:39 +00:00
|
|
|
class CodeMap {
|
2010-03-15 14:11:19 +00:00
|
|
|
public:
|
2011-03-10 12:00:27 +00:00
|
|
|
CodeMap() : next_shared_id_(1) { }
|
2011-09-14 11:47:03 +00:00
|
|
|
void AddCode(Address addr, CodeEntry* entry, unsigned size);
|
|
|
|
void MoveCode(Address from, Address to);
|
2013-05-14 22:51:33 +00:00
|
|
|
CodeEntry* FindEntry(Address addr, Address* start = NULL);
|
2011-03-10 12:00:27 +00:00
|
|
|
int GetSharedId(Address addr);
|
2010-03-15 14:11:19 +00:00
|
|
|
|
2010-03-30 11:38:39 +00:00
|
|
|
void Print();
|
|
|
|
|
2010-03-15 14:11:19 +00:00
|
|
|
private:
|
|
|
|
struct CodeEntryInfo {
|
|
|
|
CodeEntryInfo(CodeEntry* an_entry, unsigned a_size)
|
|
|
|
: entry(an_entry), size(a_size) { }
|
|
|
|
CodeEntry* entry;
|
|
|
|
unsigned size;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CodeTreeConfig {
|
|
|
|
typedef Address Key;
|
|
|
|
typedef CodeEntryInfo Value;
|
|
|
|
static const Key kNoKey;
|
2011-10-07 14:41:08 +00:00
|
|
|
static const Value NoValue() { return CodeEntryInfo(NULL, 0); }
|
2010-03-15 14:11:19 +00:00
|
|
|
static int Compare(const Key& a, const Key& b) {
|
|
|
|
return a < b ? -1 : (a > b ? 1 : 0);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
typedef SplayTree<CodeTreeConfig> CodeTree;
|
|
|
|
|
2010-03-30 11:38:39 +00:00
|
|
|
class CodeTreePrinter {
|
|
|
|
public:
|
|
|
|
void Call(const Address& key, const CodeEntryInfo& value);
|
|
|
|
};
|
|
|
|
|
2011-09-14 11:47:03 +00:00
|
|
|
void DeleteAllCoveredCode(Address start, Address end);
|
|
|
|
|
2011-03-10 12:00:27 +00:00
|
|
|
// Fake CodeEntry pointer to distinguish shared function entries.
|
|
|
|
static CodeEntry* const kSharedFunctionCodeEntry;
|
2011-02-22 16:31:24 +00:00
|
|
|
|
2010-03-15 14:11:19 +00:00
|
|
|
CodeTree tree_;
|
2011-03-10 12:00:27 +00:00
|
|
|
int next_shared_id_;
|
2010-03-15 14:11:19 +00:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CodeMap);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-03-19 09:46:53 +00:00
|
|
|
class CpuProfilesCollection {
|
2010-03-15 14:11:19 +00:00
|
|
|
public:
|
2013-09-11 07:14:41 +00:00
|
|
|
explicit CpuProfilesCollection(Heap* heap);
|
2010-03-19 09:46:53 +00:00
|
|
|
~CpuProfilesCollection();
|
|
|
|
|
2013-04-02 07:48:25 +00:00
|
|
|
bool StartProfiling(const char* title, unsigned uid, bool record_samples);
|
2013-07-30 07:01:16 +00:00
|
|
|
CpuProfile* StopProfiling(const char* title);
|
2013-07-06 09:12:09 +00:00
|
|
|
List<CpuProfile*>* profiles() { return &finished_profiles_; }
|
2013-03-04 15:00:57 +00:00
|
|
|
const char* GetName(Name* name) {
|
2010-06-09 07:00:33 +00:00
|
|
|
return function_and_resource_names_.GetName(name);
|
|
|
|
}
|
2010-10-18 09:15:38 +00:00
|
|
|
const char* GetName(int args_count) {
|
|
|
|
return function_and_resource_names_.GetName(args_count);
|
|
|
|
}
|
2013-07-01 10:12:03 +00:00
|
|
|
const char* GetFunctionName(Name* name) {
|
|
|
|
return function_and_resource_names_.GetFunctionName(name);
|
|
|
|
}
|
|
|
|
const char* GetFunctionName(const char* name) {
|
|
|
|
return function_and_resource_names_.GetFunctionName(name);
|
|
|
|
}
|
2010-08-10 12:06:42 +00:00
|
|
|
bool IsLastProfile(const char* title);
|
2011-03-22 16:10:01 +00:00
|
|
|
void RemoveProfile(CpuProfile* profile);
|
2010-03-15 14:11:19 +00:00
|
|
|
|
2013-07-01 10:12:03 +00:00
|
|
|
CodeEntry* NewCodeEntry(
|
|
|
|
Logger::LogEventsAndTags tag,
|
|
|
|
const char* name,
|
|
|
|
const char* name_prefix = CodeEntry::kEmptyNamePrefix,
|
|
|
|
const char* resource_name = CodeEntry::kEmptyResourceName,
|
2013-10-10 13:15:47 +00:00
|
|
|
int line_number = v8::CpuProfileNode::kNoLineNumberInfo,
|
|
|
|
int column_number = v8::CpuProfileNode::kNoColumnNumberInfo);
|
2010-03-15 14:11:19 +00:00
|
|
|
|
2010-03-30 11:38:39 +00:00
|
|
|
// Called from profile generator thread.
|
|
|
|
void AddPathToCurrentProfiles(const Vector<CodeEntry*>& path);
|
|
|
|
|
2010-08-31 14:16:01 +00:00
|
|
|
// Limits the number of profiles that can be simultaneously collected.
|
|
|
|
static const int kMaxSimultaneousProfiles = 100;
|
|
|
|
|
2010-03-15 14:11:19 +00:00
|
|
|
private:
|
2010-06-09 07:00:33 +00:00
|
|
|
StringsStorage function_and_resource_names_;
|
2010-03-19 09:46:53 +00:00
|
|
|
List<CodeEntry*> code_entries_;
|
2013-07-06 09:12:09 +00:00
|
|
|
List<CpuProfile*> finished_profiles_;
|
2010-03-30 11:38:39 +00:00
|
|
|
|
|
|
|
// Accessed by VM thread and profile generator thread.
|
|
|
|
List<CpuProfile*> current_profiles_;
|
2013-09-02 12:26:06 +00:00
|
|
|
Semaphore current_profiles_semaphore_;
|
2010-03-19 09:46:53 +00:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CpuProfilesCollection);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class ProfileGenerator {
|
|
|
|
public:
|
|
|
|
explicit ProfileGenerator(CpuProfilesCollection* profiles);
|
|
|
|
|
|
|
|
void RecordTickSample(const TickSample& sample);
|
|
|
|
|
|
|
|
INLINE(CodeMap* code_map()) { return &code_map_; }
|
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
static const char* const kAnonymousFunctionName;
|
|
|
|
static const char* const kProgramEntryName;
|
2013-08-07 17:04:27 +00:00
|
|
|
static const char* const kIdleEntryName;
|
2011-03-18 20:35:07 +00:00
|
|
|
static const char* const kGarbageCollectorEntryName;
|
2013-07-02 07:51:09 +00:00
|
|
|
// Used to represent frames for which we have no reliable way to
|
|
|
|
// detect function.
|
|
|
|
static const char* const kUnresolvedFunctionName;
|
2010-04-07 14:18:26 +00:00
|
|
|
|
2010-03-19 09:46:53 +00:00
|
|
|
private:
|
2010-04-07 14:18:26 +00:00
|
|
|
INLINE(CodeEntry* EntryForVMState(StateTag tag));
|
|
|
|
|
2010-03-19 09:46:53 +00:00
|
|
|
CpuProfilesCollection* profiles_;
|
2010-03-15 14:11:19 +00:00
|
|
|
CodeMap code_map_;
|
2010-04-06 14:54:20 +00:00
|
|
|
CodeEntry* program_entry_;
|
2013-08-07 17:04:27 +00:00
|
|
|
CodeEntry* idle_entry_;
|
2010-04-07 14:18:26 +00:00
|
|
|
CodeEntry* gc_entry_;
|
2013-07-02 07:51:09 +00:00
|
|
|
CodeEntry* unresolved_entry_;
|
2010-03-15 14:11:19 +00:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(ProfileGenerator);
|
|
|
|
};
|
|
|
|
|
2010-06-11 16:34:59 +00:00
|
|
|
|
2010-03-15 14:11:19 +00:00
|
|
|
} } // namespace v8::internal
|
|
|
|
|
|
|
|
#endif // V8_PROFILE_GENERATOR_H_
|