v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
cpu-profiler-inl.h
Go to the documentation of this file.
1// Copyright 2010 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_PROFILER_CPU_PROFILER_INL_H_
6#define V8_PROFILER_CPU_PROFILER_INL_H_
7
9// Include the non-inl header before the rest of the headers.
10
11#include <new>
14
15namespace v8 {
16namespace internal {
17
19 InstructionStreamMap* instruction_stream_map) {
20 instruction_stream_map->AddCode(instruction_start, entry, instruction_size);
21}
22
24 InstructionStreamMap* instruction_stream_map) {
25 instruction_stream_map->MoveCode(from_instruction_start,
27}
28
30 InstructionStreamMap* instruction_stream_map) {
31 CodeEntry* entry = instruction_stream_map->FindEntry(instruction_start);
32 if (entry != nullptr) {
34 }
35}
36
38 InstructionStreamMap* instruction_stream_map) {
39 CodeEntry* entry = instruction_stream_map->FindEntry(instruction_start);
40 if (entry != nullptr) {
41 std::vector<CpuProfileDeoptFrame> frames_vector(
43 entry->set_deopt_info(deopt_reason, deopt_id, std::move(frames_vector));
44 }
45 delete[] deopt_frames;
46}
47
49 InstructionStreamMap* instruction_stream_map) {
50 CodeEntry* entry = instruction_stream_map->FindEntry(instruction_start);
51 if (entry) {
52 entry->SetBuiltinId(builtin);
53 return;
54 }
55#if V8_ENABLE_WEBASSEMBLY
56 if (builtin == Builtin::kJSToWasmWrapper) {
57 // Make sure to add the generic js-to-wasm wrapper builtin, because that
58 // one is supposed to show up in profiles.
59 entry = instruction_stream_map->code_entries().Create(
60 LogEventListener::CodeTag::kBuiltin, "js-to-wasm");
61 instruction_stream_map->AddCode(instruction_start, entry, instruction_size);
62 }
63 if (builtin == Builtin::kWasmToJsWrapperCSA) {
64 // Make sure to add the generic wasm-to-js wrapper builtin, because that
65 // one is supposed to show up in profiles.
66 entry = instruction_stream_map->code_entries().Create(
67 LogEventListener::CodeTag::kBuiltin, "wasm-to-js");
68 instruction_stream_map->AddCode(instruction_start, entry, instruction_size);
69 }
70#endif // V8_ENABLE_WEBASSEMBLY
71}
72
74 void* address = ticks_buffer_.StartEnqueue();
75 if (address == nullptr) return nullptr;
78 return &evt->sample;
79}
80
82 InstructionStreamMap* instruction_stream_map) {
83 bool removed = instruction_stream_map->RemoveCode(entry);
84 CHECK(removed);
85}
86
90
91} // namespace internal
92} // namespace v8
93
94#endif // V8_PROFILER_CPU_PROFILER_INL_H_
V8_INLINE void UpdateCodeMap(InstructionStreamMap *instruction_stream_map)
V8_INLINE void UpdateCodeMap(InstructionStreamMap *instruction_stream_map)
CpuProfileDeoptFrame * deopt_frames
V8_INLINE void UpdateCodeMap(InstructionStreamMap *instruction_stream_map)
V8_INLINE void UpdateCodeMap(InstructionStreamMap *instruction_stream_map)
static CodeEntry * Create(Args &&... args)
void set_bailout_reason(const char *bailout_reason)
void set_deopt_info(const char *deopt_reason, int deopt_id, std::vector< CpuProfileDeoptFrame > inlined_frames)
V8_INLINE void UpdateCodeMap(InstructionStreamMap *instruction_stream_map)
void MoveCode(Address from, Address to)
void AddCode(Address addr, CodeEntry *entry, unsigned size)
CodeEntry * FindEntry(Address addr, Address *out_instruction_start=nullptr)
std::atomic< unsigned > last_code_event_id_
V8_INLINE void UpdateCodeMap(InstructionStreamMap *instruction_stream_map)
SamplingCircularQueue< TickSampleEventRecord, kTickSampleQueueLength > ticks_buffer_
#define CHECK(condition)
Definition logging.h:124