OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 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 | 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 --harmony-tailcalls --stack-size=100 | 5 // Flags: --allow-natives-syntax --harmony-tailcalls --stack-size=100 |
| 6 // TODO(v8:4698), TODO(ishell): support these cases. |
| 7 // Flags: --nostress-opt |
6 | 8 |
7 // | 9 // |
8 // Tail calls work only in strict mode. | 10 // Tail calls work only in strict mode. |
9 // | 11 // |
10 (function() { | 12 (function() { |
11 function f(n) { | 13 function f(n) { |
12 if (n <= 0) { | 14 if (n <= 0) { |
13 return "foo"; | 15 return "foo"; |
14 } | 16 } |
15 return f(n - 1); | 17 return f(n - 1); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 var g_bound = g0.bind({}); | 136 var g_bound = g0.bind({}); |
135 function f(n) { | 137 function f(n) { |
136 return f_bound(n); | 138 return f_bound(n); |
137 } | 139 } |
138 assertEquals("foo", f(1e5)); | 140 assertEquals("foo", f(1e5)); |
139 assertEquals("bar", f(1e5 + 1)); | 141 assertEquals("bar", f(1e5 + 1)); |
140 %OptimizeFunctionOnNextCall(f); | 142 %OptimizeFunctionOnNextCall(f); |
141 assertEquals("foo", f(1e5)); | 143 assertEquals("foo", f(1e5)); |
142 assertEquals("bar", f(1e5 + 1)); | 144 assertEquals("bar", f(1e5 + 1)); |
143 })(); | 145 })(); |
OLD | NEW |