| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 "AddProperty": [None, 10, None, None, None], | 214 "AddProperty": [None, 10, None, None, None], |
| 215 "AddPropertyForTemplate": [None, 10, None, None, None], | 215 "AddPropertyForTemplate": [None, 10, None, None, None], |
| 216 "Apply": ["function() {}", None, None, None, None, None], | 216 "Apply": ["function() {}", None, None, None, None, None], |
| 217 "ArrayBufferSliceImpl": [None, None, 0, None], | 217 "ArrayBufferSliceImpl": [None, None, 0, None], |
| 218 "ArrayConcat": ["[1, 'a']", None], | 218 "ArrayConcat": ["[1, 'a']", None], |
| 219 "BreakIteratorAdoptText": [_BREAK_ITERATOR, None, None], | 219 "BreakIteratorAdoptText": [_BREAK_ITERATOR, None, None], |
| 220 "BreakIteratorBreakType": [_BREAK_ITERATOR, None], | 220 "BreakIteratorBreakType": [_BREAK_ITERATOR, None], |
| 221 "BreakIteratorCurrent": [_BREAK_ITERATOR, None], | 221 "BreakIteratorCurrent": [_BREAK_ITERATOR, None], |
| 222 "BreakIteratorFirst": [_BREAK_ITERATOR, None], | 222 "BreakIteratorFirst": [_BREAK_ITERATOR, None], |
| 223 "BreakIteratorNext": [_BREAK_ITERATOR, None], | 223 "BreakIteratorNext": [_BREAK_ITERATOR, None], |
| 224 "CompileString": [None, "false", None], | 224 "CompileString": [None, None, "false", None], |
| 225 "CreateBreakIterator": ["'en-US'", "{type: 'string'}", None, None], | 225 "CreateBreakIterator": ["'en-US'", "{type: 'string'}", None, None], |
| 226 "CreateJSFunctionProxy": [None, "function() {}", None, None, None], | 226 "CreateJSFunctionProxy": [None, "function() {}", None, None, None], |
| 227 "CreatePrivateSymbol": ["\"foo\"", None], | 227 "CreatePrivateSymbol": ["\"foo\"", None], |
| 228 "CreateSymbol": ["\"foo\"", None], | 228 "CreateSymbol": ["\"foo\"", None], |
| 229 "DateParseString": [None, "new Array(8)", None], | 229 "DateParseString": [None, "new Array(8)", None], |
| 230 "DefineAccessorPropertyUnchecked": [None, None, "function() {}", | 230 "DefineAccessorPropertyUnchecked": [None, None, "function() {}", |
| 231 "function() {}", 2, None], | 231 "function() {}", 2, None], |
| 232 "FunctionBindArguments": [None, None, "undefined", None, None], | 232 "FunctionBindArguments": [None, None, "undefined", None, None], |
| 233 "GetBreakLocations": [None, 0, None], | 233 "GetBreakLocations": [None, 0, None], |
| 234 "GetDefaultReceiver": ["function() {}", None], | 234 "GetDefaultReceiver": ["function() {}", None], |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 return self._JSTypedArray(name, recursion_budget) | 691 return self._JSTypedArray(name, recursion_budget) |
| 692 | 692 |
| 693 def _JSWeakCollection(self, name, recursion_budget): | 693 def _JSWeakCollection(self, name, recursion_budget): |
| 694 ctor = random.choice([self._JSMap, self._JSSet]) | 694 ctor = random.choice([self._JSMap, self._JSSet]) |
| 695 return ctor(name, recursion_budget, weak="Weak") | 695 return ctor(name, recursion_budget, weak="Weak") |
| 696 | 696 |
| 697 def _PropertyDetails(self, name, recursion_budget): | 697 def _PropertyDetails(self, name, recursion_budget): |
| 698 # TODO(jkummerow): Be more clever here? | 698 # TODO(jkummerow): Be more clever here? |
| 699 return self._Int32(name) | 699 return self._Int32(name) |
| 700 | 700 |
| 701 def _JSGlobalProxy(self, name, recursion_budget): |
| 702 return self._Variable(name, "this") |
| 703 |
| 701 def _JSObject(self, name, recursion_budget): | 704 def _JSObject(self, name, recursion_budget): |
| 702 die = random.random() | 705 die = random.random() |
| 703 if die < 0.4: | 706 if die < 0.4: |
| 704 function = random.choice([self._PlainObject, self._PlainArray, | 707 function = random.choice([self._PlainObject, self._PlainArray, |
| 705 self._PlainFunction]) | 708 self._PlainFunction]) |
| 706 elif die < 0.5: | 709 elif die < 0.5: |
| 707 return self._Variable(name, "this") # Global object. | 710 return self._JSGlobalProxy(name, recursion_budget) |
| 708 else: | 711 else: |
| 709 function = random.choice([self._JSArrayBuffer, self._JSDataView, | 712 function = random.choice([self._JSArrayBuffer, self._JSDataView, |
| 710 self._JSDate, self._JSFunctionProxy, | 713 self._JSDate, self._JSFunctionProxy, |
| 711 self._JSGeneratorObject, self._JSMap, | 714 self._JSGeneratorObject, self._JSMap, |
| 712 self._JSMapIterator, self._JSRegExp, | 715 self._JSMapIterator, self._JSRegExp, |
| 713 self._JSSet, self._JSSetIterator, | 716 self._JSSet, self._JSSetIterator, |
| 714 self._JSTypedArray, self._JSValue, | 717 self._JSTypedArray, self._JSValue, |
| 715 self._JSWeakCollection]) | 718 self._JSWeakCollection]) |
| 716 result = function(name, recursion_budget) | 719 result = function(name, recursion_budget) |
| 717 self._AddAccessors(name, result, recursion_budget) | 720 self._AddAccessors(name, result, recursion_budget) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 744 "Int32": ["32", _Int32], | 747 "Int32": ["32", _Int32], |
| 745 "JSArray": ["new Array()", _JSArray], | 748 "JSArray": ["new Array()", _JSArray], |
| 746 "JSArrayBuffer": ["new ArrayBuffer(8)", _JSArrayBuffer], | 749 "JSArrayBuffer": ["new ArrayBuffer(8)", _JSArrayBuffer], |
| 747 "JSArrayBufferView": ["new Int32Array(2)", _JSArrayBufferView], | 750 "JSArrayBufferView": ["new Int32Array(2)", _JSArrayBufferView], |
| 748 "JSDataView": ["new DataView(new ArrayBuffer(24))", _JSDataView], | 751 "JSDataView": ["new DataView(new ArrayBuffer(24))", _JSDataView], |
| 749 "JSDate": ["new Date()", _JSDate], | 752 "JSDate": ["new Date()", _JSDate], |
| 750 "JSFunction": ["function() {}", _JSFunction], | 753 "JSFunction": ["function() {}", _JSFunction], |
| 751 "JSFunctionProxy": ["Proxy.createFunction({}, function() {})", | 754 "JSFunctionProxy": ["Proxy.createFunction({}, function() {})", |
| 752 _JSFunctionProxy], | 755 _JSFunctionProxy], |
| 753 "JSGeneratorObject": ["(function*(){ yield 1; })()", _JSGeneratorObject], | 756 "JSGeneratorObject": ["(function*(){ yield 1; })()", _JSGeneratorObject], |
| 757 "JSGlobalProxy": ["this", _JSGlobalProxy], |
| 754 "JSMap": ["new Map()", _JSMap], | 758 "JSMap": ["new Map()", _JSMap], |
| 755 "JSMapIterator": ["new Map().entries()", _JSMapIterator], | 759 "JSMapIterator": ["new Map().entries()", _JSMapIterator], |
| 756 "JSObject": ["new Object()", _JSObject], | 760 "JSObject": ["new Object()", _JSObject], |
| 757 "JSProxy": ["Proxy.create({})", _JSProxy], | 761 "JSProxy": ["Proxy.create({})", _JSProxy], |
| 758 "JSReceiver": ["new Object()", _JSReceiver], | 762 "JSReceiver": ["new Object()", _JSReceiver], |
| 759 "JSRegExp": ["/ab/g", _JSRegExp], | 763 "JSRegExp": ["/ab/g", _JSRegExp], |
| 760 "JSSet": ["new Set()", _JSSet], | 764 "JSSet": ["new Set()", _JSSet], |
| 761 "JSSetIterator": ["new Set().values()", _JSSetIterator], | 765 "JSSetIterator": ["new Set().values()", _JSSetIterator], |
| 762 "JSTypedArray": ["new Int32Array(2)", _JSTypedArray], | 766 "JSTypedArray": ["new Int32Array(2)", _JSTypedArray], |
| 763 "JSValue": ["new String('foo')", _JSValue], | 767 "JSValue": ["new String('foo')", _JSValue], |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1399 for i in range(len(processes)): | 1403 for i in range(len(processes)): |
| 1400 processes[i].join() | 1404 processes[i].join() |
| 1401 except KeyboardInterrupt: | 1405 except KeyboardInterrupt: |
| 1402 stop_running.set() | 1406 stop_running.set() |
| 1403 for i in range(len(processes)): | 1407 for i in range(len(processes)): |
| 1404 processes[i].join() | 1408 processes[i].join() |
| 1405 return 0 | 1409 return 0 |
| 1406 | 1410 |
| 1407 if __name__ == "__main__": | 1411 if __name__ == "__main__": |
| 1408 sys.exit(Main()) | 1412 sys.exit(Main()) |
| OLD | NEW |