summaryrefslogtreecommitdiff
path: root/chromium/v8/src/profiler
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-04-05 17:15:33 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-04-11 07:47:18 +0000
commit7324afb043a0b1e623d8e8eb906cdc53bdeb4685 (patch)
treea3fe2d74ea9c9e142c390dac4ca0e219382ace46 /chromium/v8/src/profiler
parent6a4cabb866f66d4128a97cdc6d9d08ce074f1247 (diff)
downloadqtwebengine-chromium-7324afb043a0b1e623d8e8eb906cdc53bdeb4685.tar.gz
BASELINE: Update Chromium to 58.0.3029.54
Change-Id: I67f57065a7afdc8e4614adb5c0230281428df4d1 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'chromium/v8/src/profiler')
-rw-r--r--chromium/v8/src/profiler/cpu-profiler.cc18
-rw-r--r--chromium/v8/src/profiler/cpu-profiler.h2
-rw-r--r--chromium/v8/src/profiler/heap-profiler.cc19
-rw-r--r--chromium/v8/src/profiler/heap-profiler.h6
-rw-r--r--chromium/v8/src/profiler/heap-snapshot-generator.cc118
-rw-r--r--chromium/v8/src/profiler/heap-snapshot-generator.h7
-rw-r--r--chromium/v8/src/profiler/profile-generator.cc15
-rw-r--r--chromium/v8/src/profiler/profile-generator.h3
-rw-r--r--chromium/v8/src/profiler/profiler-listener.cc1
-rw-r--r--chromium/v8/src/profiler/tracing-cpu-profiler.cc19
10 files changed, 127 insertions, 81 deletions
diff --git a/chromium/v8/src/profiler/cpu-profiler.cc b/chromium/v8/src/profiler/cpu-profiler.cc
index 6821ba64ca5..85f9d5e4753 100644
--- a/chromium/v8/src/profiler/cpu-profiler.cc
+++ b/chromium/v8/src/profiler/cpu-profiler.cc
@@ -277,6 +277,21 @@ void CpuProfiler::ResetProfiles() {
profiles_->set_cpu_profiler(this);
}
+void CpuProfiler::CreateEntriesForRuntimeCallStats() {
+ static_entries_.clear();
+ RuntimeCallStats* rcs = isolate_->counters()->runtime_call_stats();
+ CodeMap* code_map = generator_->code_map();
+ for (int i = 0; i < RuntimeCallStats::counters_count; ++i) {
+ RuntimeCallCounter* counter = &(rcs->*(RuntimeCallStats::counters[i]));
+ DCHECK(counter->name());
+ std::unique_ptr<CodeEntry> entry(
+ new CodeEntry(CodeEventListener::FUNCTION_TAG, counter->name(),
+ CodeEntry::kEmptyNamePrefix, "native V8Runtime"));
+ code_map->AddCode(reinterpret_cast<Address>(counter), entry.get(), 1);
+ static_entries_.push_back(std::move(entry));
+ }
+}
+
void CpuProfiler::CollectSample() {
if (processor_) {
processor_->AddCurrentStack(isolate_);
@@ -305,9 +320,10 @@ void CpuProfiler::StartProcessorIfNotStarted() {
// Disable logging when using the new implementation.
saved_is_logging_ = logger->is_logging_;
logger->is_logging_ = false;
- generator_.reset(new ProfileGenerator(isolate_, profiles_.get()));
+ generator_.reset(new ProfileGenerator(profiles_.get()));
processor_.reset(new ProfilerEventsProcessor(isolate_, generator_.get(),
sampling_interval_));
+ CreateEntriesForRuntimeCallStats();
logger->SetUpProfilerListener();
ProfilerListener* profiler_listener = logger->profiler_listener();
profiler_listener->AddObserver(this);
diff --git a/chromium/v8/src/profiler/cpu-profiler.h b/chromium/v8/src/profiler/cpu-profiler.h
index fa31754a6f6..a6872e49863 100644
--- a/chromium/v8/src/profiler/cpu-profiler.h
+++ b/chromium/v8/src/profiler/cpu-profiler.h
@@ -220,12 +220,14 @@ class CpuProfiler : public CodeEventObserver {
void StopProcessor();
void ResetProfiles();
void LogBuiltins();
+ void CreateEntriesForRuntimeCallStats();
Isolate* const isolate_;
base::TimeDelta sampling_interval_;
std::unique_ptr<CpuProfilesCollection> profiles_;
std::unique_ptr<ProfileGenerator> generator_;
std::unique_ptr<ProfilerEventsProcessor> processor_;
+ std::vector<std::unique_ptr<CodeEntry>> static_entries_;
bool saved_is_logging_;
bool is_profiling_;
diff --git a/chromium/v8/src/profiler/heap-profiler.cc b/chromium/v8/src/profiler/heap-profiler.cc
index 2df28a79588..938bb124243 100644
--- a/chromium/v8/src/profiler/heap-profiler.cc
+++ b/chromium/v8/src/profiler/heap-profiler.cc
@@ -6,6 +6,7 @@
#include "src/api.h"
#include "src/debug/debug.h"
+#include "src/heap/heap-inl.h"
#include "src/profiler/allocation-tracker.h"
#include "src/profiler/heap-snapshot-generator-inl.h"
#include "src/profiler/sampling-heap-profiler.h"
@@ -16,9 +17,8 @@ namespace internal {
HeapProfiler::HeapProfiler(Heap* heap)
: ids_(new HeapObjectsMap(heap)),
names_(new StringsStorage(heap)),
- is_tracking_object_moves_(false) {
-}
-
+ is_tracking_object_moves_(false),
+ get_retainer_infos_callback_(nullptr) {}
static void DeleteHeapSnapshot(HeapSnapshot** snapshot_ptr) {
delete *snapshot_ptr;
@@ -61,6 +61,19 @@ v8::RetainedObjectInfo* HeapProfiler::ExecuteWrapperClassCallback(
class_id, Utils::ToLocal(Handle<Object>(wrapper)));
}
+void HeapProfiler::SetGetRetainerInfosCallback(
+ v8::HeapProfiler::GetRetainerInfosCallback callback) {
+ get_retainer_infos_callback_ = callback;
+}
+
+v8::HeapProfiler::RetainerInfos HeapProfiler::GetRetainerInfos(
+ Isolate* isolate) {
+ v8::HeapProfiler::RetainerInfos infos;
+ if (get_retainer_infos_callback_ != nullptr)
+ infos =
+ get_retainer_infos_callback_(reinterpret_cast<v8::Isolate*>(isolate));
+ return infos;
+}
HeapSnapshot* HeapProfiler::TakeSnapshot(
v8::ActivityControl* control,
diff --git a/chromium/v8/src/profiler/heap-profiler.h b/chromium/v8/src/profiler/heap-profiler.h
index 3e1dcb54f97..a10cb9228fa 100644
--- a/chromium/v8/src/profiler/heap-profiler.h
+++ b/chromium/v8/src/profiler/heap-profiler.h
@@ -66,6 +66,11 @@ class HeapProfiler {
Object** wrapper);
void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info);
+ void SetGetRetainerInfosCallback(
+ v8::HeapProfiler::GetRetainerInfosCallback callback);
+
+ v8::HeapProfiler::RetainerInfos GetRetainerInfos(Isolate* isolate);
+
bool is_tracking_object_moves() const { return is_tracking_object_moves_; }
bool is_tracking_allocations() const { return !!allocation_tracker_; }
@@ -86,6 +91,7 @@ class HeapProfiler {
bool is_tracking_object_moves_;
base::Mutex profiler_mutex_;
std::unique_ptr<SamplingHeapProfiler> sampling_heap_profiler_;
+ v8::HeapProfiler::GetRetainerInfosCallback get_retainer_infos_callback_;
DISALLOW_COPY_AND_ASSIGN(HeapProfiler);
};
diff --git a/chromium/v8/src/profiler/heap-snapshot-generator.cc b/chromium/v8/src/profiler/heap-snapshot-generator.cc
index fbb4e973d61..b7b97a83201 100644
--- a/chromium/v8/src/profiler/heap-snapshot-generator.cc
+++ b/chromium/v8/src/profiler/heap-snapshot-generator.cc
@@ -4,13 +4,20 @@
#include "src/profiler/heap-snapshot-generator.h"
+#include <utility>
+
+#include "src/api.h"
#include "src/code-stubs.h"
#include "src/conversions.h"
#include "src/debug/debug.h"
+#include "src/layout-descriptor.h"
#include "src/objects-body-descriptors.h"
+#include "src/objects-inl.h"
#include "src/profiler/allocation-tracker.h"
#include "src/profiler/heap-profiler.h"
#include "src/profiler/heap-snapshot-generator-inl.h"
+#include "src/prototype.h"
+#include "src/transitions.h"
namespace v8 {
namespace internal {
@@ -152,7 +159,6 @@ const char* HeapEntry::TypeAsString() {
case kConsString: return "/concatenated string/";
case kSlicedString: return "/sliced string/";
case kSymbol: return "/symbol/";
- case kSimdValue: return "/simd/";
default: return "???";
}
}
@@ -836,8 +842,6 @@ HeapEntry* V8HeapExplorer::AddEntry(HeapObject* object) {
return AddEntry(object, HeapEntry::kArray, "");
} else if (object->IsHeapNumber()) {
return AddEntry(object, HeapEntry::kHeapNumber, "number");
- } else if (object->IsSimd128Value()) {
- return AddEntry(object, HeapEntry::kSimdValue, "simd");
}
return AddEntry(object, HeapEntry::kHidden, GetSystemEntryName(object));
}
@@ -1032,8 +1036,6 @@ bool V8HeapExplorer::ExtractReferencesPass1(int entry, HeapObject* obj) {
ExtractAccessorPairReferences(entry, AccessorPair::cast(obj));
} else if (obj->IsCode()) {
ExtractCodeReferences(entry, Code::cast(obj));
- } else if (obj->IsBox()) {
- ExtractBoxReferences(entry, Box::cast(obj));
} else if (obj->IsCell()) {
ExtractCellReferences(entry, Cell::cast(obj));
} else if (obj->IsWeakCell()) {
@@ -1110,9 +1112,11 @@ void V8HeapExplorer::ExtractJSObjectReferences(
}
}
SharedFunctionInfo* shared_info = js_fun->shared();
- TagObject(js_fun->literals(), "(function literals)");
- SetInternalReference(js_fun, entry, "literals", js_fun->literals(),
- JSFunction::kLiteralsOffset);
+ TagObject(js_fun->feedback_vector_cell(),
+ "(function feedback vector cell)");
+ SetInternalReference(js_fun, entry, "feedback_vector_cell",
+ js_fun->feedback_vector_cell(),
+ JSFunction::kFeedbackVectorOffset);
TagObject(shared_info, "(shared function info)");
SetInternalReference(js_fun, entry,
"shared", shared_info,
@@ -1165,6 +1169,10 @@ void V8HeapExplorer::ExtractStringReferences(int entry, String* string) {
SlicedString* ss = SlicedString::cast(string);
SetInternalReference(ss, entry, "parent", ss->parent(),
SlicedString::kParentOffset);
+ } else if (string->IsThinString()) {
+ ThinString* ts = ThinString::cast(string);
+ SetInternalReference(ts, entry, "actual", ts->actual(),
+ ThinString::kActualOffset);
}
}
@@ -1447,10 +1455,6 @@ void V8HeapExplorer::ExtractCodeReferences(int entry, Code* code) {
Code::kGCMetadataOffset);
}
-void V8HeapExplorer::ExtractBoxReferences(int entry, Box* box) {
- SetInternalReference(box, entry, "value", box->value(), Box::kValueOffset);
-}
-
void V8HeapExplorer::ExtractCellReferences(int entry, Cell* cell) {
SetInternalReference(cell, entry, "value", cell->value(), Cell::kValueOffset);
}
@@ -1819,7 +1823,6 @@ bool V8HeapExplorer::IsEssentialObject(Object* object) {
object != heap_->empty_byte_array() &&
object != heap_->empty_fixed_array() &&
object != heap_->empty_descriptor_array() &&
- object != heap_->empty_type_feedback_vector() &&
object != heap_->fixed_array_map() && object != heap_->cell_map() &&
object != heap_->global_property_cell_map() &&
object != heap_->shared_function_info_map() &&
@@ -2283,55 +2286,52 @@ int NativeObjectsExplorer::EstimateObjectsCount() {
void NativeObjectsExplorer::FillRetainedObjects() {
if (embedder_queried_) return;
- Isolate* isolate = isolate_;
- const GCType major_gc_type = kGCTypeMarkSweepCompact;
- // Record objects that are joined into ObjectGroups.
- isolate->heap()->CallGCPrologueCallbacks(
- major_gc_type, kGCCallbackFlagConstructRetainedObjectInfos);
- List<ObjectGroup*>* groups = isolate->global_handles()->object_groups();
- for (int i = 0; i < groups->length(); ++i) {
- ObjectGroup* group = groups->at(i);
- if (group->info == NULL) continue;
- List<HeapObject*>* list = GetListMaybeDisposeInfo(group->info);
- for (size_t j = 0; j < group->length; ++j) {
- HeapObject* obj = HeapObject::cast(*group->objects[j]);
- list->Add(obj);
- in_groups_.Insert(obj);
+ v8::HandleScope scope(reinterpret_cast<v8::Isolate*>(isolate_));
+ v8::HeapProfiler::RetainerInfos infos =
+ snapshot_->profiler()->GetRetainerInfos(isolate_);
+ for (auto& pair : infos.groups) {
+ List<HeapObject*>* list = GetListMaybeDisposeInfo(pair.first);
+ for (auto& persistent : pair.second) {
+ if (persistent->IsEmpty()) continue;
+
+ Handle<Object> object = v8::Utils::OpenHandle(
+ *persistent->Get(reinterpret_cast<v8::Isolate*>(isolate_)));
+ DCHECK(!object.is_null());
+ HeapObject* heap_object = HeapObject::cast(*object);
+ list->Add(heap_object);
+ in_groups_.Insert(heap_object);
}
- group->info = NULL; // Acquire info object ownership.
}
- isolate->global_handles()->RemoveObjectGroups();
- isolate->heap()->CallGCEpilogueCallbacks(major_gc_type, kNoGCCallbackFlags);
+
// Record objects that are not in ObjectGroups, but have class ID.
GlobalHandlesExtractor extractor(this);
- isolate->global_handles()->IterateAllRootsWithClassIds(&extractor);
+ isolate_->global_handles()->IterateAllRootsWithClassIds(&extractor);
+
+ edges_ = std::move(infos.edges);
embedder_queried_ = true;
}
+void NativeObjectsExplorer::FillEdges() {
+ v8::HandleScope scope(reinterpret_cast<v8::Isolate*>(isolate_));
+ // Fill in actual edges found.
+ for (auto& pair : edges_) {
+ if (pair.first->IsEmpty() || pair.second->IsEmpty()) continue;
-void NativeObjectsExplorer::FillImplicitReferences() {
- Isolate* isolate = isolate_;
- List<ImplicitRefGroup*>* groups =
- isolate->global_handles()->implicit_ref_groups();
- for (int i = 0; i < groups->length(); ++i) {
- ImplicitRefGroup* group = groups->at(i);
- HeapObject* parent = *group->parent;
+ Handle<Object> parent_object = v8::Utils::OpenHandle(
+ *pair.first->Get(reinterpret_cast<v8::Isolate*>(isolate_)));
+ HeapObject* parent = HeapObject::cast(*parent_object);
int parent_entry =
filler_->FindOrAddEntry(parent, native_entries_allocator_)->index();
DCHECK(parent_entry != HeapEntry::kNoEntry);
- Object*** children = group->children;
- for (size_t j = 0; j < group->length; ++j) {
- Object* child = *children[j];
- HeapEntry* child_entry =
- filler_->FindOrAddEntry(child, native_entries_allocator_);
- filler_->SetNamedReference(
- HeapGraphEdge::kInternal,
- parent_entry,
- "native",
- child_entry);
- }
+ Handle<Object> child_object = v8::Utils::OpenHandle(
+ *pair.second->Get(reinterpret_cast<v8::Isolate*>(isolate_)));
+ HeapObject* child = HeapObject::cast(*child_object);
+ HeapEntry* child_entry =
+ filler_->FindOrAddEntry(child, native_entries_allocator_);
+ filler_->SetNamedReference(HeapGraphEdge::kInternal, parent_entry, "native",
+ child_entry);
}
- isolate->global_handles()->RemoveImplicitRefGroups();
+ edges_.clear();
}
List<HeapObject*>* NativeObjectsExplorer::GetListMaybeDisposeInfo(
@@ -2351,7 +2351,7 @@ bool NativeObjectsExplorer::IterateAndExtractReferences(
SnapshotFiller* filler) {
filler_ = filler;
FillRetainedObjects();
- FillImplicitReferences();
+ FillEdges();
if (EstimateObjectsCount() > 0) {
for (base::HashMap::Entry* p = objects_by_info_.Start(); p != NULL;
p = objects_by_info_.Next(p)) {
@@ -2488,6 +2488,20 @@ HeapSnapshotGenerator::HeapSnapshotGenerator(
heap_(heap) {
}
+namespace {
+class NullContextScope {
+ public:
+ explicit NullContextScope(Isolate* isolate)
+ : isolate_(isolate), prev_(isolate->context()) {
+ isolate_->set_context(nullptr);
+ }
+ ~NullContextScope() { isolate_->set_context(prev_); }
+
+ private:
+ Isolate* isolate_;
+ Context* prev_;
+};
+} // namespace
bool HeapSnapshotGenerator::GenerateSnapshot() {
v8_heap_explorer_.TagGlobalObjects();
@@ -2501,6 +2515,8 @@ bool HeapSnapshotGenerator::GenerateSnapshot() {
heap_->CollectAllGarbage(Heap::kMakeHeapIterableMask,
GarbageCollectionReason::kHeapProfiler);
+ NullContextScope null_context_scope(heap_->isolate());
+
#ifdef VERIFY_HEAP
Heap* debug_heap = heap_;
if (FLAG_verify_heap) {
diff --git a/chromium/v8/src/profiler/heap-snapshot-generator.h b/chromium/v8/src/profiler/heap-snapshot-generator.h
index b4de8b57e12..022f238cc54 100644
--- a/chromium/v8/src/profiler/heap-snapshot-generator.h
+++ b/chromium/v8/src/profiler/heap-snapshot-generator.h
@@ -92,8 +92,7 @@ class HeapEntry BASE_EMBEDDED {
kSynthetic = v8::HeapGraphNode::kSynthetic,
kConsString = v8::HeapGraphNode::kConsString,
kSlicedString = v8::HeapGraphNode::kSlicedString,
- kSymbol = v8::HeapGraphNode::kSymbol,
- kSimdValue = v8::HeapGraphNode::kSimdValue
+ kSymbol = v8::HeapGraphNode::kSymbol
};
static const int kNoEntry;
@@ -386,7 +385,6 @@ class V8HeapExplorer : public HeapEntriesAllocator {
void ExtractAccessorInfoReferences(int entry, AccessorInfo* accessor_info);
void ExtractAccessorPairReferences(int entry, AccessorPair* accessors);
void ExtractCodeReferences(int entry, Code* code);
- void ExtractBoxReferences(int entry, Box* box);
void ExtractCellReferences(int entry, Cell* cell);
void ExtractWeakCellReferences(int entry, WeakCell* weak_cell);
void ExtractPropertyCellReferences(int entry, PropertyCell* cell);
@@ -496,7 +494,7 @@ class NativeObjectsExplorer {
private:
void FillRetainedObjects();
- void FillImplicitReferences();
+ void FillEdges();
List<HeapObject*>* GetListMaybeDisposeInfo(v8::RetainedObjectInfo* info);
void SetNativeRootReference(v8::RetainedObjectInfo* info);
void SetRootNativeRootsReference();
@@ -532,6 +530,7 @@ class NativeObjectsExplorer {
HeapEntriesAllocator* native_entries_allocator_;
// Used during references extraction.
SnapshotFiller* filler_;
+ v8::HeapProfiler::RetainerEdges edges_;
static HeapThing const kNativesRootObject;
diff --git a/chromium/v8/src/profiler/profile-generator.cc b/chromium/v8/src/profiler/profile-generator.cc
index 72e02b360b2..742d3683901 100644
--- a/chromium/v8/src/profiler/profile-generator.cc
+++ b/chromium/v8/src/profiler/profile-generator.cc
@@ -8,6 +8,7 @@
#include "src/debug/debug.h"
#include "src/deoptimizer.h"
#include "src/global-handles.h"
+#include "src/objects-inl.h"
#include "src/profiler/cpu-profiler.h"
#include "src/profiler/profile-generator-inl.h"
#include "src/tracing/trace-event.h"
@@ -635,18 +636,8 @@ void CpuProfilesCollection::AddPathToCurrentProfiles(
current_profiles_semaphore_.Signal();
}
-ProfileGenerator::ProfileGenerator(Isolate* isolate,
- CpuProfilesCollection* profiles)
- : isolate_(isolate), profiles_(profiles) {
- RuntimeCallStats* rcs = isolate_->counters()->runtime_call_stats();
- for (int i = 0; i < RuntimeCallStats::counters_count; ++i) {
- RuntimeCallCounter* counter = &(rcs->*(RuntimeCallStats::counters[i]));
- DCHECK(counter->name());
- auto entry = new CodeEntry(CodeEventListener::FUNCTION_TAG, counter->name(),
- CodeEntry::kEmptyNamePrefix, "native V8Runtime");
- code_map_.AddCode(reinterpret_cast<Address>(counter), entry, 1);
- }
-}
+ProfileGenerator::ProfileGenerator(CpuProfilesCollection* profiles)
+ : profiles_(profiles) {}
void ProfileGenerator::RecordTickSample(const TickSample& sample) {
std::vector<CodeEntry*> entries;
diff --git a/chromium/v8/src/profiler/profile-generator.h b/chromium/v8/src/profiler/profile-generator.h
index 1b3cad6dc3e..c108fbd61b8 100644
--- a/chromium/v8/src/profiler/profile-generator.h
+++ b/chromium/v8/src/profiler/profile-generator.h
@@ -368,7 +368,7 @@ class CpuProfilesCollection {
class ProfileGenerator {
public:
- ProfileGenerator(Isolate* isolate, CpuProfilesCollection* profiles);
+ explicit ProfileGenerator(CpuProfilesCollection* profiles);
void RecordTickSample(const TickSample& sample);
@@ -378,7 +378,6 @@ class ProfileGenerator {
CodeEntry* FindEntry(void* address);
CodeEntry* EntryForVMState(StateTag tag);
- Isolate* isolate_;
CpuProfilesCollection* profiles_;
CodeMap code_map_;
diff --git a/chromium/v8/src/profiler/profiler-listener.cc b/chromium/v8/src/profiler/profiler-listener.cc
index 4de524aeef5..bacfffaa730 100644
--- a/chromium/v8/src/profiler/profiler-listener.cc
+++ b/chromium/v8/src/profiler/profiler-listener.cc
@@ -5,6 +5,7 @@
#include "src/profiler/profiler-listener.h"
#include "src/deoptimizer.h"
+#include "src/objects-inl.h"
#include "src/profiler/cpu-profiler.h"
#include "src/profiler/profile-generator-inl.h"
#include "src/source-position-table.h"
diff --git a/chromium/v8/src/profiler/tracing-cpu-profiler.cc b/chromium/v8/src/profiler/tracing-cpu-profiler.cc
index 8b312259050..a9b84b66345 100644
--- a/chromium/v8/src/profiler/tracing-cpu-profiler.cc
+++ b/chromium/v8/src/profiler/tracing-cpu-profiler.cc
@@ -8,9 +8,6 @@
#include "src/tracing/trace-event.h"
#include "src/v8.h"
-#define PROFILER_TRACE_CATEGORY_ENABLED(cat) \
- (*TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT(cat)))
-
namespace v8 {
std::unique_ptr<TracingCpuProfiler> TracingCpuProfiler::Create(
@@ -25,8 +22,9 @@ namespace internal {
TracingCpuProfilerImpl::TracingCpuProfilerImpl(Isolate* isolate)
: isolate_(isolate), profiling_enabled_(false) {
// Make sure tracing system notices profiler categories.
- PROFILER_TRACE_CATEGORY_ENABLED("v8.cpu_profiler");
- PROFILER_TRACE_CATEGORY_ENABLED("v8.cpu_profiler.hires");
+ TRACE_EVENT_WARMUP_CATEGORY(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler"));
+ TRACE_EVENT_WARMUP_CATEGORY(
+ TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler.hires"));
V8::GetCurrentPlatform()->AddTraceStateObserver(this);
}
@@ -36,7 +34,10 @@ TracingCpuProfilerImpl::~TracingCpuProfilerImpl() {
}
void TracingCpuProfilerImpl::OnTraceEnabled() {
- if (!PROFILER_TRACE_CATEGORY_ENABLED("v8.cpu_profiler")) return;
+ bool enabled;
+ TRACE_EVENT_CATEGORY_GROUP_ENABLED(
+ TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler"), &enabled);
+ if (!enabled) return;
profiling_enabled_ = true;
isolate_->RequestInterrupt(
[](v8::Isolate*, void* data) {
@@ -59,8 +60,10 @@ void TracingCpuProfilerImpl::OnTraceDisabled() {
void TracingCpuProfilerImpl::StartProfiling() {
base::LockGuard<base::Mutex> lock(&mutex_);
if (!profiling_enabled_ || profiler_) return;
- int sampling_interval_us =
- PROFILER_TRACE_CATEGORY_ENABLED("v8.cpu_profiler.hires") ? 100 : 1000;
+ bool enabled;
+ TRACE_EVENT_CATEGORY_GROUP_ENABLED(
+ TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler.hires"), &enabled);
+ int sampling_interval_us = enabled ? 100 : 1000;
profiler_.reset(new CpuProfiler(isolate_));
profiler_->set_sampling_interval(
base::TimeDelta::FromMicroseconds(sampling_interval_us));