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

Side by Side Diff: test/mjsunit/compiler/inlined-array-pop-opt.js

Issue 2239703002: [turbofan] Add inlined Array.prototype.pop support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Only convert hole to undefined for holey elements Created 4 years, 4 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
OLDNEW
(Empty)
1 // Copyright 2016 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
6
7 (function() {
8 function foo(a) { return a.pop(); }
9
10 var x = {};
11 var a = [x,x,];
12
13 assertEquals(x, foo(a));
14 assertEquals(x, foo(a));
15 %OptimizeFunctionOnNextCall(foo);
16 assertEquals(undefined, foo(a));
17 assertOptimized(foo);
18 })();
19
20 (function() {
21 function foo(a) { return a.pop(); }
22
23 var x = 0;
24 var a = [x,x,];
25
26 assertEquals(x, foo(a));
27 assertEquals(x, foo(a));
28 %OptimizeFunctionOnNextCall(foo);
29 assertEquals(undefined, foo(a));
30 assertOptimized(foo);
31 })();
32
33 (function() {
34 function foo(a) { return a.pop(); }
35
36 var x = 0;
37 var a = [x,x,x];
38
39 assertEquals(x, foo(a));
40 assertEquals(x, foo(a));
41 %OptimizeFunctionOnNextCall(foo);
42 assertEquals(x, foo(a));
43 assertOptimized(foo);
44 })();
45
46 (function() {
47 function foo(a) { return a.pop(); }
48
49 var x = {};
50 var a = [x,x,x];
51
52 assertEquals(x, foo(a));
53 assertEquals(x, foo(a));
54 %OptimizeFunctionOnNextCall(foo);
55 assertEquals(x, foo(a));
56 assertOptimized(foo);
57 })();
58
59 (function() {
60 function foo(a) { return a.pop(); }
61
62 var a = [,,];
63
64 assertEquals(undefined, foo(a));
65 assertEquals(undefined, foo(a));
66 %OptimizeFunctionOnNextCall(foo);
67 assertEquals(undefined, foo(a));
68 assertOptimized(foo);
69 })();
70
71 (function() {
72 var pop = Array.prototype.pop;
73
74 function foo(a) { return a.pop(); }
75
76 var a = [1, 2, 3];
77
78 assertEquals(3, foo(a));
79 assertEquals(2, foo(a));
80 %OptimizeFunctionOnNextCall(foo);
81 assertEquals(1, foo(a));
82 assertOptimized(foo);
83 })();
OLDNEW
« no previous file with comments | « test/mjsunit/compiler/inlined-array-pop-getter2.js ('k') | test/unittests/compiler/js-builtin-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698