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

Commit

Permalink
Adjust coding style in files touched by e236921.
Browse files Browse the repository at this point in the history
The presubmit hooks fail even though the original upstream files are not
compliant. Run `git-cl format v8` to make the coding style checks pass.
This commit was not squashed into e236921 (Revert "XDK Heap Profiler
collector and XDK CPUProfiler") to make it easier for future rebases to
skip this change if necessary.
  • Loading branch information
Raphael Kubo da Costa committed Jun 20, 2016
1 parent e236921 commit 4e54260
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 64 deletions.
5 changes: 2 additions & 3 deletions src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@
#include "src/profiler/heap-snapshot-generator-inl.h"
#include "src/profiler/profile-generator-inl.h"
#include "src/profiler/sampler.h"
#include "src/property.h"
#include "src/property-descriptor.h"
#include "src/property-details.h"
#include "src/property.h"
#include "src/prototype.h"
#include "src/runtime/runtime.h"
#include "src/runtime-profiler.h"
#include "src/runtime/runtime.h"
#include "src/simulator.h"
#include "src/snapshot/natives.h"
#include "src/snapshot/snapshot.h"
Expand All @@ -66,7 +66,6 @@
#include "src/version.h"
#include "src/vm-state-inl.h"


namespace v8 {

#define LOG_API(isolate, expr) LOG(isolate, ApiEntryCall(expr))
Expand Down
72 changes: 26 additions & 46 deletions src/profiler/heap-snapshot-generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,8 @@ void HeapGraphEdge::ReplaceToIndexWithEntry(HeapSnapshot* snapshot) {

const int HeapEntry::kNoEntry = -1;

HeapEntry::HeapEntry(HeapSnapshot* snapshot,
Type type,
const char* name,
SnapshotObjectId id,
size_t self_size,
HeapEntry::HeapEntry(HeapSnapshot* snapshot, Type type, const char* name,
SnapshotObjectId id, size_t self_size,
unsigned trace_node_id)
: type_(type),
children_count_(0),
Expand All @@ -56,8 +53,7 @@ HeapEntry::HeapEntry(HeapSnapshot* snapshot,
snapshot_(snapshot),
name_(name),
id_(id),
trace_node_id_(trace_node_id) { }

trace_node_id_(trace_node_id) {}

void HeapEntry::SetNamedReference(HeapGraphEdge::Type type,
const char* name,
Expand Down Expand Up @@ -776,20 +772,16 @@ void HeapObjectsSet::SetTag(Object* obj, const char* tag) {
cache_entry->value = const_cast<char*>(tag);
}


V8HeapExplorer::V8HeapExplorer(
HeapSnapshot* snapshot,
SnapshottingProgressReportingInterface* progress,
v8::HeapProfiler::ObjectNameResolver* resolver)
V8HeapExplorer::V8HeapExplorer(HeapSnapshot* snapshot,
SnapshottingProgressReportingInterface* progress,
v8::HeapProfiler::ObjectNameResolver* resolver)
: heap_(snapshot->profiler()->heap_object_map()->heap()),
snapshot_(snapshot),
names_(snapshot_->profiler()->names()),
heap_object_map_(snapshot_->profiler()->heap_object_map()),
progress_(progress),
filler_(NULL),
global_object_name_resolver_(resolver) {
}

global_object_name_resolver_(resolver) {}

V8HeapExplorer::~V8HeapExplorer() {
}
Expand Down Expand Up @@ -893,13 +885,12 @@ HeapEntry* V8HeapExplorer::AddEntry(Address address,
return snapshot_->AddEntry(type, name, object_id, size, trace_node_id);
}


class SnapshotFiller {
public:
explicit SnapshotFiller(HeapSnapshot* snapshot, HeapEntriesMap* entries)
: snapshot_(snapshot),
names_(snapshot->profiler()->names()),
entries_(entries) { }
entries_(entries) {}
HeapEntry* AddEntry(HeapThing ptr, HeapEntriesAllocator* allocator) {
HeapEntry* entry = allocator->AllocateEntry(ptr);
entries_->Pair(ptr, entry->index());
Expand Down Expand Up @@ -2063,10 +2054,9 @@ void V8HeapExplorer::SetPropertyReference(HeapObject* parent_obj,


void V8HeapExplorer::SetRootGcRootsReference() {
filler_->SetIndexedAutoIndexReference(
HeapGraphEdge::kElement,
snapshot_->root()->index(),
snapshot_->gc_roots());
filler_->SetIndexedAutoIndexReference(HeapGraphEdge::kElement,
snapshot_->root()->index(),
snapshot_->gc_roots());
}


Expand All @@ -2081,10 +2071,9 @@ void V8HeapExplorer::SetUserGlobalReference(Object* child_obj) {


void V8HeapExplorer::SetGcRootsReference(VisitorSynchronization::SyncTag tag) {
filler_->SetIndexedAutoIndexReference(
HeapGraphEdge::kElement,
snapshot_->gc_roots()->index(),
snapshot_->gc_subroot(tag));
filler_->SetIndexedAutoIndexReference(HeapGraphEdge::kElement,
snapshot_->gc_roots()->index(),
snapshot_->gc_subroot(tag));
}


Expand Down Expand Up @@ -2240,14 +2229,12 @@ class GlobalHandlesExtractor : public ObjectVisitor {

class BasicHeapEntriesAllocator : public HeapEntriesAllocator {
public:
BasicHeapEntriesAllocator(
HeapSnapshot* snapshot,
HeapEntry::Type entries_type)
: snapshot_(snapshot),
names_(snapshot_->profiler()->names()),
heap_object_map_(snapshot_->profiler()->heap_object_map()),
entries_type_(entries_type) {
}
BasicHeapEntriesAllocator(HeapSnapshot* snapshot,
HeapEntry::Type entries_type)
: snapshot_(snapshot),
names_(snapshot_->profiler()->names()),
heap_object_map_(snapshot_->profiler()->heap_object_map()),
entries_type_(entries_type) {}
virtual HeapEntry* AllocateEntry(HeapThing ptr);
private:
HeapSnapshot* snapshot_;
Expand All @@ -2273,10 +2260,8 @@ HeapEntry* BasicHeapEntriesAllocator::AllocateEntry(HeapThing ptr) {
0);
}


NativeObjectsExplorer::NativeObjectsExplorer(
HeapSnapshot* snapshot,
SnapshottingProgressReportingInterface* progress)
HeapSnapshot* snapshot, SnapshottingProgressReportingInterface* progress)
: isolate_(snapshot->profiler()->heap_object_map()->heap()->isolate()),
snapshot_(snapshot),
names_(snapshot_->profiler()->names()),
Expand Down Expand Up @@ -2515,19 +2500,14 @@ void NativeObjectsExplorer::VisitSubtreeWrapper(Object** p, uint16_t class_id) {
GetListMaybeDisposeInfo(info)->Add(HeapObject::cast(*p));
}


HeapSnapshotGenerator::HeapSnapshotGenerator(
HeapSnapshot* snapshot,
v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver,
Heap* heap)
HeapSnapshot* snapshot, v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver, Heap* heap)
: snapshot_(snapshot),
control_(control),
v8_heap_explorer_(snapshot_, this, resolver),
dom_explorer_(snapshot_, this),
heap_(heap) {
}

heap_(heap) {}

bool HeapSnapshotGenerator::GenerateSnapshot() {
v8_heap_explorer_.TagGlobalObjects();
Expand Down Expand Up @@ -2600,8 +2580,8 @@ void HeapSnapshotGenerator::SetProgressTotal(int iterations_count) {

bool HeapSnapshotGenerator::FillReferences() {
SnapshotFiller filler(snapshot_, &entries_);
return v8_heap_explorer_.IterateAndExtractReferences(&filler)
&& dom_explorer_.IterateAndExtractReferences(&filler);
return v8_heap_explorer_.IterateAndExtractReferences(&filler) &&
dom_explorer_.IterateAndExtractReferences(&filler);
}


Expand Down
11 changes: 3 additions & 8 deletions src/profiler/heap-snapshot-generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,8 @@ class HeapEntry BASE_EMBEDDED {
static const int kNoEntry;

HeapEntry() { }
HeapEntry(HeapSnapshot* snapshot,
Type type,
const char* name,
SnapshotObjectId id,
size_t self_size,
unsigned trace_node_id);
HeapEntry(HeapSnapshot* snapshot, Type type, const char* name,
SnapshotObjectId id, size_t self_size, unsigned trace_node_id);

HeapSnapshot* snapshot() { return snapshot_; }
Type type() { return static_cast<Type>(type_); }
Expand Down Expand Up @@ -539,8 +535,7 @@ class NativeObjectsExplorer {

class HeapSnapshotGenerator : public SnapshottingProgressReportingInterface {
public:
HeapSnapshotGenerator(HeapSnapshot* snapshot,
v8::ActivityControl* control,
HeapSnapshotGenerator(HeapSnapshot* snapshot, v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver,
Heap* heap);
bool GenerateSnapshot();
Expand Down
2 changes: 0 additions & 2 deletions src/profiler/profile-generator-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ CodeEntry::CodeEntry(Logger::LogEventsAndTags tag, const char* name,
line_info_(line_info),
instruction_start_(instruction_start) {}


ProfileNode::ProfileNode(ProfileTree* tree, CodeEntry* entry)
: tree_(tree),
entry_(entry),
Expand All @@ -38,7 +37,6 @@ ProfileNode::ProfileNode(ProfileTree* tree, CodeEntry* entry)
id_(tree->next_node_id()),
line_ticks_(LineTickMatch) {}


inline unsigned ProfileNode::function_id() const {
return tree_->GetFunctionId(this);
}
Expand Down
5 changes: 0 additions & 5 deletions test/cctest/test-cpu-profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,6 @@ static v8::CpuProfile* RunProfiler(v8::Local<v8::Context> env,
return profile;
}


static const v8::CpuProfileNode* FindChild(v8::Local<v8::Context> context,
const v8::CpuProfileNode* node,
const char* name) {
Expand All @@ -454,7 +453,6 @@ static const v8::CpuProfileNode* FindChild(v8::Local<v8::Context> context,
return NULL;
}


static const v8::CpuProfileNode* GetChild(v8::Local<v8::Context> context,
const v8::CpuProfileNode* node,
const char* name) {
Expand All @@ -468,7 +466,6 @@ static const v8::CpuProfileNode* GetChild(v8::Local<v8::Context> context,
return result;
}


static void CheckSimpleBranch(v8::Local<v8::Context> context,
const v8::CpuProfileNode* node,
const char* names[], int length) {
Expand All @@ -478,7 +475,6 @@ static void CheckSimpleBranch(v8::Local<v8::Context> context,
}
}


static const ProfileNode* GetSimpleBranch(v8::Local<v8::Context> context,
v8::CpuProfile* profile,
const char* names[], int length) {
Expand Down Expand Up @@ -1668,7 +1664,6 @@ TEST(FunctionDetails) {
script_a->GetUnboundScript()->GetId(), 5, 14);
}


TEST(DontStopOnFinishedProfileDelete) {
v8::HandleScope scope(CcTest::isolate());
v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION);
Expand Down

0 comments on commit 4e54260

Please sign in to comment.