From c3761a0c19ed9e991289960a14e47feda37065f1 Mon Sep 17 00:00:00 2001 From: "evan.lucas" Date: Thu, 12 Nov 2015 06:47:38 -0800 Subject: [PATCH] deps: backport bc2e393 from v8 upstream 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. PR-URL: https://github.com/nodejs/node/pull/3792 Reviewed-By: Trevor Norris Reviewed-By: Fedor Indutny Reviewed-By: Ben Noordhuis --- deps/v8/tools/gen-postmortem-metadata.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/deps/v8/tools/gen-postmortem-metadata.py b/deps/v8/tools/gen-postmortem-metadata.py index 7baa1798c3c17f..9dffd59e5d3ad8 100644 --- a/deps/v8/tools/gen-postmortem-metadata.py +++ b/deps/v8/tools/gen-postmortem-metadata.py @@ -271,6 +271,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". # @@ -309,12 +323,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 }; # @@ -565,6 +581,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;