@@ -43,6 +43,7 @@ Debug::Debug(Isolate* isolate)
4343 break_on_exception_(false ),
4444 break_on_uncaught_exception_(false ),
4545 debug_info_list_(NULL ),
46+ feature_tracker_(isolate),
4647 isolate_(isolate) {
4748 ThreadInit ();
4849}
@@ -316,6 +317,15 @@ Handle<Object> BreakLocation::BreakPointObjects() const {
316317}
317318
318319
320+ void DebugFeatureTracker::Track (DebugFeatureTracker::Feature feature) {
321+ uint32_t mask = 1 << feature;
322+ // Only count one sample per feature and isolate.
323+ if (bitfield_ & mask) return ;
324+ isolate_->counters ()->debug_feature_usage ()->AddSample (feature);
325+ bitfield_ |= mask;
326+ }
327+
328+
319329// Threading support.
320330void Debug::ThreadInit () {
321331 thread_local_.break_count_ = 0 ;
@@ -396,6 +406,9 @@ bool Debug::Load() {
396406
397407 debug_context_ = Handle<Context>::cast (
398408 isolate_->global_handles ()->Create (*context));
409+
410+ feature_tracker ()->Track (DebugFeatureTracker::kActive );
411+
399412 return true ;
400413}
401414
@@ -625,6 +638,8 @@ bool Debug::SetBreakPoint(Handle<JSFunction> function,
625638 *source_position = location.statement_position ();
626639 location.SetBreakPoint (break_point_object);
627640
641+ feature_tracker ()->Track (DebugFeatureTracker::kBreakPoint );
642+
628643 // At least one active break point now.
629644 return debug_info->GetBreakPointCount () > 0 ;
630645}
@@ -666,6 +681,8 @@ bool Debug::SetBreakPointForScript(Handle<Script> script,
666681 debug_info, ALL_BREAK_LOCATIONS, position, alignment);
667682 location.SetBreakPoint (break_point_object);
668683
684+ feature_tracker ()->Track (DebugFeatureTracker::kBreakPoint );
685+
669686 position = (alignment == STATEMENT_ALIGNED) ? location.statement_position ()
670687 : location.position ();
671688
@@ -874,6 +891,8 @@ void Debug::PrepareStep(StepAction step_action,
874891 JavaScriptFrameIterator frames_it (isolate_, id);
875892 JavaScriptFrame* frame = frames_it.frame ();
876893
894+ feature_tracker ()->Track (DebugFeatureTracker::kStepping );
895+
877896 // First of all ensure there is one-shot break points in the top handler
878897 // if any.
879898 FloodHandlerWithOneShot ();
0 commit comments