MCPcopy Create free account
hub / github.com/nodejs/node / parse_field

Function parse_field

deps/v8/tools/gen-postmortem-metadata.py:836–867  ·  view source on GitHub ↗
(call)

Source from the content-addressed store, hash-verified

834# describing the corresponding output constant. See load_fields().
835#
836def parse_field(call):
837 # Replace newlines with spaces.
838 for ii in range(0, len(call)):
839 if (call[ii] == '\n'):
840 call[ii] == ' '
841
842 idx = call.find('(')
843 kind = call[0:idx]
844 rest = call[idx + 1:len(call) - 1]
845 args = split_commas(rest)
846
847 klass = args[0]
848 field = args[1]
849 dtype = None
850 offset = None
851 if not (kind.startswith('SMI_ACCESSORS') or
852 kind.startswith('ACCESSORS_TO_SMI')):
853 dtype = re.sub(r'[<> ,]+', '_', args[2]).lstrip('(').rstrip(')')
854 offset = args[3]
855 else:
856 offset = args[2]
857 dtype = 'SMI'
858
859 if offset.startswith("offsetof(") or offset.startswith(
860 "OFFSET_OF_DATA_START("):
861 offsetof_fields.append((klass, field, offset))
862 value = 'OffsetsForDebug::%s_%s' % (klass, field)
863 else:
864 value = '%s::%s' % (klass, offset)
865
866 assert (offset is not None and dtype is not None)
867 return ({'name': 'class_%s__%s__%s' % (klass, field, dtype), 'value': value})
868
869#
870# Load field offset information from objects-inl.h etc.

Callers 2

load_fieldsFunction · 0.85
load_fields_from_fileFunction · 0.85

Calls 4

split_commasFunction · 0.85
findMethod · 0.65
rangeFunction · 0.50
appendMethod · 0.45

Tested by

no test coverage detected