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

Side by Side Diff: test/mjsunit/call-runtime-tail.js

Issue 1259203002: [turbofan] Implement tail calls with differing stack parameter counts (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix bugs in frameless tail calls Created 5 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
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: --allow-natives-syntax --nostress-opt --turbo 5 // Flags: --allow-natives-syntax --nostress-opt --turbo
6 6
7 var p0 = new Object(); 7 var p0 = new Object();
8 var p1 = new Object(); 8 var p1 = new Object();
9 var p2 = new Object(); 9 var p2 = new Object();
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 var count3 = 100000; 43 var count3 = 100000;
44 tailee3 = function(px) { 44 tailee3 = function(px) {
45 "use strict"; 45 "use strict";
46 if (count3-- == 0) { 46 if (count3-- == 0) {
47 return this; 47 return this;
48 } 48 }
49 return %_CallFunction(px, this, tailee3); 49 return %_CallFunction(px, this, tailee3);
50 }; 50 };
51 51
52 %OptimizeFunctionOnNextCall(tailee3); 52 %OptimizeFunctionOnNextCall(tailee3);
53 assertThrows(function() { tailee3.call(p1, p2); }); 53 assertEquals(p1, tailee3.call(p1, p2));
54 54
55 // Ensure too many parameters defeats the tail call optimization (currently 55 // Ensure too many parameters defeats the tail call optimization (currently
56 // unsupported). 56 // unsupported).
57 var count4 = 1000000; 57 var count4 = 1000000;
58 tailee4 = function(px) { 58 tailee4 = function(px) {
59 "use strict"; 59 "use strict";
60 if (count4-- == 0) { 60 if (count4-- == 0) {
61 return this; 61 return this;
62 } 62 }
63 return %_CallFunction(this, px, undefined, tailee4); 63 return %_CallFunction(this, px, undefined, tailee4);
64 }; 64 };
65 65
66 %OptimizeFunctionOnNextCall(tailee4); 66 %OptimizeFunctionOnNextCall(tailee4);
67 assertThrows(function() { tailee4.call(p1, p2); }); 67 assertThrows(function() { tailee4.call(p1, p2); });
68 68
69 // Ensure too few parameters defeats the tail call optimization (currently 69 // Ensure too few parameters defeats the tail call optimization (currently
70 // unsupported). 70 // unsupported).
71 var count5 = 1000000; 71 var count5 = 1000000;
72 tailee5 = function(px) { 72 tailee5 = function(px) {
73 "use strict"; 73 "use strict";
74 if (count5-- == 0) { 74 if (count5-- == 0) {
75 return this; 75 return this;
76 } 76 }
77 return %_CallFunction(this, tailee5); 77 return %_CallFunction(this, tailee5);
78 }; 78 };
79 79
80 %OptimizeFunctionOnNextCall(tailee5); 80 %OptimizeFunctionOnNextCall(tailee5);
81 assertThrows(function() { tailee5.call(p1, p2); }); 81 assertThrows(function() { tailee5.call(p1, p2); });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698