OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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: --strong-mode --harmony-arrow-functions --harmony-reflect | 5 // Flags: --strong-mode --harmony-arrow-functions --harmony-reflect |
6 // Flags: --harmony-spreadcalls --harmony-rest-parameters --allow-natives-syntax | 6 // Flags: --harmony-spreadcalls --harmony-rest-parameters --allow-natives-syntax |
7 | 7 |
8 'use strict'; | 8 'use strict'; |
9 | 9 |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 for (let argumentCount = 0; argumentCount < 3; argumentCount++) { | 65 for (let argumentCount = 0; argumentCount < 3; argumentCount++) { |
66 let calls = [ | 66 let calls = [ |
67 `f(${generateArguments(argumentCount)})`, | 67 `f(${generateArguments(argumentCount)})`, |
68 `f(${generateSpread(argumentCount)})`, | 68 `f(${generateSpread(argumentCount)})`, |
69 `f.call(${generateArguments(argumentCount, 'undefined')})`, | 69 `f.call(${generateArguments(argumentCount, 'undefined')})`, |
70 `f.call(undefined, ${generateSpread(argumentCount)})`, | 70 `f.call(undefined, ${generateSpread(argumentCount)})`, |
71 `f.apply(undefined, [${generateArguments(argumentCount)}])`, | 71 `f.apply(undefined, [${generateArguments(argumentCount)}])`, |
72 `f.bind(undefined)(${generateArguments(argumentCount)})`, | 72 `f.bind(undefined)(${generateArguments(argumentCount)})`, |
73 `%_CallFunction(${generateArguments(argumentCount, 'undefined')}, | 73 `%_CallFunction(${generateArguments(argumentCount, 'undefined')}, |
74 f)`, | 74 f)`, |
75 `%Call(${generateArguments(argumentCount, 'undefined')}, f)`, | 75 `%Call(f, ${generateArguments(argumentCount, 'undefined')})`, |
76 `%Apply(f, undefined, [${generateArguments(argumentCount)}], 0, | 76 `%Apply(f, undefined, [${generateArguments(argumentCount)}], 0, |
77 ${argumentCount})`, | 77 ${argumentCount})`, |
78 ]; | 78 ]; |
79 | 79 |
80 for (let call of calls) { | 80 for (let call of calls) { |
81 let code = `'use strict'; ${def}; ${call};`; | 81 let code = `'use strict'; ${def}; ${call};`; |
82 if (argumentCount < parameterCount) { | 82 if (argumentCount < parameterCount) { |
83 print(code); | 83 print(code); |
84 assertThrows(code, TypeError); | 84 assertThrows(code, TypeError); |
85 } else { | 85 } else { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 for (let def of defs) { | 128 for (let def of defs) { |
129 for (let argumentCount = 0; argumentCount < 3; argumentCount++) { | 129 for (let argumentCount = 0; argumentCount < 3; argumentCount++) { |
130 let calls = [ | 130 let calls = [ |
131 `o.m(${generateArguments(argumentCount)})`, | 131 `o.m(${generateArguments(argumentCount)})`, |
132 `o.m(${generateSpread(argumentCount)})`, | 132 `o.m(${generateSpread(argumentCount)})`, |
133 `o.m.call(${generateArguments(argumentCount, 'o')})`, | 133 `o.m.call(${generateArguments(argumentCount, 'o')})`, |
134 `o.m.call(o, ${generateSpread(argumentCount)})`, | 134 `o.m.call(o, ${generateSpread(argumentCount)})`, |
135 `o.m.apply(o, [${generateArguments(argumentCount)}])`, | 135 `o.m.apply(o, [${generateArguments(argumentCount)}])`, |
136 `o.m.bind(o)(${generateArguments(argumentCount)})`, | 136 `o.m.bind(o)(${generateArguments(argumentCount)})`, |
137 `%_CallFunction(${generateArguments(argumentCount, 'o')}, o.m)`, | 137 `%_CallFunction(${generateArguments(argumentCount, 'o')}, o.m)`, |
138 `%Call(${generateArguments(argumentCount, 'o')}, o.m)`, | 138 `%Call(o.m, ${generateArguments(argumentCount, 'o')})`, |
139 `%Apply(o.m, o, [${generateArguments(argumentCount)}], 0, | 139 `%Apply(o.m, o, [${generateArguments(argumentCount)}], 0, |
140 ${argumentCount})`, | 140 ${argumentCount})`, |
141 ]; | 141 ]; |
142 | 142 |
143 for (let call of calls) { | 143 for (let call of calls) { |
144 let code = `'use strict'; ${def}; ${call};`; | 144 let code = `'use strict'; ${def}; ${call};`; |
145 if (argumentCount < parameterCount) { | 145 if (argumentCount < parameterCount) { |
146 assertThrows(code, TypeError); | 146 assertThrows(code, TypeError); |
147 } else { | 147 } else { |
148 assertDoesNotThrow(code); | 148 assertDoesNotThrow(code); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 if (argumentCount < parameterCount) { | 333 if (argumentCount < parameterCount) { |
334 assertThrows(code, TypeError); | 334 assertThrows(code, TypeError); |
335 } else { | 335 } else { |
336 assertDoesNotThrow(code); | 336 assertDoesNotThrow(code); |
337 } | 337 } |
338 } | 338 } |
339 } | 339 } |
340 } | 340 } |
341 } | 341 } |
342 })(); | 342 })(); |
OLD | NEW |