V8 Project
v8::internal::TickSample Struct Reference

#include <sampler.h>

+ Collaboration diagram for v8::internal::TickSample:

Public Member Functions

 TickSample ()
 
void Init (Isolate *isolate, const RegisterState &state)
 

Public Attributes

StateTag state
 
Address pc
 
union {
   Address   tos
 
   Address   external_callback
 
}; 
 
Address stack [kMaxFramesCount]
 
base::TimeTicks timestamp
 
unsigned frames_count: kMaxFramesCountLog2
 
bool has_external_callback: 1
 
StackFrame::Type top_frame_type: 4
 

Static Public Attributes

static const unsigned kMaxFramesCountLog2 = 8
 
static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1
 

Detailed Description

Definition at line 32 of file sampler.h.

Constructor & Destructor Documentation

◆ TickSample()

v8::internal::TickSample::TickSample ( )
inline

Definition at line 33 of file sampler.h.

34  : state(OTHER),
35  pc(NULL),
37  frames_count(0),
38  has_external_callback(false),
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
@ NONE
Address external_callback
Definition: sampler.h:45
StackFrame::Type top_frame_type
Definition: sampler.h:53

Member Function Documentation

◆ Init()

DISABLE_ASAN void v8::internal::TickSample::Init ( Isolate isolate,
const RegisterState state 
)

Definition at line 579 of file sampler.cc.

580  {
581  DCHECK(isolate->IsInitialized());
582  timestamp = base::TimeTicks::HighResolutionNow();
583  pc = regs.pc;
584  state = isolate->current_vm_state();
585 
586  // Avoid collecting traces while doing GC.
587  if (state == GC) return;
588 
589  Address js_entry_sp = isolate->js_entry_sp();
590  if (js_entry_sp == 0) {
591  // Not executing JS now.
592  return;
593  }
594 
595  ExternalCallbackScope* scope = isolate->external_callback_scope();
596  Address handler = Isolate::handler(isolate->thread_local_top());
597  // If there is a handler on top of the external callback scope then
598  // we have already entrered JavaScript again and the external callback
599  // is not the top function.
600  if (scope && scope->scope_address() < handler) {
601  external_callback = scope->callback();
602  has_external_callback = true;
603  } else {
604  // Sample potential return address value for frameless invocation of
605  // stubs (we'll figure out later, if this value makes sense).
606  tos = Memory::Address_at(regs.sp);
607  has_external_callback = false;
608  }
609 
610  SafeStackFrameIterator it(isolate, regs.fp, regs.sp, js_entry_sp);
611  top_frame_type = it.top_frame_type();
612  unsigned i = 0;
613  while (!it.done() && i < TickSample::kMaxFramesCount) {
614  stack[i++] = it.frame()->pc();
615  it.Advance();
616  }
617  frames_count = i;
618 }
static Address handler(ThreadLocalTop *thread)
Definition: isolate.h:650
static Address & Address_at(Address addr)
Definition: v8memory.h:56
#define DCHECK(condition)
Definition: logging.h:205
byte * Address
Definition: globals.h:101
base::TimeTicks timestamp
Definition: sampler.h:50
Address stack[kMaxFramesCount]
Definition: sampler.h:49
static const unsigned kMaxFramesCount
Definition: sampler.h:48

References v8::internal::Memory::Address_at(), v8::internal::SafeStackFrameIterator::Advance(), DCHECK, external_callback, v8::internal::RegisterState::fp, v8::internal::SafeStackFrameIterator::frame(), frames_count, v8::internal::GC, v8::internal::Isolate::handler(), has_external_callback, v8::internal::Isolate::IsInitialized(), v8::internal::Isolate::js_entry_sp(), kMaxFramesCount, v8::internal::RegisterState::pc, pc, v8::internal::RegisterState::sp, stack, state, v8::internal::Isolate::thread_local_top(), timestamp, v8::internal::SafeStackFrameIterator::top_frame_type(), top_frame_type, and tos.

Referenced by v8::internal::ProfilerEventsProcessor::AddCurrentStack(), and v8::internal::Sampler::SampleStack().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ 

union { ... }

◆ external_callback

Address v8::internal::TickSample::external_callback

◆ frames_count

unsigned v8::internal::TickSample::frames_count

◆ has_external_callback

bool v8::internal::TickSample::has_external_callback

◆ kMaxFramesCount

const unsigned v8::internal::TickSample::kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1
static

Definition at line 48 of file sampler.h.

Referenced by Init().

◆ kMaxFramesCountLog2

const unsigned v8::internal::TickSample::kMaxFramesCountLog2 = 8
static

Definition at line 47 of file sampler.h.

◆ pc

Address v8::internal::TickSample::pc

◆ stack

Address v8::internal::TickSample::stack[kMaxFramesCount]

◆ state

◆ timestamp

base::TimeTicks v8::internal::TickSample::timestamp

Definition at line 50 of file sampler.h.

Referenced by Init(), and v8::internal::ProfileGenerator::RecordTickSample().

◆ top_frame_type

StackFrame::Type v8::internal::TickSample::top_frame_type

Definition at line 53 of file sampler.h.

Referenced by Init(), and v8::internal::ProfileGenerator::RecordTickSample().

◆ tos

Address v8::internal::TickSample::tos

Definition at line 44 of file sampler.h.

Referenced by Init(), and v8::internal::Logger::TickEvent().


The documentation for this struct was generated from the following files: