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

Side by Side Diff: tools/generate-runtime-tests.py

Issue 259883002: ES6: Add support for Map and Set Iterator (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Code review changes Created 6 years, 6 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
« no previous file with comments | « test/mjsunit/runtime-gen/setiteratornext.js ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 # TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION 44 # TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION
45 45
46 # Counts of functions in each detection state. These are used to assert 46 # Counts of functions in each detection state. These are used to assert
47 # that the parser doesn't bit-rot. Change the values as needed when you add, 47 # that the parser doesn't bit-rot. Change the values as needed when you add,
48 # remove or change runtime functions, but make sure we don't lose our ability 48 # remove or change runtime functions, but make sure we don't lose our ability
49 # to parse them! 49 # to parse them!
50 EXPECTED_FUNCTION_COUNT = 358 50 EXPECTED_FUNCTION_COUNT = 358
51 EXPECTED_FUZZABLE_COUNT = 325 51 EXPECTED_FUZZABLE_COUNT = 325
52 EXPECTED_CCTEST_COUNT = 6 52 EXPECTED_CCTEST_COUNT = 6
53 EXPECTED_UNKNOWN_COUNT = 5 53 EXPECTED_UNKNOWN_COUNT = 5
54 EXPECTED_BUILTINS_COUNT = 782 54 EXPECTED_BUILTINS_COUNT = 797
55 55
56 56
57 # Don't call these at all. 57 # Don't call these at all.
58 BLACKLISTED = [ 58 BLACKLISTED = [
59 "Abort", # Kills the process. 59 "Abort", # Kills the process.
60 "AbortJS", # Kills the process. 60 "AbortJS", # Kills the process.
61 "CompileForOnStackReplacement", # Riddled with ASSERTs. 61 "CompileForOnStackReplacement", # Riddled with ASSERTs.
62 "IS_VAR", # Not implemented in the runtime. 62 "IS_VAR", # Not implemented in the runtime.
63 "ListNatives", # Not available in Release mode. 63 "ListNatives", # Not available in Release mode.
64 "SetAllocationTimeout", # Too slow for fuzzing. 64 "SetAllocationTimeout", # Too slow for fuzzing.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 "InternalNumberFormat": [_NUMBER_FORMAT, None, None], 152 "InternalNumberFormat": [_NUMBER_FORMAT, None, None],
153 "InternalNumberParse": [_NUMBER_FORMAT, None, None], 153 "InternalNumberParse": [_NUMBER_FORMAT, None, None],
154 "IsSloppyModeFunction": ["function() {}", None], 154 "IsSloppyModeFunction": ["function() {}", None],
155 "LoadMutableDouble": ["{foo: 1.2}", None, None], 155 "LoadMutableDouble": ["{foo: 1.2}", None, None],
156 "NewObjectFromBound": ["(function() {}).bind({})", None], 156 "NewObjectFromBound": ["(function() {}).bind({})", None],
157 "NumberToRadixString": [None, "2", None], 157 "NumberToRadixString": [None, "2", None],
158 "ParseJson": ["\"{}\"", 1], 158 "ParseJson": ["\"{}\"", 1],
159 "RegExpExecMultiple": [None, None, "['a']", "['a']", None], 159 "RegExpExecMultiple": [None, None, "['a']", "['a']", None],
160 "SetAccessorProperty": [None, None, "undefined", "undefined", None, None, 160 "SetAccessorProperty": [None, None, "undefined", "undefined", None, None,
161 None], 161 None],
162 "SetCreateIterator": [None, "2", None], 162 "SetIteratorInitialize": [None, None, "2", None],
163 "SetDebugEventListener": ["undefined", None, None], 163 "SetDebugEventListener": ["undefined", None, None],
164 "SetFunctionBreakPoint": [None, 200, None, None], 164 "SetFunctionBreakPoint": [None, 200, None, None],
165 "StringBuilderConcat": ["[1, 2, 3]", 3, None, None], 165 "StringBuilderConcat": ["[1, 2, 3]", 3, None, None],
166 "StringBuilderJoin": ["['a', 'b']", 4, None, None], 166 "StringBuilderJoin": ["['a', 'b']", 4, None, None],
167 "StringMatch": [None, None, "['a', 'b']", None], 167 "StringMatch": [None, None, "['a', 'b']", None],
168 "StringNormalize": [None, 2, None], 168 "StringNormalize": [None, 2, None],
169 "StringReplaceGlobalRegExpWithString": [None, None, None, "['a']", None], 169 "StringReplaceGlobalRegExpWithString": [None, None, None, "['a']", None],
170 "TypedArrayInitialize": [None, 6, "new ArrayBuffer(8)", None, 4, None], 170 "TypedArrayInitialize": [None, 6, "new ArrayBuffer(8)", None, 4, None],
171 "TypedArrayInitializeFromArrayLike": [None, 6, None, None, None], 171 "TypedArrayInitializeFromArrayLike": [None, 6, None, None, None],
172 "TypedArraySetFastCases": [None, None, "0", None], 172 "TypedArraySetFastCases": [None, None, "0", None],
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 result += self._JSObject(key_name, recursion_budget - 1) 516 result += self._JSObject(key_name, recursion_budget - 1)
517 else: 517 else:
518 result += self._Object(key_name, recursion_budget - 1) 518 result += self._Object(key_name, recursion_budget - 1)
519 result += self._Object(value_name, recursion_budget - 1) 519 result += self._Object(value_name, recursion_budget - 1)
520 result.append("%s.set(%s, %s)" % (name, key_name, value_name)) 520 result.append("%s.set(%s, %s)" % (name, key_name, value_name))
521 return result 521 return result
522 522
523 def _JSMapIterator(self, name, recursion_budget): 523 def _JSMapIterator(self, name, recursion_budget):
524 map_name = name + "_map" 524 map_name = name + "_map"
525 result = self._JSMap(map_name, recursion_budget) 525 result = self._JSMap(map_name, recursion_budget)
526 iterator_type = random.randint(1, 3) 526 iterator_type = random.choice(['keys', 'values', 'entries'])
527 return (result + self._Variable(name, "%%MapCreateIterator(%s, %d)" % 527 return (result + self._Variable(name, "%s.%s()" %
528 (map_name, iterator_type))) 528 (map_name, iterator_type)))
529 529
530 def _JSProxy(self, name, recursion_budget): 530 def _JSProxy(self, name, recursion_budget):
531 # TODO(jkummerow): Revisit this as the Proxy implementation evolves. 531 # TODO(jkummerow): Revisit this as the Proxy implementation evolves.
532 return self._Variable(name, "Proxy.create(%s)" % self.PROXY_TRAPS) 532 return self._Variable(name, "Proxy.create(%s)" % self.PROXY_TRAPS)
533 533
534 def _JSRegExp(self, name, recursion_budget): 534 def _JSRegExp(self, name, recursion_budget):
535 flags = random.choice(["", "g", "i", "m", "gi"]) 535 flags = random.choice(["", "g", "i", "m", "gi"])
536 string = "a(b|c)*a" # TODO(jkummerow): Be more creative here? 536 string = "a(b|c)*a" # TODO(jkummerow): Be more creative here?
537 ctor = random.choice(["/%s/%s", "new RegExp(\"%s\", \"%s\")"]) 537 ctor = random.choice(["/%s/%s", "new RegExp(\"%s\", \"%s\")"])
538 return self._Variable(name, ctor % (string, flags)) 538 return self._Variable(name, ctor % (string, flags))
539 539
540 def _JSSet(self, name, recursion_budget, weak=""): 540 def _JSSet(self, name, recursion_budget, weak=""):
541 result = self._Variable(name, "new %sSet()" % weak) 541 result = self._Variable(name, "new %sSet()" % weak)
542 num_entries = random.randint(0, 3) 542 num_entries = random.randint(0, 3)
543 for i in range(num_entries): 543 for i in range(num_entries):
544 element_name = "%s_e%d" % (name, i) 544 element_name = "%s_e%d" % (name, i)
545 if weak: 545 if weak:
546 result += self._JSObject(element_name, recursion_budget - 1) 546 result += self._JSObject(element_name, recursion_budget - 1)
547 else: 547 else:
548 result += self._Object(element_name, recursion_budget - 1) 548 result += self._Object(element_name, recursion_budget - 1)
549 result.append("%s.add(%s)" % (name, element_name)) 549 result.append("%s.add(%s)" % (name, element_name))
550 return result 550 return result
551 551
552 def _JSSetIterator(self, name, recursion_budget): 552 def _JSSetIterator(self, name, recursion_budget):
553 set_name = name + "_set" 553 set_name = name + "_set"
554 result = self._JSSet(set_name, recursion_budget) 554 result = self._JSSet(set_name, recursion_budget)
555 iterator_type = random.randint(2, 3) 555 iterator_type = random.choice(['values', 'entries'])
556 return (result + self._Variable(name, "%%SetCreateIterator(%s, %d)" % 556 return (result + self._Variable(name, "%s.%s()" %
557 (set_name, iterator_type))) 557 (set_name, iterator_type)))
558 558
559 def _JSTypedArray(self, name, recursion_budget): 559 def _JSTypedArray(self, name, recursion_budget):
560 arraytype = random.choice(["Int8", "Int16", "Int32", "Uint8", "Uint16", 560 arraytype = random.choice(["Int8", "Int16", "Int32", "Uint8", "Uint16",
561 "Uint32", "Float32", "Float64", "Uint8Clamped"]) 561 "Uint32", "Float32", "Float64", "Uint8Clamped"])
562 ctor_type = random.randint(0, 3) 562 ctor_type = random.randint(0, 3)
563 if ctor_type == 0: 563 if ctor_type == 0:
564 length = random.randint(0, 1000) 564 length = random.randint(0, 1000)
565 return self._Variable(name, "new %sArray(%d)" % (arraytype, length), 565 return self._Variable(name, "new %sArray(%d)" % (arraytype, length),
566 fallback="new %sArray(8)" % arraytype) 566 fallback="new %sArray(8)" % arraytype)
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 "JSArray": ["new Array()", _JSArray], 659 "JSArray": ["new Array()", _JSArray],
660 "JSArrayBuffer": ["new ArrayBuffer(8)", _JSArrayBuffer], 660 "JSArrayBuffer": ["new ArrayBuffer(8)", _JSArrayBuffer],
661 "JSArrayBufferView": ["new Int32Array(2)", _JSArrayBufferView], 661 "JSArrayBufferView": ["new Int32Array(2)", _JSArrayBufferView],
662 "JSDataView": ["new DataView(new ArrayBuffer(24))", _JSDataView], 662 "JSDataView": ["new DataView(new ArrayBuffer(24))", _JSDataView],
663 "JSDate": ["new Date()", _JSDate], 663 "JSDate": ["new Date()", _JSDate],
664 "JSFunction": ["function() {}", _JSFunction], 664 "JSFunction": ["function() {}", _JSFunction],
665 "JSFunctionProxy": ["Proxy.createFunction({}, function() {})", 665 "JSFunctionProxy": ["Proxy.createFunction({}, function() {})",
666 _JSFunctionProxy], 666 _JSFunctionProxy],
667 "JSGeneratorObject": ["(function*(){ yield 1; })()", _JSGeneratorObject], 667 "JSGeneratorObject": ["(function*(){ yield 1; })()", _JSGeneratorObject],
668 "JSMap": ["new Map()", _JSMap], 668 "JSMap": ["new Map()", _JSMap],
669 "JSMapIterator": ["%MapCreateIterator(new Map(), 3)", _JSMapIterator], 669 "JSMapIterator": ["new Map().entries()", _JSMapIterator],
670 "JSObject": ["new Object()", _JSObject], 670 "JSObject": ["new Object()", _JSObject],
671 "JSProxy": ["Proxy.create({})", _JSProxy], 671 "JSProxy": ["Proxy.create({})", _JSProxy],
672 "JSReceiver": ["new Object()", _JSReceiver], 672 "JSReceiver": ["new Object()", _JSReceiver],
673 "JSRegExp": ["/ab/g", _JSRegExp], 673 "JSRegExp": ["/ab/g", _JSRegExp],
674 "JSSet": ["new Set()", _JSSet], 674 "JSSet": ["new Set()", _JSSet],
675 "JSSetIterator": ["%SetCreateIterator(new Set(), 2)", _JSSetIterator], 675 "JSSetIterator": ["new Set().values()", _JSSetIterator],
676 "JSTypedArray": ["new Int32Array(2)", _JSTypedArray], 676 "JSTypedArray": ["new Int32Array(2)", _JSTypedArray],
677 "JSValue": ["new String('foo')", _JSValue], 677 "JSValue": ["new String('foo')", _JSValue],
678 "JSWeakCollection": ["new WeakMap()", _JSWeakCollection], 678 "JSWeakCollection": ["new WeakMap()", _JSWeakCollection],
679 "Name": ["\"name\"", _Name], 679 "Name": ["\"name\"", _Name],
680 "Number": ["1.5", _Number], 680 "Number": ["1.5", _Number],
681 "Object": ["new Object()", _Object], 681 "Object": ["new Object()", _Object],
682 "PropertyDetails": ["513", _PropertyDetails], 682 "PropertyDetails": ["513", _PropertyDetails],
683 "SeqOneByteString": ["\"seq 1-byte\"", _SeqString], 683 "SeqOneByteString": ["\"seq 1-byte\"", _SeqString],
684 "SeqString": ["\"seqstring\"", _SeqString], 684 "SeqString": ["\"seqstring\"", _SeqString],
685 "SeqTwoByteString": ["\"seq \\u2082-byte\"", _SeqTwoByteString], 685 "SeqTwoByteString": ["\"seq \\u2082-byte\"", _SeqTwoByteString],
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 for i in range(len(processes)): 1314 for i in range(len(processes)):
1315 processes[i].join() 1315 processes[i].join()
1316 except KeyboardInterrupt: 1316 except KeyboardInterrupt:
1317 stop_running.set() 1317 stop_running.set()
1318 for i in range(len(processes)): 1318 for i in range(len(processes)):
1319 processes[i].join() 1319 processes[i].join()
1320 return 0 1320 return 0
1321 1321
1322 if __name__ == "__main__": 1322 if __name__ == "__main__":
1323 sys.exit(Main()) 1323 sys.exit(Main())
OLDNEW
« no previous file with comments | « test/mjsunit/runtime-gen/setiteratornext.js ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698