* obtaining profiling results.
*/
- /** Deprecated. Use GetProfileCount instead. */
- V8_DEPRECATED(static int GetProfilesCount());
/**
* Returns the number of profiles collected (doesn't include
* profiles that are being collected at the moment of call.)
*/
int GetProfileCount();
- /** Deprecated. Use GetCpuProfile instead. */
- V8_DEPRECATED(static const CpuProfile* GetProfile(
- int index,
- Handle<Value> security_token = Handle<Value>()));
/** Deprecated. Use GetCpuProfile with single parameter. */
V8_DEPRECATED(const CpuProfile* GetCpuProfile(
int index,
/** Returns a profile by index. */
const CpuProfile* GetCpuProfile(int index);
- /** Deprecated. Use FindProfile instead. */
- V8_DEPRECATED(static const CpuProfile* FindProfile(
- unsigned uid,
- Handle<Value> security_token = Handle<Value>()));
/** Returns a profile by uid. */
V8_DEPRECATED(const CpuProfile* FindCpuProfile(
unsigned uid,
Handle<Value> security_token = Handle<Value>()));
- /** Deprecated. Use StartCpuProfiling instead. */
- V8_DEPRECATED(static void StartProfiling(Handle<String> title,
- bool record_samples = false));
/**
* Starts collecting CPU profile. Title may be an empty string. It
* is allowed to have several profiles being collected at
*/
void StartCpuProfiling(Handle<String> title, bool record_samples = false);
- /** Deprecated. Use StopCpuProfiling instead. */
- V8_DEPRECATED(static const CpuProfile* StopProfiling(
- Handle<String> title,
- Handle<Value> security_token = Handle<Value>()));
/**
* Deprecated. Use StopCpuProfiling with one parameter instead.
*/
*/
const CpuProfile* StopCpuProfiling(Handle<String> title);
- /** Deprecated. Use DeleteAllCpuProfiles instead. */
- V8_DEPRECATED(static void DeleteAllProfiles());
/**
* Deletes all existing profiles, also cancelling all profiling
* activity. All previously returned pointers to profiles and their
*/
class V8EXPORT HeapSnapshot {
public:
- enum Type {
- kFull = 0 // Heap snapshot with all instances and references.
- };
enum SerializationFormat {
kJSON = 0 // See format description near 'Serialize' method.
};
- /** Deprecated. Returns kFull. */
- V8_DEPRECATED(Type GetType() const);
-
/** Returns heap snapshot UID (assigned by the profiler.) */
unsigned GetUid() const;
typedef RetainedObjectInfo* (*WrapperInfoCallback)
(uint16_t class_id, Handle<Value> wrapper);
- /** Deprecated. Use GetSnapshotCount instead. */
- V8_DEPRECATED(static int GetSnapshotsCount());
/** Returns the number of snapshots taken. */
int GetSnapshotCount();
- /** Deprecated. Use GetHeapSnapshot instead. */
- V8_DEPRECATED(static const HeapSnapshot* GetSnapshot(int index));
/** Returns a snapshot by index. */
const HeapSnapshot* GetHeapSnapshot(int index);
- /** Deprecated. Use FindHeapSnapshot instead. */
- V8_DEPRECATED(static const HeapSnapshot* FindSnapshot(unsigned uid));
/** Returns a profile by uid. */
V8_DEPRECATED(const HeapSnapshot* FindHeapSnapshot(unsigned uid));
- /** Deprecated. Use GetObjectId instead. */
- V8_DEPRECATED(static SnapshotObjectId GetSnapshotObjectId(
- Handle<Value> value));
/**
* Returns SnapshotObjectId for a heap object referenced by |value| if
* it has been seen by the heap profiler, kUnknownObjectId otherwise.
virtual ~ObjectNameResolver() {}
};
- /** Deprecated. Use TakeHeapSnapshot instead. */
- V8_DEPRECATED(static const HeapSnapshot* TakeSnapshot(
- Handle<String> title,
- HeapSnapshot::Type type = HeapSnapshot::kFull,
- ActivityControl* control = NULL,
- ObjectNameResolver* global_object_name_resolver = NULL));
/**
* Takes a heap snapshot and returns it. Title may be an empty string.
*/
ActivityControl* control = NULL,
ObjectNameResolver* global_object_name_resolver = NULL);
-
- /** Deprecated. Use StartTrackingHeapObjects instead. */
- V8_DEPRECATED(static void StartHeapObjectsTracking());
/**
* Starts tracking of heap objects population statistics. After calling
* this method, all heap objects relocations done by the garbage collector
*/
void StartTrackingHeapObjects();
- /** Deprecated. Use GetHeapStats instead. */
- V8_DEPRECATED(static SnapshotObjectId PushHeapObjectsStats(
- OutputStream* stream));
/**
* Adds a new time interval entry to the aggregated statistics array. The
* time interval entry contains information on the current heap objects
*/
SnapshotObjectId GetHeapStats(OutputStream* stream);
- /** Deprecated. Use StopTrackingHeapObjects instead. */
- V8_DEPRECATED(static void StopHeapObjectsTracking());
/**
* Stops tracking of heap objects population statistics, cleans up all
* collected data. StartHeapObjectsTracking must be called again prior to
*/
void StopTrackingHeapObjects();
- /** Deprecated. Use DeleteAllHeapSnapshots instead. */
- V8_DEPRECATED(static void DeleteAllSnapshots());
/**
* Deletes all snapshots taken. All previously returned pointers to
* snapshots and their contents become invalid after this call.
*/
void DeleteAllHeapSnapshots();
- /** Deprecated. Use SetWrapperClassInfoProvider instead. */
- V8_DEPRECATED(static void DefineWrapperClass(
- uint16_t class_id,
- WrapperInfoCallback callback));
/** Binds a callback to embedder's class ID. */
void SetWrapperClassInfoProvider(
uint16_t class_id,
*/
static const uint16_t kPersistentHandleNoClassId = 0;
- /**
- * Deprecated. Returns the number of currently existing persistent handles.
- */
- V8_DEPRECATED(static int GetPersistentHandleCount());
-
- /** Deprecated. Use GetHeapProfilerMemorySize instead. */
- V8_DEPRECATED(static size_t GetMemorySizeUsedByProfiler());
/** Returns memory used for profiler internal data and snapshots. */
size_t GetProfilerMemorySize();
* objects for heap snapshots, he can do it in a GC prologue
* handler, and / or by assigning wrapper class ids in the following way:
*
- * 1. Bind a callback to class id by calling DefineWrapperClass.
+ * 1. Bind a callback to class id by calling SetWrapperClassInfoProvider.
* 2. Call SetWrapperClassId on certain persistent handles.
*
* V8 takes ownership of RetainedObjectInfo instances passed to it and
}
-int CpuProfiler::GetProfilesCount() {
- i::Isolate* isolate = i::Isolate::Current();
- IsDeadCheck(isolate, "v8::CpuProfiler::GetProfilesCount");
- i::CpuProfiler* profiler = isolate->cpu_profiler();
- ASSERT(profiler != NULL);
- return profiler->GetProfilesCount();
-}
-
-
int CpuProfiler::GetProfileCount() {
return reinterpret_cast<i::CpuProfiler*>(this)->GetProfilesCount();
}
-const CpuProfile* CpuProfiler::GetProfile(int index,
- Handle<Value> security_token) {
- i::Isolate* isolate = i::Isolate::Current();
- IsDeadCheck(isolate, "v8::CpuProfiler::GetProfile");
- i::CpuProfiler* profiler = isolate->cpu_profiler();
- ASSERT(profiler != NULL);
- return reinterpret_cast<const CpuProfile*>(
- profiler->GetProfile(
- security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
- index));
-}
-
-
const CpuProfile* CpuProfiler::GetCpuProfile(int index,
Handle<Value> security_token) {
return reinterpret_cast<const CpuProfile*>(
}
-const CpuProfile* CpuProfiler::FindProfile(unsigned uid,
- Handle<Value> security_token) {
- i::Isolate* isolate = i::Isolate::Current();
- IsDeadCheck(isolate, "v8::CpuProfiler::FindProfile");
- i::CpuProfiler* profiler = isolate->cpu_profiler();
- ASSERT(profiler != NULL);
- return reinterpret_cast<const CpuProfile*>(
- profiler->FindProfile(
- security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
- uid));
-}
-
-
const CpuProfile* CpuProfiler::FindCpuProfile(unsigned uid,
Handle<Value> security_token) {
return reinterpret_cast<const CpuProfile*>(
}
-void CpuProfiler::StartProfiling(Handle<String> title, bool record_samples) {
- i::Isolate* isolate = i::Isolate::Current();
- IsDeadCheck(isolate, "v8::CpuProfiler::StartProfiling");
- i::CpuProfiler* profiler = isolate->cpu_profiler();
- ASSERT(profiler != NULL);
- profiler->StartProfiling(*Utils::OpenHandle(*title), record_samples);
-}
-
-
void CpuProfiler::StartCpuProfiling(Handle<String> title, bool record_samples) {
reinterpret_cast<i::CpuProfiler*>(this)->StartProfiling(
*Utils::OpenHandle(*title), record_samples);
}
-const CpuProfile* CpuProfiler::StopProfiling(Handle<String> title,
- Handle<Value> security_token) {
- i::Isolate* isolate = i::Isolate::Current();
- IsDeadCheck(isolate, "v8::CpuProfiler::StopProfiling");
- i::CpuProfiler* profiler = isolate->cpu_profiler();
- ASSERT(profiler != NULL);
- return reinterpret_cast<const CpuProfile*>(
- profiler->StopProfiling(
- security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
- *Utils::OpenHandle(*title)));
-}
-
-
const CpuProfile* CpuProfiler::StopCpuProfiling(Handle<String> title,
Handle<Value> security_token) {
return reinterpret_cast<const CpuProfile*>(
}
-void CpuProfiler::DeleteAllProfiles() {
- i::Isolate* isolate = i::Isolate::Current();
- IsDeadCheck(isolate, "v8::CpuProfiler::DeleteAllProfiles");
- i::CpuProfiler* profiler = isolate->cpu_profiler();
- ASSERT(profiler != NULL);
- profiler->DeleteAllProfiles();
-}
-
-
void CpuProfiler::DeleteAllCpuProfiles() {
reinterpret_cast<i::CpuProfiler*>(this)->DeleteAllProfiles();
}
}
-HeapSnapshot::Type HeapSnapshot::GetType() const {
- i::Isolate* isolate = i::Isolate::Current();
- IsDeadCheck(isolate, "v8::HeapSnapshot::GetType");
- return kFull;
-}
-
-
unsigned HeapSnapshot::GetUid() const {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapSnapshot::GetUid");
}
-int HeapProfiler::GetSnapshotsCount() {
- i::Isolate* isolate = i::Isolate::Current();
- IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshotsCount");
- return isolate->heap_profiler()->GetSnapshotsCount();
-}
-
-
int HeapProfiler::GetSnapshotCount() {
return reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshotsCount();
}
-const HeapSnapshot* HeapProfiler::GetSnapshot(int index) {
- i::Isolate* isolate = i::Isolate::Current();
- IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshot");
- return reinterpret_cast<const HeapSnapshot*>(
- isolate->heap_profiler()->GetSnapshot(index));
-}
-
-
const HeapSnapshot* HeapProfiler::GetHeapSnapshot(int index) {
return reinterpret_cast<const HeapSnapshot*>(
reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshot(index));
}
-const HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) {
- i::Isolate* isolate = i::Isolate::Current();
- IsDeadCheck(isolate, "v8::HeapProfiler::FindSnapshot");
- return reinterpret_cast<const HeapSnapshot*>(
- isolate->heap_profiler()->FindSnapshot(uid));
-}
-
-
const HeapSnapshot* HeapProfiler::FindHeapSnapshot(unsigned uid) {
return reinterpret_cast<const HeapSnapshot*>(
reinterpret_cast<i::HeapProfiler*>(this)->FindSnapshot(uid));
}
-SnapshotObjectId HeapProfiler::GetSnapshotObjectId(Handle<Value> value) {
- i::Isolate* isolate = i::Isolate::Current();
- IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshotObjectId");
- i::Handle<i::Object> obj = Utils::OpenHandle(*value);
- return isolate->heap_profiler()->GetSnapshotObjectId(obj);
-}
-
-
SnapshotObjectId HeapProfiler::GetObjectId(Handle<Value> value) {
i::Handle<i::Object> obj = Utils::OpenHandle(*value);
return reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshotObjectId(obj);
}
-const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title,
- HeapSnapshot::Type type,
- ActivityControl* control,
- ObjectNameResolver* resolver) {
- i::Isolate* isolate = i::Isolate::Current();
- IsDeadCheck(isolate, "v8::HeapProfiler::TakeSnapshot");
- return reinterpret_cast<const HeapSnapshot*>(
- isolate->heap_profiler()->TakeSnapshot(
- *Utils::OpenHandle(*title), control, resolver));
-}
-
-
const HeapSnapshot* HeapProfiler::TakeHeapSnapshot(
Handle<String> title,
ActivityControl* control,
}
-void HeapProfiler::StartHeapObjectsTracking() {
- i::Isolate* isolate = i::Isolate::Current();
- IsDeadCheck(isolate, "v8::HeapProfiler::StartHeapObjectsTracking");
- isolate->heap_profiler()->StartHeapObjectsTracking();
-}
-
-
void HeapProfiler::StartTrackingHeapObjects() {
reinterpret_cast<i::HeapProfiler*>(this)->StartHeapObjectsTracking();
}
-void HeapProfiler::StopHeapObjectsTracking() {
- i::Isolate* isolate = i::Isolate::Current();
- IsDeadCheck(isolate, "v8::HeapProfiler::StopHeapObjectsTracking");
- isolate->heap_profiler()->StopHeapObjectsTracking();
-}
-
-
void HeapProfiler::StopTrackingHeapObjects() {
reinterpret_cast<i::HeapProfiler*>(this)->StopHeapObjectsTracking();
}
-SnapshotObjectId HeapProfiler::PushHeapObjectsStats(OutputStream* stream) {
- i::Isolate* isolate = i::Isolate::Current();
- IsDeadCheck(isolate, "v8::HeapProfiler::PushHeapObjectsStats");
- return isolate->heap_profiler()->PushHeapObjectsStats(stream);
-}
-
-
SnapshotObjectId HeapProfiler::GetHeapStats(OutputStream* stream) {
return reinterpret_cast<i::HeapProfiler*>(this)->PushHeapObjectsStats(stream);
}
-void HeapProfiler::DeleteAllSnapshots() {
- i::Isolate* isolate = i::Isolate::Current();
- IsDeadCheck(isolate, "v8::HeapProfiler::DeleteAllSnapshots");
- isolate->heap_profiler()->DeleteAllSnapshots();
-}
-
-
void HeapProfiler::DeleteAllHeapSnapshots() {
reinterpret_cast<i::HeapProfiler*>(this)->DeleteAllSnapshots();
}
-void HeapProfiler::DefineWrapperClass(uint16_t class_id,
- WrapperInfoCallback callback) {
- i::Isolate::Current()->heap_profiler()->DefineWrapperClass(class_id,
- callback);
-}
-
-
void HeapProfiler::SetWrapperClassInfoProvider(uint16_t class_id,
WrapperInfoCallback callback) {
reinterpret_cast<i::HeapProfiler*>(this)->DefineWrapperClass(class_id,
}
-int HeapProfiler::GetPersistentHandleCount() {
- i::Isolate* isolate = i::Isolate::Current();
- return isolate->global_handles()->NumberOfGlobalHandles();
-}
-
-
-size_t HeapProfiler::GetMemorySizeUsedByProfiler() {
- return i::Isolate::Current()->heap_profiler()->GetMemorySizeUsedByProfiler();
-}
-
-
size_t HeapProfiler::GetProfilerMemorySize() {
return reinterpret_cast<i::HeapProfiler*>(this)->
GetMemorySizeUsedByProfiler();
}
v8::internal::GlobalHandles* global_handles =
reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles();
- int initial_handle_count = global_handles->NumberOfGlobalHandles();
+ int initial_handle_count = global_handles->global_handles_count();
{
v8::HandleScope scope(isolate);
CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 3);
v8::HandleScope scope(isolate);
global.Reset(isolate, v8_str("longer"));
}
- CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count);
+ CHECK_EQ(global_handles->global_handles_count(), initial_handle_count);
{
v8::HandleScope scope(isolate);
CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 6);
}
global.Dispose(isolate);
- CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count - 1);
+ CHECK_EQ(global_handles->global_handles_count(), initial_handle_count - 1);
}
}
v8::internal::GlobalHandles* global_handles =
reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles();
- int initial_handle_count = global_handles->NumberOfGlobalHandles();
+ int initial_handle_count = global_handles->global_handles_count();
{
v8::HandleScope scope(isolate);
CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 3);
global.Reset(isolate, empty);
}
CHECK(global.IsEmpty());
- CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count - 1);
+ CHECK_EQ(global_handles->global_handles_count(), initial_handle_count - 1);
}
Local<String> str = v8_str("str");
global_handles =
reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles();
- initial_handle_count = global_handles->NumberOfGlobalHandles();
+ initial_handle_count = global_handles->global_handles_count();
global.Reset(isolate, str);
}
- CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count + 1);
+ CHECK_EQ(global_handles->global_handles_count(), initial_handle_count + 1);
String* str = global.ClearAndLeak();
CHECK(global.IsEmpty());
- CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count + 1);
+ CHECK_EQ(global_handles->global_handles_count(), initial_handle_count + 1);
global_handles->Destroy(reinterpret_cast<i::Object**>(str));
- CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count);
+ CHECK_EQ(global_handles->global_handles_count(), initial_handle_count);
}