From 4e54260cdcf7b05c4d3e2bc51bcb54446cfd4d13 Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Mon, 20 Jun 2016 13:12:54 +0200 Subject: [PATCH] Adjust coding style in files touched by e236921. 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. --- src/api.cc | 5 +- src/profiler/heap-snapshot-generator.cc | 72 +++++++++---------------- src/profiler/heap-snapshot-generator.h | 11 ++-- src/profiler/profile-generator-inl.h | 2 - test/cctest/test-cpu-profiler.cc | 5 -- 5 files changed, 31 insertions(+), 64 deletions(-) diff --git a/src/api.cc b/src/api.cc index 853bd50f219..268a3b530f3 100644 --- a/src/api.cc +++ b/src/api.cc @@ -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" @@ -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)) diff --git a/src/profiler/heap-snapshot-generator.cc b/src/profiler/heap-snapshot-generator.cc index 748f3074a19..77029fe9c01 100644 --- a/src/profiler/heap-snapshot-generator.cc +++ b/src/profiler/heap-snapshot-generator.cc @@ -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), @@ -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, @@ -776,20 +772,16 @@ void HeapObjectsSet::SetTag(Object* obj, const char* tag) { cache_entry->value = const_cast(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() { } @@ -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()); @@ -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()); } @@ -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)); } @@ -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_; @@ -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()), @@ -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(); @@ -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); } diff --git a/src/profiler/heap-snapshot-generator.h b/src/profiler/heap-snapshot-generator.h index 857f2401bf0..025d6d93908 100644 --- a/src/profiler/heap-snapshot-generator.h +++ b/src/profiler/heap-snapshot-generator.h @@ -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_); } @@ -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(); diff --git a/src/profiler/profile-generator-inl.h b/src/profiler/profile-generator-inl.h index 85edce2663b..15f43a3b01e 100644 --- a/src/profiler/profile-generator-inl.h +++ b/src/profiler/profile-generator-inl.h @@ -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), @@ -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); } diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc index 24c84c3df82..660c73def33 100644 --- a/test/cctest/test-cpu-profiler.cc +++ b/test/cctest/test-cpu-profiler.cc @@ -439,7 +439,6 @@ static v8::CpuProfile* RunProfiler(v8::Local env, return profile; } - static const v8::CpuProfileNode* FindChild(v8::Local context, const v8::CpuProfileNode* node, const char* name) { @@ -454,7 +453,6 @@ static const v8::CpuProfileNode* FindChild(v8::Local context, return NULL; } - static const v8::CpuProfileNode* GetChild(v8::Local context, const v8::CpuProfileNode* node, const char* name) { @@ -468,7 +466,6 @@ static const v8::CpuProfileNode* GetChild(v8::Local context, return result; } - static void CheckSimpleBranch(v8::Local context, const v8::CpuProfileNode* node, const char* names[], int length) { @@ -478,7 +475,6 @@ static void CheckSimpleBranch(v8::Local context, } } - static const ProfileNode* GetSimpleBranch(v8::Local context, v8::CpuProfile* profile, const char* names[], int length) { @@ -1668,7 +1664,6 @@ TEST(FunctionDetails) { script_a->GetUnboundScript()->GetId(), 5, 14); } - TEST(DontStopOnFinishedProfileDelete) { v8::HandleScope scope(CcTest::isolate()); v8::Local env = CcTest::NewContext(PROFILER_EXTENSION);