Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Merge pull request #157 from rakuco/fix-standalone-build
Browse files Browse the repository at this point in the history
Revert "XDK Heap Profiler collector and XDK CPUProfiler"
  • Loading branch information
Raphael Kubo da Costa authored Jun 20, 2016
2 parents fb55f85 + 4e54260 commit 78a7e24
Show file tree
Hide file tree
Showing 18 changed files with 209 additions and 2,601 deletions.
37 changes: 0 additions & 37 deletions include/v8-profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@ class V8_EXPORT CpuProfileNode {
*/
int GetColumnNumber() const;

/**
* Returns source line connected with current ProfileNode
*/
int GetSrcLine() const;

/**
* Returns the number of the function's source lines that collect the samples.
*/
Expand Down Expand Up @@ -178,18 +173,6 @@ class V8_EXPORT CpuProfile {
void Delete();
};

/**
* HeapEventXDK contains the latest chunk of heap info
*/
class V8_EXPORT HeapEventXDK {
public:
const char* getSymbols();
const char* getFrames();
const char* getTypes();
const char* getChunks();
const char* getRetentions();
unsigned int getDuration();
};

/**
* Interface for controlling CPU profiling. Instance of the
Expand Down Expand Up @@ -358,18 +341,6 @@ class V8_EXPORT OutputStream { // NOLINT
virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate* data, int count) {
return kAbort;
}

/**
* Writes XDK object
*/
virtual WriteResult WriteHeapXDKChunk(const char* symbols, size_t symbolsSize,
const char* frames, size_t framesSize,
const char* types, size_t typesSize,
const char* chunks, size_t chunksSize,
const char* retentions,
size_t retentionSize) {
return kAbort;
}
};


Expand Down Expand Up @@ -710,14 +681,6 @@ class V8_EXPORT HeapProfiler {
*/
void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info);

void StartTrackingHeapObjectsXDK(int stackDepth, bool retentions,
bool strict_collection = false);
/**
* @author amalyshe
*/
void GetHeapXDKStats(OutputStream* stream);
HeapEventXDK* StopTrackingHeapObjectsXDK();

private:
HeapProfiler();
~HeapProfiler();
Expand Down
54 changes: 0 additions & 54 deletions src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
#include "src/v8threads.h"
#include "src/version.h"
#include "src/vm-state-inl.h"
#include "src/xdk-allocation.h"

namespace v8 {

Expand Down Expand Up @@ -8179,10 +8178,6 @@ int CpuProfileNode::GetColumnNumber() const {
entry()->column_number();
}

int CpuProfileNode::GetSrcLine() const {
const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
return node->src_line();
}

unsigned int CpuProfileNode::GetHitLineCount() const {
const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
Expand Down Expand Up @@ -8424,41 +8419,6 @@ void HeapSnapshot::Delete() {
}
}

const char* HeapEventXDK::getSymbols() {
const i::HeapEventXDK* eventXDK =
reinterpret_cast<const i::HeapEventXDK*>(this);
return eventXDK->symbols();
}

const char* HeapEventXDK::getFrames() {
const i::HeapEventXDK* eventXDK =
reinterpret_cast<const i::HeapEventXDK*>(this);
return eventXDK->frames();
}

const char* HeapEventXDK::getTypes() {
const i::HeapEventXDK* eventXDK =
reinterpret_cast<const i::HeapEventXDK*>(this);
return eventXDK->types();
}

const char* HeapEventXDK::getChunks() {
const i::HeapEventXDK* eventXDK =
reinterpret_cast<const i::HeapEventXDK*>(this);
return eventXDK->chunks();
}

const char* HeapEventXDK::getRetentions() {
const i::HeapEventXDK* eventXDK =
reinterpret_cast<const i::HeapEventXDK*>(this);
return eventXDK->retentions();
}

unsigned int HeapEventXDK::getDuration() {
const i::HeapEventXDK* eventXDK =
reinterpret_cast<const i::HeapEventXDK*>(this);
return eventXDK->duration();
}

const HeapGraphNode* HeapSnapshot::GetRoot() const {
return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->root());
Expand Down Expand Up @@ -8577,20 +8537,6 @@ AllocationProfile* HeapProfiler::GetAllocationProfile() {
return reinterpret_cast<i::HeapProfiler*>(this)->GetAllocationProfile();
}

void HeapProfiler::GetHeapXDKStats(OutputStream* stream) {
reinterpret_cast<i::HeapProfiler*>(this)->PushHeapObjectsXDKStats(stream);
}

void HeapProfiler::StartTrackingHeapObjectsXDK(int stackDepth, bool retentions,
bool strict_collection) {
reinterpret_cast<i::HeapProfiler*>(this)->StartHeapObjectsTrackingXDK(
stackDepth, retentions, strict_collection);
}

HeapEventXDK* HeapProfiler::StopTrackingHeapObjectsXDK() {
return reinterpret_cast<HeapEventXDK*>(
reinterpret_cast<i::HeapProfiler*>(this)->StopHeapObjectsTrackingXDK());
}

void HeapProfiler::DeleteAllHeapSnapshots() {
reinterpret_cast<i::HeapProfiler*>(this)->DeleteAllSnapshots();
Expand Down
52 changes: 4 additions & 48 deletions src/profiler/heap-profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "src/profiler/allocation-tracker.h"
#include "src/profiler/heap-snapshot-generator-inl.h"
#include "src/profiler/sampling-heap-profiler.h"
#include "src/xdk-allocation.h"

namespace v8 {
namespace internal {
Expand Down Expand Up @@ -68,7 +67,7 @@ HeapSnapshot* HeapProfiler::TakeSnapshot(
v8::HeapProfiler::ObjectNameResolver* resolver) {
HeapSnapshot* result = new HeapSnapshot(this);
{
HeapSnapshotGenerator generator(this, result, control, resolver, heap());
HeapSnapshotGenerator generator(result, control, resolver, heap());
if (!generator.GenerateSnapshot()) {
delete result;
result = NULL;
Expand Down Expand Up @@ -138,42 +137,6 @@ void HeapProfiler::StopHeapObjectsTracking() {
}
}

void HeapProfiler::StartHeapObjectsTrackingXDK(int stackDepth, bool retentions,
bool strict_collection) {
ids_->UpdateHeapObjectsMap();
is_tracking_object_moves_ = true;
DCHECK(!is_tracking_allocations());
allocation_tracker_xdk_.Reset(
new XDKAllocationTracker(this, ids_.get(), names_.get(), stackDepth,
retentions, strict_collection));
heap()->DisableInlineAllocation();
// init pre collected objects
allocation_tracker_xdk_->CollectFreedObjects(false, true);
}

void HeapProfiler::PushHeapObjectsXDKStats(OutputStream* stream) {
// get the garbage here
if (!allocation_tracker_xdk_.is_empty()) {
allocation_tracker_xdk_->CollectFreedObjects();
OutputStream::WriteResult result =
allocation_tracker_xdk_->SendChunk(stream);
// TODO(amalyshe): it's interesting why CDT can return kAbort. Need to
// investigate if we need add better error generation in the
// allocation_tracker_xdk_->SendChunk
if (result == OutputStream::kAbort) return;
stream->EndOfStream();
}
}

v8::internal::HeapEventXDK* HeapProfiler::StopHeapObjectsTrackingXDK() {
HeapEventXDK* event = NULL;
if (!allocation_tracker_xdk_.is_empty()) {
event = allocation_tracker_xdk_->stopTracking();
allocation_tracker_xdk_.Reset(NULL);
heap()->EnableInlineAllocation();
}
return event;
}

size_t HeapProfiler::GetMemorySizeUsedByProfiler() {
size_t size = sizeof(*this);
Expand Down Expand Up @@ -206,13 +169,9 @@ SnapshotObjectId HeapProfiler::GetSnapshotObjectId(Handle<Object> obj) {

void HeapProfiler::ObjectMoveEvent(Address from, Address to, int size) {
base::LockGuard<base::Mutex> guard(&profiler_mutex_);
if (allocation_tracker_xdk_.is_empty()) {
bool known_object = ids_->MoveObject(from, to, size);
if (!known_object && !allocation_tracker_.is_empty()) {
allocation_tracker_->address_to_trace()->MoveObject(from, to, size);
}
} else {
allocation_tracker_xdk_->OnMove(from, to, size);
bool known_object = ids_->MoveObject(from, to, size);
if (!known_object && !allocation_tracker_.is_empty()) {
allocation_tracker_->address_to_trace()->MoveObject(from, to, size);
}
}

Expand All @@ -222,9 +181,6 @@ void HeapProfiler::AllocationEvent(Address addr, int size) {
if (!allocation_tracker_.is_empty()) {
allocation_tracker_->AllocationEvent(addr, size);
}
if (!allocation_tracker_xdk_.is_empty()) {
allocation_tracker_xdk_->OnAlloc(addr, size);
}
}


Expand Down
11 changes: 1 addition & 10 deletions src/profiler/heap-profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ class AllocationTracker;
class HeapObjectsMap;
class HeapSnapshot;
class SamplingHeapProfiler;
class HeapEventXDK;
class XDKAllocationTracker;
class StringsStorage;

class HeapProfiler {
Expand Down Expand Up @@ -47,11 +45,6 @@ class HeapProfiler {

SnapshotObjectId PushHeapObjectsStats(OutputStream* stream,
int64_t* timestamp_us);
void PushHeapObjectsXDKStats(OutputStream* stream);
void StartHeapObjectsTrackingXDK(int stackDepth, bool retentions,
bool strict_collection = false);
v8::internal::HeapEventXDK* StopHeapObjectsTrackingXDK();

int GetSnapshotsCount();
HeapSnapshot* GetSnapshot(int index);
SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj);
Expand All @@ -73,8 +66,7 @@ class HeapProfiler {

bool is_tracking_object_moves() const { return is_tracking_object_moves_; }
bool is_tracking_allocations() const {
return (!allocation_tracker_.is_empty() ||
!allocation_tracker_xdk_.is_empty());
return !allocation_tracker_.is_empty();
}

Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id);
Expand All @@ -91,7 +83,6 @@ class HeapProfiler {
base::SmartPointer<StringsStorage> names_;
List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_;
base::SmartPointer<AllocationTracker> allocation_tracker_;
base::SmartPointer<XDKAllocationTracker> allocation_tracker_xdk_;
bool is_tracking_object_moves_;
base::Mutex profiler_mutex_;
base::SmartPointer<SamplingHeapProfiler> sampling_heap_profiler_;
Expand Down
2 changes: 1 addition & 1 deletion src/profiler/heap-snapshot-generator-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ HeapSnapshot* HeapGraphEdge::snapshot() const {


int HeapEntry::index() const {
return static_cast<int>(this - &entries_->first());
return static_cast<int>(this - &snapshot_->entries().first());
}


Expand Down
Loading

0 comments on commit 78a7e24

Please sign in to comment.