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

Side by Side Diff: tools/external-reference-check.py

Issue 441983002: Check that external references are registered in the serializer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: remove bogus assertions Created 6 years, 4 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2014 the V8 project authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import re
7 import os
8 import sys
9
10 DECLARE_FILE = "src/assembler.h"
11 REGISTER_FILE = "src/serialize.cc"
12 DECLARE_RE = re.compile("\s*static ExternalReference ([^(]+)\(")
13 REGISTER_RE = re.compile("\s*Add\(ExternalReference::([^(]+)\(")
14
15 WORKSPACE = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), ".."))
16
17 EXPECTED_EXTERNAL_REFERENCES = 100
Slava Chigrin 2014/08/05 13:17:04 Seems, it is not used. Am I wrong?
18
19 # Ignore those.
20 BLACKLISTED = [
21 "page_flags",
22 "math_exp_constants",
23 "math_exp_log_table",
24 "ForDeoptEntry",
25 ]
26
27 def Find(filename, re):
28 references = []
29 with open(filename, "r") as f:
30 for line in f:
31 match = re.match(line)
32 if match:
33 references.append(match.group(1))
34 return references
35
36 def Main():
37 declarations = Find(DECLARE_FILE, DECLARE_RE)
38 registrations = Find(REGISTER_FILE, REGISTER_RE)
39 difference = list(set(declarations) - set(registrations) - set(BLACKLISTED))
40 for reference in difference:
41 print("Declared but not registered: ExternalReference::%s" % reference)
42 return len(difference) > 0
43
44 if __name__ == "__main__":
45 sys.exit(Main())
OLDNEW
« src/serialize.cc ('K') | « src/x64/codegen-x64.cc ('k') | tools/presubmit.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698