MCPcopy Index your code
hub / github.com/nodejs/node / Code

Class Code

deps/v8/tools/profiling/ll_prof.py:93–221  ·  view source on GitHub ↗

Code object.

Source from the content-addressed store, hash-verified

91
92
93class Code(object):
94 """Code object."""
95
96 _id = 0
97 UNKNOWN = 0
98 V8INTERNAL = 1
99 FULL_CODEGEN = 2
100 OPTIMIZED = 3
101
102 def __init__(self, name, start_address, end_address, origin, origin_offset):
103 self.id = Code._id
104 Code._id += 1
105 self.name = name
106 self.other_names = None
107 self.start_address = start_address
108 self.end_address = end_address
109 self.origin = origin
110 self.origin_offset = origin_offset
111 self.self_ticks = 0
112 self.self_ticks_map = None
113 self.callee_ticks = None
114 if name.startswith("LazyCompile:*"):
115 self.codetype = Code.OPTIMIZED
116 elif name.startswith("LazyCompile:"):
117 self.codetype = Code.FULL_CODEGEN
118 elif name.startswith("v8::internal::"):
119 self.codetype = Code.V8INTERNAL
120 else:
121 self.codetype = Code.UNKNOWN
122
123 def AddName(self, name):
124 assert self.name != name
125 if self.other_names is None:
126 self.other_names = [name]
127 return
128 if not name in self.other_names:
129 self.other_names.append(name)
130
131 def FullName(self):
132 if self.other_names is None:
133 return self.name
134 self.other_names.sort()
135 return "%s (aka %s)" % (self.name, ", ".join(self.other_names))
136
137 def IsUsed(self):
138 return self.self_ticks > 0 or self.callee_ticks is not None
139
140 def Tick(self, pc):
141 self.self_ticks += 1
142 if self.self_ticks_map is None:
143 self.self_ticks_map = collections.defaultdict(lambda: 0)
144 offset = pc - self.start_address
145 self.self_ticks_map[offset] += 1
146
147 def CalleeTick(self, callee):
148 if self.callee_ticks is None:
149 self.callee_ticks = collections.defaultdict(lambda: 0)
150 self.callee_ticks[callee] += 1

Callers 3

ReadUpToGCMethod · 0.70
LoadMethod · 0.70
_LoadKernelSymbolsMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…