22 return strcmp(
reinterpret_cast<char*
>(key1),
23 reinterpret_cast<char*
>(key2)) == 0;
28 : hash_seed_(heap->HashSeed()), names_(StringsMatch) {
36 DeleteArray(
reinterpret_cast<const char*
>(p->value));
42 int len =
static_cast<int>(strlen(src));
43 HashMap::Entry* entry =
GetEntry(src, len);
44 if (entry->value ==
NULL) {
48 entry->key = dst.
start();
49 entry->value = entry->key;
51 return reinterpret_cast<const char*
>(entry->value);
57 va_start(args, format);
65 HashMap::Entry* entry =
GetEntry(str, len);
66 if (entry->value ==
NULL) {
73 return reinterpret_cast<const char*
>(entry->value);
89 if (
name->IsString()) {
92 int actual_length = 0;
97 }
else if (
name->IsSymbol()) {
120 size_t size =
sizeof(*this);
123 size += strlen(
reinterpret_cast<const char*
>(p->value)) + 1;
131 return names_.
Lookup(
const_cast<char*
>(str), hash,
true);
179 tag_ = Logger::BUILTIN_TAG;
185 HashMap::Entry* map_entry =
187 return map_entry !=
NULL ?
193 HashMap::Entry* map_entry =
195 if (map_entry->value ==
NULL) {
198 map_entry->value = new_node;
201 return reinterpret_cast<ProfileNode*
>(map_entry->value);
233 : root_entry_(
Logger::FUNCTION_TAG,
"(root)"),
248 entry != path.
start() - 1;
250 if (*entry !=
NULL) {
264 if (*entry !=
NULL) {
299 template <
typename Callback>
303 while (stack.length() > 0) {
305 if (current.has_current_child()) {
306 callback->BeforeTraversingChild(current.
node, current.current_child());
309 callback->AfterAllChildrenTraversed(current.
node);
310 if (stack.length() > 1) {
311 Position& parent = stack[stack.length() - 2];
312 callback->AfterChildTraversed(parent.
node, current.
node);
324 record_samples_(record_samples),
325 start_time_(base::TimeTicks::HighResolutionNow()) {
340 end_time_ = base::TimeTicks::HighResolutionNow();
356 CodeTree::Locator locator;
365 while (addr >= start) {
366 CodeTree::Locator locator;
368 Address start2 = locator.key(), end2 = start2 + locator.value().size;
369 if (start2 < end && start < end2) to_delete.
Add(start2);
372 for (
int i = 0;
i < to_delete.length(); ++
i)
tree_.
Remove(to_delete[
i]);
377 CodeTree::Locator locator;
381 if (addr < (locator.key() + entry.
size)) {
383 *start = locator.key();
393 CodeTree::Locator locator;
409 if (from ==
to)
return;
410 CodeTree::Locator locator;
436 : function_and_resource_names_(heap),
437 current_profiles_semaphore_(1) {
459 bool record_samples) {
535 const char* name_prefix,
536 const char* resource_name,
555 "(garbage collector)";
557 "(unresolved function)";
561 : profiles_(profiles),
563 profiles->NewCodeEntry(
Logger::FUNCTION_TAG, kProgramEntryName)),
565 profiles->NewCodeEntry(
Logger::FUNCTION_TAG, kIdleEntryName)),
567 profiles->NewCodeEntry(
Logger::BUILTIN_TAG,
568 kGarbageCollectorEntryName)),
570 profiles->NewCodeEntry(
Logger::FUNCTION_TAG,
571 kUnresolvedFunctionName)) {
581 memset(entry, 0, entries.
length() *
sizeof(*entry));
600 int pc_offset =
static_cast<int>(
602 for (
int i = 0;
i < ranges->length();
i++) {
604 if (range.
from <= pc_offset && pc_offset < range.
to) {
611 if (pc_entry->
builtin_id() == Builtins::kFunctionCall ||
612 pc_entry->
builtin_id() == Builtins::kFunctionApply) {
627 stack_pos != stack_end;
633 if (FLAG_prof_browser_mode) {
634 bool no_symbolized_entries =
true;
637 no_symbolized_entries =
false;
642 if (no_symbolized_entries) {
665 default:
return NULL;
static void Print(const char *format,...)
void SetBuiltinId(Builtins::Name id)
const char * name_prefix_
Logger::LogEventsAndTags tag_
List< OffsetRange > * no_frame_ranges_
Builtins::Name builtin_id_
static const char *const kEmptyResourceName
const char * resource_name_
const char * bailout_reason() const
const char * name_prefix() const
const char * resource_name() const
static const char *const kEmptyBailoutReason
static const char *const kEmptyNamePrefix
List< OffsetRange > * no_frame_ranges() const
Builtins::Name builtin_id() const
uint32_t GetCallUid() const
bool IsSameAs(CodeEntry *entry) const
const char * name() const
void Call(const Address &key, const CodeEntryInfo &value)
void DeleteAllCoveredCode(Address start, Address end)
void AddCode(Address addr, CodeEntry *entry, unsigned size)
static CodeEntry *const kSharedFunctionCodeEntry
int GetSharedId(Address addr)
void MoveCode(Address from, Address to)
CodeEntry * FindEntry(Address addr, Address *start=NULL)
byte * instruction_start()
base::TimeTicks end_time_
CpuProfile(const char *title, bool record_samples)
void CalculateTotalTicksAndSamplingRate()
void AddPath(base::TimeTicks timestamp, const Vector< CodeEntry * > &path)
List< ProfileNode * > samples_
List< base::TimeTicks > timestamps_
List< CpuProfile * > current_profiles_
CodeEntry * NewCodeEntry(Logger::LogEventsAndTags tag, const char *name, const char *name_prefix=CodeEntry::kEmptyNamePrefix, const char *resource_name=CodeEntry::kEmptyResourceName, int line_number=v8::CpuProfileNode::kNoLineNumberInfo, int column_number=v8::CpuProfileNode::kNoColumnNumberInfo)
bool StartProfiling(const char *title, bool record_samples)
static const int kMaxSimultaneousProfiles
void AddPathToCurrentProfiles(base::TimeTicks timestamp, const Vector< CodeEntry * > &path)
void RemoveProfile(CpuProfile *profile)
CpuProfilesCollection(Heap *heap)
List< CpuProfile * > finished_profiles_
bool IsLastProfile(const char *title)
List< CodeEntry * > code_entries_
base::Semaphore current_profiles_semaphore_
CpuProfile * StopProfiling(const char *title)
void AfterChildTraversed(ProfileNode *, ProfileNode *)
void AfterAllChildrenTraversed(ProfileNode *node)
void BeforeTraversingChild(ProfileNode *, ProfileNode *)
static HeapObject * FromAddress(Address address)
void Add(const T &element, AllocationPolicy allocator=AllocationPolicy())
INLINE(void next_child())
INLINE(bool has_current_child())
Position(ProfileNode *node)
INLINE(ProfileNode *current_child())
CodeEntry * EntryForVMState(StateTag tag)
void RecordTickSample(const TickSample &sample)
CpuProfilesCollection * profiles_
ProfileGenerator(CpuProfilesCollection *profiles)
static const char *const kProgramEntryName
static const char *const kUnresolvedFunctionName
CodeEntry * unresolved_entry_
static const char *const kIdleEntryName
static const char *const kGarbageCollectorEntryName
CodeEntry * program_entry_
CodeEntry * entry() const
void IncrementSelfTicks()
ProfileNode * FindChild(CodeEntry *entry)
const List< ProfileNode * > * children() const
ProfileNode * FindOrAddChild(CodeEntry *entry)
static uint32_t CodeEntryHash(CodeEntry *entry)
List< ProfileNode * > children_list_
ProfileNode(ProfileTree *tree, CodeEntry *entry)
ProfileNode * AddPathFromEnd(const Vector< CodeEntry * > &path)
void TraverseDepthFirst(Callback *callback)
void AddPathFromStart(const Vector< CodeEntry * > &path)
bool FindGreatestLessThan(const Key &key, Locator *locator)
bool Remove(const Key &key)
void ForEach(Callback *callback)
bool Find(const Key &key, Locator *locator)
bool Insert(const Key &key, Locator *locator)
static uint32_t HashSequentialString(const schar *chars, int length, uint32_t seed)
SmartArrayPointer< char > ToCString(AllowNullsFlag allow_nulls, RobustnessFlag robustness_flag, int offset, int length, int *length_output=0)
StringsStorage(Heap *heap)
const char * GetFunctionName(Name *name)
const char * GetName(Name *name)
const char * AddOrDisposeString(char *str, int len)
const char * GetFormatted(const char *format,...)
const char * GetCopy(const char *src)
const char * GetVFormatted(const char *format, va_list args)
HashMap::Entry * GetEntry(const char *str, int len)
static const int kMaxNameSize
static bool StringsMatch(void *key1, void *key2)
size_t GetUsedMemorySize() const
Entry * Next(Entry *p) const
uint32_t capacity() const
Entry * Lookup(void *key, uint32_t hash, bool insert, AllocationPolicy allocator=AllocationPolicy())
static Vector< T > New(int length)
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 expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes to(mksnapshot only)") DEFINE_STRING(raw_context_file
enable harmony numeric enable harmony object literal extensions Optimize object size
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 expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
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
#define DCHECK(condition)
void DeleteArray(T *array)
void StrNCpy(Vector< char > dest, const char *src, size_t n)
static void DeleteCodeEntry(CodeEntry **entry_ptr)
static LifetimePosition Min(LifetimePosition a, LifetimePosition b)
static const uint32_t kZeroHashSeed
@ ROBUST_STRING_TRAVERSAL
int VSNPrintF(Vector< char > str, const char *format, va_list args)
uint32_t ComputeIntegerHash(uint32_t key, uint32_t seed)
static void DeleteCpuProfile(CpuProfile **profile_ptr)
int StrLength(const char *string)
Debugger support for the V8 JavaScript engine.
NodesPair(ProfileNode *src, ProfileNode *dst)
Address external_callback
StackFrame::Type top_frame_type
base::TimeTicks timestamp
Address stack[kMaxFramesCount]
bool has_external_callback
Definitions and convenience functions for working with unicode.