Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(578)

Unified Diff: tools/gen-postmortem-metadata.py

Issue 1437133006: postmortem: export private field offsets Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/isolate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gen-postmortem-metadata.py
diff --git a/tools/gen-postmortem-metadata.py b/tools/gen-postmortem-metadata.py
index 032b713393b6609cf8323fae732c846d7178b35b..76c8ad8364cc81adcf94f9d6018c982462494137 100644
--- a/tools/gen-postmortem-metadata.py
+++ b/tools/gen-postmortem-metadata.py
@@ -181,6 +181,25 @@ consts_misc = [
'value': 'JSArrayBuffer::WasNeutered::kMask' },
{ 'name': 'jsarray_buffer_was_neutered_shift',
'value': 'JSArrayBuffer::WasNeutered::kShift' },
+
+ { 'name': 'new_space',
+ 'value': 'AllocationSpace::NEW_SPACE' },
+ { 'name': 'old_space',
+ 'value': 'AllocationSpace::OLD_SPACE' },
+ { 'name': 'code_space',
+ 'value': 'AllocationSpace::CODE_SPACE' },
+ { 'name': 'map_space',
+ 'value': 'AllocationSpace::MAP_SPACE' },
+ { 'name': 'lo_space',
+ 'value': 'AllocationSpace::LO_SPACE' },
+ { 'name': 'first_space',
+ 'value': 'AllocationSpace::FIRST_SPACE' },
+ { 'name': 'last_space',
+ 'value': 'AllocationSpace::LAST_SPACE' },
+ { 'name': 'first_paged_space',
+ 'value': 'AllocationSpace::FIRST_PAGED_SPACE' },
+ { 'name': 'last_paged_space',
+ 'value': 'AllocationSpace::LAST_PAGED_SPACE' },
];
#
@@ -223,6 +242,7 @@ extras_accessors = [
'SlicedString, parent, String, kParentOffset',
'Code, instruction_start, uintptr_t, kHeaderSize',
'Code, instruction_size, int, kInstructionSizeOffset',
+ 'Heap, root_count, int, kRootListLength',
];
#
@@ -237,6 +257,67 @@ expected_classes = [
];
+private_fields = [
+ { 'class': 'Isolate', 'field': 'heap_' },
+
+ { 'class': 'Heap', 'field': 'amount_of_external_allocated_memory_' },
+ { 'class': 'Heap', 'field': 'roots_' },
+ { 'class': 'Heap', 'field': 'new_space_' },
+ { 'class': 'Heap', 'field': 'old_space_' },
+ { 'class': 'Heap', 'field': 'code_space_' },
+ { 'class': 'Heap', 'field': 'map_space_' },
+ { 'class': 'Heap', 'field': 'lo_space_' },
+
+ { 'class': 'NewSpace', 'field': 'heap_' },
+ { 'class': 'NewSpace', 'field': 'id_' },
+ { 'class': 'NewSpace', 'field': 'executable_' },
+ { 'class': 'NewSpace', 'field': 'to_space_' },
+ { 'class': 'NewSpace', 'field': 'from_space_' },
+ { 'class': 'NewSpace', 'field': 'pages_used_' },
+
+ { 'class': 'SemiSpace', 'field': 'heap_' },
+ { 'class': 'SemiSpace', 'field': 'id_' },
+ { 'class': 'SemiSpace', 'field': 'executable_' },
+ { 'class': 'SemiSpace', 'field': 'anchor_' },
+ { 'class': 'SemiSpace', 'field': 'current_page_' },
+ { 'class': 'SemiSpace', 'field': 'committed_' },
+
+ { 'class': 'OldSpace', 'field': 'heap_' },
+ { 'class': 'OldSpace', 'field': 'id_' },
+ { 'class': 'OldSpace', 'field': 'executable_' },
+ { 'class': 'OldSpace', 'field': 'anchor_' },
+
+ { 'class': 'MapSpace', 'field': 'heap_' },
+ { 'class': 'MapSpace', 'field': 'id_' },
+ { 'class': 'MapSpace', 'field': 'executable_' },
+ { 'class': 'MapSpace', 'field': 'anchor_' },
+
+ { 'class': 'LargeObjectSpace', 'field': 'heap_' },
+ { 'class': 'LargeObjectSpace', 'field': 'id_' },
+ { 'class': 'LargeObjectSpace', 'field': 'executable_' },
+ { 'class': 'LargeObjectSpace', 'field': 'size_' },
+ { 'class': 'LargeObjectSpace', 'field': 'objects_size_' },
+ { 'class': 'LargeObjectSpace', 'field': 'first_page_' },
+
+ { 'class': 'Page', 'field': 'size_' },
+ { 'class': 'Page', 'field': 'area_start_' },
+ { 'class': 'Page', 'field': 'area_end_' },
+ { 'class': 'Page', 'field': 'prev_chunk_' },
+ { 'class': 'Page', 'field': 'next_chunk_' },
+
+ { 'class': 'NewSpacePage', 'field': 'size_' },
+ { 'class': 'NewSpacePage', 'field': 'area_start_' },
+ { 'class': 'NewSpacePage', 'field': 'area_end_' },
+ { 'class': 'NewSpacePage', 'field': 'prev_chunk_' },
+ { 'class': 'NewSpacePage', 'field': 'next_chunk_' },
+
+ { 'class': 'LargePage', 'field': 'size_' },
+ { 'class': 'LargePage', 'field': 'area_start_' },
+ { 'class': 'LargePage', 'field': 'area_end_' },
+ { 'class': 'LargePage', 'field': 'prev_chunk_' },
+ { 'class': 'LargePage', 'field': 'next_chunk_' },
+];
+
#
# The following structures store high-level representations of the structures
# for which we're going to emit descriptive constants.
@@ -538,6 +619,31 @@ def emit_set(out, consts):
out.write('\n');
#
+# Emit private fields class and values
+#
+def emit_private_fields(out, fields, consts):
+ # Fix up overzealous parses. This could be done inside the
+ # parsers but as there are several, it's easiest to do it here.
+ ws = re.compile('\s+')
+ out.write('namespace v8 {\n');
+ out.write('namespace internal {\n\n');
+ out.write('class PostMortem {\n');
+ out.write(' public:\n');
+ for field in fields:
+ klass = ws.sub('', field['class'])
+ field = ws.sub('', field['field'])
+ out.write(' static const int k%s__%s = offsetof(%s, %s);\n' %
+ (klass, field, klass, field));
+ consts.append({
+ 'name': 'field_%s__%s' % (klass, field),
+ 'value': 'v8::internal::PostMortem::k%s__%s' %
+ (klass, field)
+ });
+ out.write('};\n');
+ out.write('} // namespace internal\n');
+ out.write('} // namespace v8\n\n');
+
+#
# Emit the whole output file.
#
def emit_config():
@@ -580,6 +686,12 @@ def emit_config():
out.write('/* field information */\n');
emit_set(out, fields);
+ out.write('/* private fields */\n');
+ consts = []
+ emit_private_fields(out, private_fields, consts);
+
+ emit_set(out, consts);
+
out.write(footer);
if (len(sys.argv) < 4):
« no previous file with comments | « src/isolate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698