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

Class CodePage

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

Group of adjacent code objects.

Source from the content-addressed store, hash-verified

222
223
224class CodePage(object):
225 """Group of adjacent code objects."""
226
227 SHIFT = 20 # 1M pages
228 SIZE = (1 << SHIFT)
229 MASK = ~(SIZE - 1)
230
231 @staticmethod
232 def PageAddress(address):
233 return address & CodePage.MASK
234
235 @staticmethod
236 def PageId(address):
237 return address >> CodePage.SHIFT
238
239 @staticmethod
240 def PageAddressFromId(id):
241 return id << CodePage.SHIFT
242
243 def __init__(self, address):
244 self.address = address
245 self.code_objects = []
246
247 def Add(self, code):
248 self.code_objects.append(code)
249
250 def Remove(self, code):
251 self.code_objects.remove(code)
252
253 def Find(self, pc):
254 code_objects = self.code_objects
255 for i, code in enumerate(code_objects):
256 if code.start_address <= pc < code.end_address:
257 code_objects[0], code_objects[i] = code, code_objects[0]
258 return code
259 return None
260
261 def __iter__(self):
262 return self.code_objects.__iter__()
263
264
265class CodeMap(object):

Callers 1

AddMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…