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

Class InspectionPadawan

deps/v8/tools/grokdump.py:2083–2546  ·  view source on GitHub ↗

The padawan can improve annotations by sensing well-known objects.

Source from the content-addressed store, hash-verified

2081
2082
2083class InspectionPadawan(object):
2084 """The padawan can improve annotations by sensing well-known objects."""
2085
2086 def __init__(self, reader, heap):
2087 self.reader = reader
2088 self.heap = heap
2089 self.known_first_map_page = 0
2090 self.known_first_old_page = 0
2091 self.context = None
2092
2093 def __getattr__(self, name):
2094 """An InspectionPadawan can be used instead of V8Heap, even though
2095 it does not inherit from V8Heap (aka. mixin)."""
2096 return getattr(self.heap, name)
2097
2098 def GetPageAddress(self, tagged_address):
2099 return tagged_address & ~self.heap.PageAlignmentMask()
2100
2101 def GetPageOffset(self, tagged_address):
2102 return tagged_address & self.heap.PageAlignmentMask()
2103
2104 def IsInKnownMapSpace(self, tagged_address):
2105 page_address = tagged_address & ~self.heap.PageAlignmentMask()
2106 return page_address == self.known_first_map_page
2107
2108 def IsInKnownOldSpace(self, tagged_address):
2109 page_address = tagged_address & ~self.heap.PageAlignmentMask()
2110 return page_address == self.known_first_old_page
2111
2112 def ContainingKnownOldSpaceName(self, tagged_address):
2113 page_address = tagged_address & ~self.heap.PageAlignmentMask()
2114 if page_address == self.known_first_old_page: return "OLD_SPACE"
2115 return None
2116
2117 def FrameMarkerName(self, value):
2118 # The frame marker is Smi-tagged but not Smi encoded and 0 is not a valid
2119 # frame type.
2120 value = (value >> 1) - 1
2121 if 0 <= value < len(FRAME_MARKERS):
2122 return "Possibly %s frame marker" % FRAME_MARKERS[value]
2123 return None
2124
2125 def IsFrameMarker(self, slot, address):
2126 if not slot: return False
2127 # Frame markers only occur directly after a frame pointer and only on the
2128 # stack.
2129 if not self.reader.IsExceptionStackAddress(slot): return False
2130 next_slot = slot + self.reader.MachinePointerSize()
2131 if not self.reader.IsValidAddress(next_slot): return False
2132 next_address = self.reader.ReadUIntPtr(next_slot)
2133 return self.reader.IsExceptionStackAddress(next_address)
2134
2135 def FormatSmi(self, address):
2136 value = self.heap.SmiUntag(address)
2137 # On 32-bit systems almost everything looks like a Smi.
2138 if not self.reader.Is64() or value == 0: return None
2139 return "Tagged<Smi>(%d)" % value
2140

Callers 3

__init__Method · 0.85
__init__Method · 0.85
_AnalyzeMinidumpFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected