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

Method __init__

deps/v8/tools/grokdump.py:1400–1417  ·  view source on GitHub ↗
(self, heap, map, address)

Source from the content-addressed store, hash-verified

1398 WEBKIT_STRING_IMPL_CHARS_OFFSET = 8
1399
1400 def __init__(self, heap, map, address):
1401 String.__init__(self, heap, map, address)
1402 reader = heap.reader
1403 self.resource = \
1404 reader.ReadU32(self.address + ExternalString.RESOURCE_OFFSET)
1405 self.chars = "?external string?"
1406 if not reader.IsValidAddress(self.resource): return
1407 string_impl_address = self.resource + \
1408 ExternalString.WEBKIT_RESOUCE_STRING_IMPL_OFFSET
1409 if not reader.IsValidAddress(string_impl_address): return
1410 string_impl = reader.ReadU32(string_impl_address)
1411 chars_ptr_address = string_impl + \
1412 ExternalString.WEBKIT_STRING_IMPL_CHARS_OFFSET
1413 if not reader.IsValidAddress(chars_ptr_address): return
1414 chars_ptr = reader.ReadU32(chars_ptr_address)
1415 if not reader.IsValidAddress(chars_ptr): return
1416 raw_chars = reader.ReadBytes(chars_ptr, 2 * self.length)
1417 self.chars = codecs.getdecoder("utf16")(raw_chars)[0]
1418
1419 def GetChars(self):
1420 return self.chars

Callers

nothing calls this directly

Calls 4

ReadU32Method · 0.80
IsValidAddressMethod · 0.80
ReadBytesMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected