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

Side by Side Diff: test/mjsunit/arguments-deopt.js

Issue 2664423003: [turbofan] fix wrong materialization of arguments object (Closed)
Patch Set: merged test files Created 3 years, 10 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 | « src/compiler/js-call-reducer.cc ('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 MaterializeStrictArguments() {
8 "use strict"
9
10 function f(x, y) {
11 return x + y;
12 }
13
14 function test() {
15 %DeoptimizeNow();
16 return f.apply(null, arguments);
17 }
18
19 assertEquals(test(1, 2), 3);
20 assertEquals(test(1, 2, 3), 3);
21
22 %OptimizeFunctionOnNextCall(test);
23 assertEquals(test(1, 2), 3);
24 %OptimizeFunctionOnNextCall(test);
25 assertEquals(test(1, 2, 3), 3);
26 })();
27
28 (function MaterializeSloppyArguments() {
29 function f(x, y) {
30 return x + y;
31 }
32
33 function test() {
34 %DeoptimizeNow();
35 return f.apply(null, arguments);
36 }
37
38 assertEquals(test(1, 2), 3);
39 assertEquals(test(1, 2, 3), 3);
40
41 %OptimizeFunctionOnNextCall(test);
42 assertEquals(test(1, 2), 3);
43 %OptimizeFunctionOnNextCall(test);
44 assertEquals(test(1, 2, 3), 3);
45 })();
46
47 (function MaterializeStrictOverwrittenArguments() {
48 "use strict"
49
50 function f(x, y) {
51 return x + y;
52 }
53
54 function test(a, b) {
55 a = 4;
56 %DeoptimizeNow();
57 return f.apply(null, arguments);
58 }
59
60 assertEquals(test(1, 2), 3);
61 assertEquals(test(1, 2, 3), 3);
62
63 %OptimizeFunctionOnNextCall(test);
64 assertEquals(test(1, 2), 3);
65 %OptimizeFunctionOnNextCall(test);
66 assertEquals(test(1, 2, 3), 3);
67 })();
68
69 (function MaterializeSloppyOverwrittenArguments() {
70 function f(x, y) {
71 return x + y;
72 }
73
74 function test(a, b) {
75 a = 4;
76 %DeoptimizeNow();
77 return f.apply(null, arguments);
78 }
79
80 test(1, 2);
81 test(3, 4, 5);
82
83 assertEquals(test(1, 2), 6);
84 assertEquals(test(1, 2, 3), 6);
85
86 %OptimizeFunctionOnNextCall(test);
87 assertEquals(test(1, 2), 6);
88 %OptimizeFunctionOnNextCall(test);
89 assertEquals(test(1, 2, 3), 6);
90 })();
OLDNEW
« no previous file with comments | « src/compiler/js-call-reducer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698