OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 the V8 project authors. All rights reserved. | 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import itertools | 6 import itertools |
7 import js2c | 7 import js2c |
8 import multiprocessing | 8 import multiprocessing |
9 import optparse | 9 import optparse |
10 import os | 10 import os |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 for i in xrange(length): | 281 for i in xrange(length): |
282 result += random.choice(alphabet) | 282 result += random.choice(alphabet) |
283 return result | 283 return result |
284 | 284 |
285 def _SeqString(self, name, recursion_budget): | 285 def _SeqString(self, name, recursion_budget): |
286 s1 = self._RawRandomString(1, 5) | 286 s1 = self._RawRandomString(1, 5) |
287 s2 = self._RawRandomString(1, 5) | 287 s2 = self._RawRandomString(1, 5) |
288 # 'foo' + 'bar' | 288 # 'foo' + 'bar' |
289 return self._Variable(name, "\"%s\" + \"%s\"" % (s1, s2)) | 289 return self._Variable(name, "\"%s\" + \"%s\"" % (s1, s2)) |
290 | 290 |
| 291 def _SeqTwoByteString(self, name): |
| 292 s1 = self._RawRandomString(1, 5) |
| 293 s2 = self._RawRandomString(1, 5) |
| 294 # 'foo' + unicode + 'bar' |
| 295 return self._Variable(name, "\"%s\" + \"\\2082\" + \"%s\"" % (s1, s2)) |
| 296 |
291 def _SlicedString(self, name): | 297 def _SlicedString(self, name): |
292 s = self._RawRandomString(20, 30) | 298 s = self._RawRandomString(20, 30) |
293 # 'ffoo12345678901234567890'.substr(1) | 299 # 'ffoo12345678901234567890'.substr(1) |
294 return self._Variable(name, "\"%s\".substr(1)" % s) | 300 return self._Variable(name, "\"%s\".substr(1)" % s) |
295 | 301 |
296 def _ConsString(self, name): | 302 def _ConsString(self, name): |
297 s1 = self._RawRandomString(8, 15) | 303 s1 = self._RawRandomString(8, 15) |
298 s2 = self._RawRandomString(8, 15) | 304 s2 = self._RawRandomString(8, 15) |
299 # 'foo12345' + (function() { return 'bar12345';})() | 305 # 'foo12345' + (function() { return 'bar12345';})() |
300 return self._Variable(name, | 306 return self._Variable(name, |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 "JSRegExp": ["/ab/g", _JSRegExp], | 673 "JSRegExp": ["/ab/g", _JSRegExp], |
668 "JSSet": ["new Set()", _JSSet], | 674 "JSSet": ["new Set()", _JSSet], |
669 "JSSetIterator": ["%SetCreateIterator(new Set(), 2)", _JSSetIterator], | 675 "JSSetIterator": ["%SetCreateIterator(new Set(), 2)", _JSSetIterator], |
670 "JSTypedArray": ["new Int32Array(2)", _JSTypedArray], | 676 "JSTypedArray": ["new Int32Array(2)", _JSTypedArray], |
671 "JSValue": ["new String('foo')", _JSValue], | 677 "JSValue": ["new String('foo')", _JSValue], |
672 "JSWeakCollection": ["new WeakMap()", _JSWeakCollection], | 678 "JSWeakCollection": ["new WeakMap()", _JSWeakCollection], |
673 "Name": ["\"name\"", _Name], | 679 "Name": ["\"name\"", _Name], |
674 "Number": ["1.5", _Number], | 680 "Number": ["1.5", _Number], |
675 "Object": ["new Object()", _Object], | 681 "Object": ["new Object()", _Object], |
676 "PropertyDetails": ["513", _PropertyDetails], | 682 "PropertyDetails": ["513", _PropertyDetails], |
| 683 "SeqOneByteString": ["\"seq 1-byte\"", _SeqString], |
677 "SeqString": ["\"seqstring\"", _SeqString], | 684 "SeqString": ["\"seqstring\"", _SeqString], |
| 685 "SeqTwoByteString": ["\"seq \\u2082-byte\"", _SeqTwoByteString], |
678 "Smi": ["1", _Smi], | 686 "Smi": ["1", _Smi], |
679 "StrictMode": ["1", _StrictMode], | 687 "StrictMode": ["1", _StrictMode], |
680 "String": ["\"foo\"", _String], | 688 "String": ["\"foo\"", _String], |
681 "Symbol": ["Symbol(\"symbol\")", _Symbol], | 689 "Symbol": ["Symbol(\"symbol\")", _Symbol], |
682 "Uint32": ["32", _Uint32], | 690 "Uint32": ["32", _Uint32], |
683 } | 691 } |
684 | 692 |
685 | 693 |
686 class ArgParser(object): | 694 class ArgParser(object): |
687 def __init__(self, regex, ctor): | 695 def __init__(self, regex, ctor): |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 for i in range(len(processes)): | 1314 for i in range(len(processes)): |
1307 processes[i].join() | 1315 processes[i].join() |
1308 except KeyboardInterrupt: | 1316 except KeyboardInterrupt: |
1309 stop_running.set() | 1317 stop_running.set() |
1310 for i in range(len(processes)): | 1318 for i in range(len(processes)): |
1311 processes[i].join() | 1319 processes[i].join() |
1312 return 0 | 1320 return 0 |
1313 | 1321 |
1314 if __name__ == "__main__": | 1322 if __name__ == "__main__": |
1315 sys.exit(Main()) | 1323 sys.exit(Main()) |
OLD | NEW |