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

Side by Side Diff: test/mjsunit/compiler/rest-parameters.js

Issue 2692753004: [turbofan] escape analysis supports arguments object and rest elements (Closed)
Patch Set: handle the case where Deoptimizer::function_ is a Smi Created 3 years, 9 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
« no previous file with comments | « test/mjsunit/arguments-deopt.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --allow-natives-syntax --turbo
6
7 (function Rest0Params() {
8
9 function f(x, y) {
10 return x+y;
11 }
12
13 function test(...rest) {
14 return [rest, f.apply(null, rest)];
15 }
16
17 assertEquals(test(), [[], NaN]);
18 assertEquals(test(1), [[1], NaN])
19 assertEquals(test(1, 2), [[1,2], 3]);
20 assertEquals(test(1, 2, 3), [[1,2,3], 3]);
21
22 %OptimizeFunctionOnNextCall(test);
23
24 assertEquals(test(), [[], NaN]);
25 assertEquals(test(1), [[1], NaN])
26 assertEquals(test(1, 2), [[1,2], 3]);
27 assertEquals(test(1, 2, 3), [[1,2,3], 3]);
28 })();
29
30 (function Rest1Params() {
31
32 function f(x, y) {
33 return x+y
34 }
35
36 function test(a, ...rest) {
37 return [rest, a, f.apply(null, rest)];
38 }
39
40 assertEquals(test(), [[], undefined, NaN]);
41 assertEquals(test(1), [[], 1, NaN]);
42 assertEquals(test(1, 2), [[2], 1, NaN]);
43 assertEquals(test(1, 2, 3), [[2,3], 1, 5]);
44 assertEquals(test(1, 2, 3, 4), [[2,3,4], 1, 5]);
45
46 %OptimizeFunctionOnNextCall(test);
47
48 assertEquals(test(), [[], undefined, NaN]);
49 assertEquals(test(1), [[], 1, NaN]);
50 assertEquals(test(1, 2), [[2], 1, NaN]);
51 assertEquals(test(1, 2, 3), [[2,3], 1, 5]);
52 assertEquals(test(1, 2, 3, 4), [[2,3,4], 1, 5]);
53
54 })();
OLDNEW
« no previous file with comments | « test/mjsunit/arguments-deopt.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698