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

Side by Side Diff: test/mjsunit/testcfg.py

Issue 1136073002: Resolve references to "this" the same way as normal variables (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: "this" should never be looked up dynamically Created 5 years, 7 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
« no previous file with comments | « test/mjsunit/harmony/arrow-functions-this.js ('k') | test/mjsunit/this-dynamic-lookup.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2008 the V8 project authors. All rights reserved. 1 # Copyright 2008 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
(...skipping 17 matching lines...) Expand all
28 import os 28 import os
29 import re 29 import re
30 30
31 from testrunner.local import testsuite 31 from testrunner.local import testsuite
32 from testrunner.objects import testcase 32 from testrunner.objects import testcase
33 33
34 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") 34 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
35 FILES_PATTERN = re.compile(r"//\s+Files:(.*)") 35 FILES_PATTERN = re.compile(r"//\s+Files:(.*)")
36 SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME") 36 SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME")
37 MODULE_PATTERN = re.compile(r"^// MODULE$", flags=re.MULTILINE) 37 MODULE_PATTERN = re.compile(r"^// MODULE$", flags=re.MULTILINE)
38 NO_HARNESS_PATTERN = re.compile(r"^// NO HARNESS$", flags=re.MULTILINE)
38 39
39 40
40 class MjsunitTestSuite(testsuite.TestSuite): 41 class MjsunitTestSuite(testsuite.TestSuite):
41 42
42 def __init__(self, name, root): 43 def __init__(self, name, root):
43 super(MjsunitTestSuite, self).__init__(name, root) 44 super(MjsunitTestSuite, self).__init__(name, root)
44 45
45 def ListTests(self, context): 46 def ListTests(self, context):
46 tests = [] 47 tests = []
47 for dirname, dirs, files in os.walk(self.root): 48 for dirname, dirs, files in os.walk(self.root):
(...skipping 24 matching lines...) Expand all
72 files_match = FILES_PATTERN.search(source, files_match.end()) 73 files_match = FILES_PATTERN.search(source, files_match.end())
73 else: 74 else:
74 break 75 break
75 files = [ os.path.normpath(os.path.join(self.root, '..', '..', f)) 76 files = [ os.path.normpath(os.path.join(self.root, '..', '..', f))
76 for f in files_list ] 77 for f in files_list ]
77 testfilename = os.path.join(self.root, testcase.path + self.suffix()) 78 testfilename = os.path.join(self.root, testcase.path + self.suffix())
78 if SELF_SCRIPT_PATTERN.search(source): 79 if SELF_SCRIPT_PATTERN.search(source):
79 env = ["-e", "TEST_FILE_NAME=\"%s\"" % testfilename.replace("\\", "\\\\")] 80 env = ["-e", "TEST_FILE_NAME=\"%s\"" % testfilename.replace("\\", "\\\\")]
80 files = env + files 81 files = env + files
81 82
82 if not context.no_harness: 83 if not context.no_harness and not NO_HARNESS_PATTERN.search(source):
83 files.append(os.path.join(self.root, "mjsunit.js")) 84 files.append(os.path.join(self.root, "mjsunit.js"))
84 85
85 if MODULE_PATTERN.search(source): 86 if MODULE_PATTERN.search(source):
86 files.append("--module") 87 files.append("--module")
87 files.append(testfilename) 88 files.append(testfilename)
88 89
89 flags += files 90 flags += files
90 if context.isolates: 91 if context.isolates:
91 flags.append("--isolate") 92 flags.append("--isolate")
92 flags += files 93 flags += files
93 94
94 return testcase.flags + flags 95 return testcase.flags + flags
95 96
96 def GetSourceForTest(self, testcase): 97 def GetSourceForTest(self, testcase):
97 filename = os.path.join(self.root, testcase.path + self.suffix()) 98 filename = os.path.join(self.root, testcase.path + self.suffix())
98 with open(filename) as f: 99 with open(filename) as f:
99 return f.read() 100 return f.read()
100 101
101 102
102 def GetSuite(name, root): 103 def GetSuite(name, root):
103 return MjsunitTestSuite(name, root) 104 return MjsunitTestSuite(name, root)
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/arrow-functions-this.js ('k') | test/mjsunit/this-dynamic-lookup.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698