OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --allow-natives-syntax | |
6 | |
7 // TODO(jkummerow): There are many ways to improve these tests, e.g.: | 5 // TODO(jkummerow): There are many ways to improve these tests, e.g.: |
8 // - more variance in randomized inputs | 6 // - more variance in randomized inputs |
9 // - better time complexity management | 7 // - better time complexity management |
10 // - better code readability and documentation of intentions. | 8 // - better code readability and documentation of intentions. |
11 | 9 |
12 var RUN_WITH_ALL_ARGUMENT_ENTRIES = false; | 10 var RUN_WITH_ALL_ARGUMENT_ENTRIES = false; |
13 var kOnManyArgumentsRemove = 5; | 11 var kOnManyArgumentsRemove = 5; |
14 | 12 |
15 function makeArguments() { | 13 function makeArguments() { |
16 var result = [ ]; | 14 var result = [ ]; |
17 result.push(17); | 15 result.push(17); |
18 result.push(-31); | 16 result.push(-31); |
19 result.push(new Array(100)); | 17 result.push(new Array(100)); |
20 var a = %NormalizeElements([]); | 18 result.push(new Array(100003)); |
21 a.length = 100003; | |
22 result.push(a); | |
23 result.push(Number.MIN_VALUE); | 19 result.push(Number.MIN_VALUE); |
24 result.push("whoops"); | 20 result.push("whoops"); |
25 result.push("x"); | 21 result.push("x"); |
26 result.push({"x": 1, "y": 2}); | 22 result.push({"x": 1, "y": 2}); |
27 var slowCaseObj = {"a": 3, "b": 4, "c": 5}; | 23 var slowCaseObj = {"a": 3, "b": 4, "c": 5}; |
28 delete slowCaseObj.c; | 24 delete slowCaseObj.c; |
29 result.push(slowCaseObj); | 25 result.push(slowCaseObj); |
30 result.push(function () { return 8; }); | 26 result.push(function () { return 8; }); |
31 return result; | 27 return result; |
32 } | 28 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 func.apply(void 0, argList); | 90 func.apply(void 0, argList); |
95 } catch (e) { | 91 } catch (e) { |
96 // we don't care what happens as long as we don't crash | 92 // we don't care what happens as long as we don't crash |
97 } | 93 } |
98 type++; | 94 type++; |
99 } | 95 } |
100 } | 96 } |
101 | 97 |
102 testArgumentCount(NAME, ARGC); | 98 testArgumentCount(NAME, ARGC); |
103 testArgumentTypes(NAME, ARGC); | 99 testArgumentTypes(NAME, ARGC); |
OLD | NEW |