Define stubs for implementations of v8-profiler.h API when profiling is disabled

TBR=sgjesse@chromium.org
BUG=https://bugs.webkit.org/show_bug.cgi?id=62014

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8170 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0023cacc
...@@ -5263,9 +5263,8 @@ Local<Context> Debug::GetDebugContext() { ...@@ -5263,9 +5263,8 @@ Local<Context> Debug::GetDebugContext() {
#endif // ENABLE_DEBUGGER_SUPPORT #endif // ENABLE_DEBUGGER_SUPPORT
#ifdef ENABLE_LOGGING_AND_PROFILING
Handle<String> CpuProfileNode::GetFunctionName() const { Handle<String> CpuProfileNode::GetFunctionName() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfileNode::GetFunctionName"); IsDeadCheck(isolate, "v8::CpuProfileNode::GetFunctionName");
const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
...@@ -5278,77 +5277,117 @@ Handle<String> CpuProfileNode::GetFunctionName() const { ...@@ -5278,77 +5277,117 @@ Handle<String> CpuProfileNode::GetFunctionName() const {
isolate->factory()->LookupAsciiSymbol(entry->name_prefix()), isolate->factory()->LookupAsciiSymbol(entry->name_prefix()),
isolate->factory()->LookupAsciiSymbol(entry->name())))); isolate->factory()->LookupAsciiSymbol(entry->name()))));
} }
#else
return v8::String::Empty();
#endif
} }
Handle<String> CpuProfileNode::GetScriptResourceName() const { Handle<String> CpuProfileNode::GetScriptResourceName() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptResourceName"); IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptResourceName");
const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol( return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol(
node->entry()->resource_name()))); node->entry()->resource_name())));
#else
return v8::String::Empty();
#endif
} }
int CpuProfileNode::GetLineNumber() const { int CpuProfileNode::GetLineNumber() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfileNode::GetLineNumber"); IsDeadCheck(isolate, "v8::CpuProfileNode::GetLineNumber");
return reinterpret_cast<const i::ProfileNode*>(this)->entry()->line_number(); return reinterpret_cast<const i::ProfileNode*>(this)->entry()->line_number();
#else
return 0;
#endif
} }
double CpuProfileNode::GetTotalTime() const { double CpuProfileNode::GetTotalTime() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalTime"); IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalTime");
return reinterpret_cast<const i::ProfileNode*>(this)->GetTotalMillis(); return reinterpret_cast<const i::ProfileNode*>(this)->GetTotalMillis();
#else
return 0.0;
#endif
} }
double CpuProfileNode::GetSelfTime() const { double CpuProfileNode::GetSelfTime() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfTime"); IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfTime");
return reinterpret_cast<const i::ProfileNode*>(this)->GetSelfMillis(); return reinterpret_cast<const i::ProfileNode*>(this)->GetSelfMillis();
#else
return 0.0;
#endif
} }
double CpuProfileNode::GetTotalSamplesCount() const { double CpuProfileNode::GetTotalSamplesCount() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalSamplesCount"); IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalSamplesCount");
return reinterpret_cast<const i::ProfileNode*>(this)->total_ticks(); return reinterpret_cast<const i::ProfileNode*>(this)->total_ticks();
#else
return 0.0;
#endif
} }
double CpuProfileNode::GetSelfSamplesCount() const { double CpuProfileNode::GetSelfSamplesCount() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfSamplesCount"); IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfSamplesCount");
return reinterpret_cast<const i::ProfileNode*>(this)->self_ticks(); return reinterpret_cast<const i::ProfileNode*>(this)->self_ticks();
#else
return 0.0;
#endif
} }
unsigned CpuProfileNode::GetCallUid() const { unsigned CpuProfileNode::GetCallUid() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfileNode::GetCallUid"); IsDeadCheck(isolate, "v8::CpuProfileNode::GetCallUid");
return reinterpret_cast<const i::ProfileNode*>(this)->entry()->GetCallUid(); return reinterpret_cast<const i::ProfileNode*>(this)->entry()->GetCallUid();
#else
return 0;
#endif
} }
int CpuProfileNode::GetChildrenCount() const { int CpuProfileNode::GetChildrenCount() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfileNode::GetChildrenCount"); IsDeadCheck(isolate, "v8::CpuProfileNode::GetChildrenCount");
return reinterpret_cast<const i::ProfileNode*>(this)->children()->length(); return reinterpret_cast<const i::ProfileNode*>(this)->children()->length();
#else
return 0;
#endif
} }
const CpuProfileNode* CpuProfileNode::GetChild(int index) const { const CpuProfileNode* CpuProfileNode::GetChild(int index) const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfileNode::GetChild"); IsDeadCheck(isolate, "v8::CpuProfileNode::GetChild");
const i::ProfileNode* child = const i::ProfileNode* child =
reinterpret_cast<const i::ProfileNode*>(this)->children()->at(index); reinterpret_cast<const i::ProfileNode*>(this)->children()->at(index);
return reinterpret_cast<const CpuProfileNode*>(child); return reinterpret_cast<const CpuProfileNode*>(child);
#else
return NULL;
#endif
} }
void CpuProfile::Delete() { void CpuProfile::Delete() {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfile::Delete"); IsDeadCheck(isolate, "v8::CpuProfile::Delete");
i::CpuProfiler::DeleteProfile(reinterpret_cast<i::CpuProfile*>(this)); i::CpuProfiler::DeleteProfile(reinterpret_cast<i::CpuProfile*>(this));
...@@ -5357,108 +5396,153 @@ void CpuProfile::Delete() { ...@@ -5357,108 +5396,153 @@ void CpuProfile::Delete() {
// If this was the last profile, clean up all accessory data as well. // If this was the last profile, clean up all accessory data as well.
i::CpuProfiler::DeleteAllProfiles(); i::CpuProfiler::DeleteAllProfiles();
} }
#endif
} }
unsigned CpuProfile::GetUid() const { unsigned CpuProfile::GetUid() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfile::GetUid"); IsDeadCheck(isolate, "v8::CpuProfile::GetUid");
return reinterpret_cast<const i::CpuProfile*>(this)->uid(); return reinterpret_cast<const i::CpuProfile*>(this)->uid();
#else
return 0;
#endif
} }
Handle<String> CpuProfile::GetTitle() const { Handle<String> CpuProfile::GetTitle() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfile::GetTitle"); IsDeadCheck(isolate, "v8::CpuProfile::GetTitle");
const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol( return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol(
profile->title()))); profile->title())));
#else
return v8::String::Empty();
#endif
} }
const CpuProfileNode* CpuProfile::GetBottomUpRoot() const { const CpuProfileNode* CpuProfile::GetBottomUpRoot() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfile::GetBottomUpRoot"); IsDeadCheck(isolate, "v8::CpuProfile::GetBottomUpRoot");
const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
return reinterpret_cast<const CpuProfileNode*>(profile->bottom_up()->root()); return reinterpret_cast<const CpuProfileNode*>(profile->bottom_up()->root());
#else
return NULL;
#endif
} }
const CpuProfileNode* CpuProfile::GetTopDownRoot() const { const CpuProfileNode* CpuProfile::GetTopDownRoot() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfile::GetTopDownRoot"); IsDeadCheck(isolate, "v8::CpuProfile::GetTopDownRoot");
const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
return reinterpret_cast<const CpuProfileNode*>(profile->top_down()->root()); return reinterpret_cast<const CpuProfileNode*>(profile->top_down()->root());
#else
return NULL;
#endif
} }
int CpuProfiler::GetProfilesCount() { int CpuProfiler::GetProfilesCount() {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfiler::GetProfilesCount"); IsDeadCheck(isolate, "v8::CpuProfiler::GetProfilesCount");
return i::CpuProfiler::GetProfilesCount(); return i::CpuProfiler::GetProfilesCount();
#else
return 0;
#endif
} }
const CpuProfile* CpuProfiler::GetProfile(int index, const CpuProfile* CpuProfiler::GetProfile(int index,
Handle<Value> security_token) { Handle<Value> security_token) {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfiler::GetProfile"); IsDeadCheck(isolate, "v8::CpuProfiler::GetProfile");
return reinterpret_cast<const CpuProfile*>( return reinterpret_cast<const CpuProfile*>(
i::CpuProfiler::GetProfile( i::CpuProfiler::GetProfile(
security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
index)); index));
#else
return NULL;
#endif
} }
const CpuProfile* CpuProfiler::FindProfile(unsigned uid, const CpuProfile* CpuProfiler::FindProfile(unsigned uid,
Handle<Value> security_token) { Handle<Value> security_token) {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfiler::FindProfile"); IsDeadCheck(isolate, "v8::CpuProfiler::FindProfile");
return reinterpret_cast<const CpuProfile*>( return reinterpret_cast<const CpuProfile*>(
i::CpuProfiler::FindProfile( i::CpuProfiler::FindProfile(
security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
uid)); uid));
#else
return NULL;
#endif
} }
void CpuProfiler::StartProfiling(Handle<String> title) { void CpuProfiler::StartProfiling(Handle<String> title) {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfiler::StartProfiling"); IsDeadCheck(isolate, "v8::CpuProfiler::StartProfiling");
i::CpuProfiler::StartProfiling(*Utils::OpenHandle(*title)); i::CpuProfiler::StartProfiling(*Utils::OpenHandle(*title));
#endif
} }
const CpuProfile* CpuProfiler::StopProfiling(Handle<String> title, const CpuProfile* CpuProfiler::StopProfiling(Handle<String> title,
Handle<Value> security_token) { Handle<Value> security_token) {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfiler::StopProfiling"); IsDeadCheck(isolate, "v8::CpuProfiler::StopProfiling");
return reinterpret_cast<const CpuProfile*>( return reinterpret_cast<const CpuProfile*>(
i::CpuProfiler::StopProfiling( i::CpuProfiler::StopProfiling(
security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
*Utils::OpenHandle(*title))); *Utils::OpenHandle(*title)));
#else
return NULL;
#endif
} }
void CpuProfiler::DeleteAllProfiles() { void CpuProfiler::DeleteAllProfiles() {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfiler::DeleteAllProfiles"); IsDeadCheck(isolate, "v8::CpuProfiler::DeleteAllProfiles");
i::CpuProfiler::DeleteAllProfiles(); i::CpuProfiler::DeleteAllProfiles();
#endif
} }
#ifdef ENABLE_LOGGING_AND_PROFILING
static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) {
return const_cast<i::HeapGraphEdge*>( return const_cast<i::HeapGraphEdge*>(
reinterpret_cast<const i::HeapGraphEdge*>(edge)); reinterpret_cast<const i::HeapGraphEdge*>(edge));
} }
#endif
HeapGraphEdge::Type HeapGraphEdge::GetType() const { HeapGraphEdge::Type HeapGraphEdge::GetType() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapGraphEdge::GetType"); IsDeadCheck(isolate, "v8::HeapGraphEdge::GetType");
return static_cast<HeapGraphEdge::Type>(ToInternal(this)->type()); return static_cast<HeapGraphEdge::Type>(ToInternal(this)->type());
#else
return static_cast<HeapGraphEdge::Type>(0);
#endif
} }
Handle<Value> HeapGraphEdge::GetName() const { Handle<Value> HeapGraphEdge::GetName() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapGraphEdge::GetName"); IsDeadCheck(isolate, "v8::HeapGraphEdge::GetName");
i::HeapGraphEdge* edge = ToInternal(this); i::HeapGraphEdge* edge = ToInternal(this);
...@@ -5475,121 +5559,179 @@ Handle<Value> HeapGraphEdge::GetName() const { ...@@ -5475,121 +5559,179 @@ Handle<Value> HeapGraphEdge::GetName() const {
edge->index()))); edge->index())));
default: UNREACHABLE(); default: UNREACHABLE();
} }
#endif
return v8::Undefined(); return v8::Undefined();
} }
const HeapGraphNode* HeapGraphEdge::GetFromNode() const { const HeapGraphNode* HeapGraphEdge::GetFromNode() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapGraphEdge::GetFromNode"); IsDeadCheck(isolate, "v8::HeapGraphEdge::GetFromNode");
const i::HeapEntry* from = ToInternal(this)->From(); const i::HeapEntry* from = ToInternal(this)->From();
return reinterpret_cast<const HeapGraphNode*>(from); return reinterpret_cast<const HeapGraphNode*>(from);
#else
return NULL;
#endif
} }
const HeapGraphNode* HeapGraphEdge::GetToNode() const { const HeapGraphNode* HeapGraphEdge::GetToNode() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapGraphEdge::GetToNode"); IsDeadCheck(isolate, "v8::HeapGraphEdge::GetToNode");
const i::HeapEntry* to = ToInternal(this)->to(); const i::HeapEntry* to = ToInternal(this)->to();
return reinterpret_cast<const HeapGraphNode*>(to); return reinterpret_cast<const HeapGraphNode*>(to);
#else
return NULL;
#endif
} }
#ifdef ENABLE_LOGGING_AND_PROFILING
static i::HeapEntry* ToInternal(const HeapGraphNode* entry) { static i::HeapEntry* ToInternal(const HeapGraphNode* entry) {
return const_cast<i::HeapEntry*>( return const_cast<i::HeapEntry*>(
reinterpret_cast<const i::HeapEntry*>(entry)); reinterpret_cast<const i::HeapEntry*>(entry));
} }
#endif
HeapGraphNode::Type HeapGraphNode::GetType() const { HeapGraphNode::Type HeapGraphNode::GetType() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapGraphNode::GetType"); IsDeadCheck(isolate, "v8::HeapGraphNode::GetType");
return static_cast<HeapGraphNode::Type>(ToInternal(this)->type()); return static_cast<HeapGraphNode::Type>(ToInternal(this)->type());
#else
return static_cast<HeapGraphNode::Type>(0);
#endif
} }
Handle<String> HeapGraphNode::GetName() const { Handle<String> HeapGraphNode::GetName() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapGraphNode::GetName"); IsDeadCheck(isolate, "v8::HeapGraphNode::GetName");
return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol( return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol(
ToInternal(this)->name()))); ToInternal(this)->name())));
#else
return v8::String::Empty();
#endif
} }
uint64_t HeapGraphNode::GetId() const { uint64_t HeapGraphNode::GetId() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapGraphNode::GetId"); IsDeadCheck(isolate, "v8::HeapGraphNode::GetId");
ASSERT(ToInternal(this)->snapshot()->type() != i::HeapSnapshot::kAggregated); ASSERT(ToInternal(this)->snapshot()->type() != i::HeapSnapshot::kAggregated);
return ToInternal(this)->id(); return ToInternal(this)->id();
#else
return 0;
#endif
} }
int HeapGraphNode::GetInstancesCount() const { int HeapGraphNode::GetInstancesCount() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapGraphNode::GetInstancesCount"); IsDeadCheck(isolate, "v8::HeapGraphNode::GetInstancesCount");
ASSERT(ToInternal(this)->snapshot()->type() == i::HeapSnapshot::kAggregated); ASSERT(ToInternal(this)->snapshot()->type() == i::HeapSnapshot::kAggregated);
return static_cast<int>(ToInternal(this)->id()); return static_cast<int>(ToInternal(this)->id());
#else
return 0;
#endif
} }
int HeapGraphNode::GetSelfSize() const { int HeapGraphNode::GetSelfSize() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapGraphNode::GetSelfSize"); IsDeadCheck(isolate, "v8::HeapGraphNode::GetSelfSize");
return ToInternal(this)->self_size(); return ToInternal(this)->self_size();
#else
return 0;
#endif
} }
int HeapGraphNode::GetRetainedSize(bool exact) const { int HeapGraphNode::GetRetainedSize(bool exact) const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainedSize"); IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainedSize");
return ToInternal(this)->RetainedSize(exact); return ToInternal(this)->RetainedSize(exact);
#else
return 0;
#endif
} }
int HeapGraphNode::GetChildrenCount() const { int HeapGraphNode::GetChildrenCount() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapSnapshot::GetChildrenCount"); IsDeadCheck(isolate, "v8::HeapSnapshot::GetChildrenCount");
return ToInternal(this)->children().length(); return ToInternal(this)->children().length();
#else
return 0;
#endif
} }
const HeapGraphEdge* HeapGraphNode::GetChild(int index) const { const HeapGraphEdge* HeapGraphNode::GetChild(int index) const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapSnapshot::GetChild"); IsDeadCheck(isolate, "v8::HeapSnapshot::GetChild");
return reinterpret_cast<const HeapGraphEdge*>( return reinterpret_cast<const HeapGraphEdge*>(
&ToInternal(this)->children()[index]); &ToInternal(this)->children()[index]);
#else
return NULL;
#endif
} }
int HeapGraphNode::GetRetainersCount() const { int HeapGraphNode::GetRetainersCount() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainersCount"); IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainersCount");
return ToInternal(this)->retainers().length(); return ToInternal(this)->retainers().length();
#else
return 0;
#endif
} }
const HeapGraphEdge* HeapGraphNode::GetRetainer(int index) const { const HeapGraphEdge* HeapGraphNode::GetRetainer(int index) const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainer"); IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainer");
return reinterpret_cast<const HeapGraphEdge*>( return reinterpret_cast<const HeapGraphEdge*>(
ToInternal(this)->retainers()[index]); ToInternal(this)->retainers()[index]);
#else
return NULL;
#endif
} }
const HeapGraphNode* HeapGraphNode::GetDominatorNode() const { const HeapGraphNode* HeapGraphNode::GetDominatorNode() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapSnapshot::GetDominatorNode"); IsDeadCheck(isolate, "v8::HeapSnapshot::GetDominatorNode");
return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->dominator()); return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->dominator());
#else
return NULL;
#endif
} }
#ifdef ENABLE_LOGGING_AND_PROFILING
static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) { static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) {
return const_cast<i::HeapSnapshot*>( return const_cast<i::HeapSnapshot*>(
reinterpret_cast<const i::HeapSnapshot*>(snapshot)); reinterpret_cast<const i::HeapSnapshot*>(snapshot));
} }
#endif
void HeapSnapshot::Delete() { void HeapSnapshot::Delete() {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapSnapshot::Delete"); IsDeadCheck(isolate, "v8::HeapSnapshot::Delete");
if (i::HeapProfiler::GetSnapshotsCount() > 1) { if (i::HeapProfiler::GetSnapshotsCount() > 1) {
...@@ -5598,48 +5740,70 @@ void HeapSnapshot::Delete() { ...@@ -5598,48 +5740,70 @@ void HeapSnapshot::Delete() {
// If this is the last snapshot, clean up all accessory data as well. // If this is the last snapshot, clean up all accessory data as well.
i::HeapProfiler::DeleteAllSnapshots(); i::HeapProfiler::DeleteAllSnapshots();
} }
#endif
} }
HeapSnapshot::Type HeapSnapshot::GetType() const { HeapSnapshot::Type HeapSnapshot::GetType() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapSnapshot::GetType"); IsDeadCheck(isolate, "v8::HeapSnapshot::GetType");
return static_cast<HeapSnapshot::Type>(ToInternal(this)->type()); return static_cast<HeapSnapshot::Type>(ToInternal(this)->type());
#else
return static_cast<HeapSnapshot::Type>(0);
#endif
} }
unsigned HeapSnapshot::GetUid() const { unsigned HeapSnapshot::GetUid() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapSnapshot::GetUid"); IsDeadCheck(isolate, "v8::HeapSnapshot::GetUid");
return ToInternal(this)->uid(); return ToInternal(this)->uid();
#else
return 0;
#endif
} }
Handle<String> HeapSnapshot::GetTitle() const { Handle<String> HeapSnapshot::GetTitle() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapSnapshot::GetTitle"); IsDeadCheck(isolate, "v8::HeapSnapshot::GetTitle");
return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol( return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol(
ToInternal(this)->title()))); ToInternal(this)->title())));
#else
return v8::String::Empty();
#endif
} }
const HeapGraphNode* HeapSnapshot::GetRoot() const { const HeapGraphNode* HeapSnapshot::GetRoot() const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapSnapshot::GetHead"); IsDeadCheck(isolate, "v8::HeapSnapshot::GetHead");
return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->root()); return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->root());
#else
return 0;
#endif
} }
const HeapGraphNode* HeapSnapshot::GetNodeById(uint64_t id) const { const HeapGraphNode* HeapSnapshot::GetNodeById(uint64_t id) const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapSnapshot::GetNodeById"); IsDeadCheck(isolate, "v8::HeapSnapshot::GetNodeById");
return reinterpret_cast<const HeapGraphNode*>( return reinterpret_cast<const HeapGraphNode*>(
ToInternal(this)->GetEntryById(id)); ToInternal(this)->GetEntryById(id));
#else
return NULL;
#endif
} }
void HeapSnapshot::Serialize(OutputStream* stream, void HeapSnapshot::Serialize(OutputStream* stream,
HeapSnapshot::SerializationFormat format) const { HeapSnapshot::SerializationFormat format) const {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapSnapshot::Serialize"); IsDeadCheck(isolate, "v8::HeapSnapshot::Serialize");
ApiCheck(format == kJSON, ApiCheck(format == kJSON,
...@@ -5653,35 +5817,49 @@ void HeapSnapshot::Serialize(OutputStream* stream, ...@@ -5653,35 +5817,49 @@ void HeapSnapshot::Serialize(OutputStream* stream,
"Invalid stream chunk size"); "Invalid stream chunk size");
i::HeapSnapshotJSONSerializer serializer(ToInternal(this)); i::HeapSnapshotJSONSerializer serializer(ToInternal(this));
serializer.Serialize(stream); serializer.Serialize(stream);
#endif
} }
int HeapProfiler::GetSnapshotsCount() { int HeapProfiler::GetSnapshotsCount() {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshotsCount"); IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshotsCount");
return i::HeapProfiler::GetSnapshotsCount(); return i::HeapProfiler::GetSnapshotsCount();
#else
return 0;
#endif
} }
const HeapSnapshot* HeapProfiler::GetSnapshot(int index) { const HeapSnapshot* HeapProfiler::GetSnapshot(int index) {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshot"); IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshot");
return reinterpret_cast<const HeapSnapshot*>( return reinterpret_cast<const HeapSnapshot*>(
i::HeapProfiler::GetSnapshot(index)); i::HeapProfiler::GetSnapshot(index));
#else
return NULL;
#endif
} }
const HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) { const HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapProfiler::FindSnapshot"); IsDeadCheck(isolate, "v8::HeapProfiler::FindSnapshot");
return reinterpret_cast<const HeapSnapshot*>( return reinterpret_cast<const HeapSnapshot*>(
i::HeapProfiler::FindSnapshot(uid)); i::HeapProfiler::FindSnapshot(uid));
#else
return NULL;
#endif
} }
const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title, const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title,
HeapSnapshot::Type type, HeapSnapshot::Type type,
ActivityControl* control) { ActivityControl* control) {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapProfiler::TakeSnapshot"); IsDeadCheck(isolate, "v8::HeapProfiler::TakeSnapshot");
i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull; i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull;
...@@ -5698,23 +5876,29 @@ const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title, ...@@ -5698,23 +5876,29 @@ const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title,
return reinterpret_cast<const HeapSnapshot*>( return reinterpret_cast<const HeapSnapshot*>(
i::HeapProfiler::TakeSnapshot( i::HeapProfiler::TakeSnapshot(
*Utils::OpenHandle(*title), internal_type, control)); *Utils::OpenHandle(*title), internal_type, control));
#else
return NULL;
#endif
} }
void HeapProfiler::DeleteAllSnapshots() { void HeapProfiler::DeleteAllSnapshots() {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapProfiler::DeleteAllSnapshots"); IsDeadCheck(isolate, "v8::HeapProfiler::DeleteAllSnapshots");
i::HeapProfiler::DeleteAllSnapshots(); i::HeapProfiler::DeleteAllSnapshots();
#endif
} }
void HeapProfiler::DefineWrapperClass(uint16_t class_id, void HeapProfiler::DefineWrapperClass(uint16_t class_id,
WrapperInfoCallback callback) { WrapperInfoCallback callback) {
#ifdef ENABLE_LOGGING_AND_PROFILING
i::Isolate::Current()->heap_profiler()->DefineWrapperClass(class_id, i::Isolate::Current()->heap_profiler()->DefineWrapperClass(class_id,
callback); callback);
#endif
} }
#endif // ENABLE_LOGGING_AND_PROFILING
v8::Testing::StressType internal::Testing::stress_type_ = v8::Testing::StressType internal::Testing::stress_type_ =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment