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 | |
8 | 6 |
9 // | 7 // |
10 // Tail calls work only in strict mode. | 8 // Tail calls work only in strict mode. |
11 // | 9 // |
12 (function() { | 10 (function() { |
13 function f(n) { | 11 function f(n) { |
14 if (n <= 0) { | 12 if (n <= 0) { |
15 return "foo"; | 13 return "foo"; |
16 } | 14 } |
17 return f(n - 1); | 15 return f(n - 1); |
(...skipping 118 matching lines...) Loading... |
136 var g_bound = g0.bind({}); | 134 var g_bound = g0.bind({}); |
137 function f(n) { | 135 function f(n) { |
138 return f_bound(n); | 136 return f_bound(n); |
139 } | 137 } |
140 assertEquals("foo", f(1e5)); | 138 assertEquals("foo", f(1e5)); |
141 assertEquals("bar", f(1e5 + 1)); | 139 assertEquals("bar", f(1e5 + 1)); |
142 %OptimizeFunctionOnNextCall(f); | 140 %OptimizeFunctionOnNextCall(f); |
143 assertEquals("foo", f(1e5)); | 141 assertEquals("foo", f(1e5)); |
144 assertEquals("bar", f(1e5 + 1)); | 142 assertEquals("bar", f(1e5 + 1)); |
145 })(); | 143 })(); |
OLD | NEW |