Skip to content

Commit

Permalink
deps: backport bc2e393 from v8 upstream
Browse files Browse the repository at this point in the history
Original commit message:

  [tools] Make gen-postmortem-metadata.py more reliable

  Instead of basing matches off of whitespace, walk the
  inheritance chain and include any classes that inherit
  from Object.

  R=machenbach@chromium.org,jkummerow@chromium.org
  NOTRY=true

  Review URL: https://codereview.chromium.org/1435643002

  Cr-Commit-Position: refs/heads/master@{#31964}

This adds some missing classes to postmortem info like
JSMap and JSSet.

Ref: #3792
PR-URL: #4106
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: rvagg - Rod Vagg <rod@vagg.org>
  • Loading branch information
evan.lucas authored and ofrobots committed Jan 22, 2016
1 parent 113d1f3 commit 674e513
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions deps/v8/tools/gen-postmortem-metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,20 @@
}
'''

#
# Get the base class
#
def get_base_class(klass):
if (klass == 'Object'):
return klass;

if (not (klass in klasses)):
return None;

k = klasses[klass];

return get_base_class(k['parent']);

#
# Loads class hierarchy and type information from "objects.h".
#
Expand Down Expand Up @@ -311,12 +325,14 @@ def load_objects():
typestr += line;
continue;

match = re.match('class (\w[^\s:]*)(: public (\w[^\s{]*))?\s*{',
match = re.match('class (\w[^:]*)(: public (\w[^{]*))?\s*{\s*',
line);

if (match):
klass = match.group(1);
klass = match.group(1).rstrip().lstrip();
pklass = match.group(3);
if (pklass):
pklass = pklass.rstrip().lstrip();
klasses[klass] = { 'parent': pklass };

#
Expand Down Expand Up @@ -567,6 +583,9 @@ def emit_config():
keys.sort();
for klassname in keys:
pklass = klasses[klassname]['parent'];
bklass = get_base_class(klassname);
if (bklass != 'Object'):
continue;
if (pklass == None):
continue;

Expand Down

0 comments on commit 674e513

Please sign in to comment.