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. | 6 // TODO(v8:4698), TODO(ishell): support these cases. |
7 // Flags: --no-turbo --nostress-opt | 7 // Flags: --nostress-opt |
8 | 8 |
9 // | 9 // |
10 // Tail calls work only in strict mode. | 10 // Tail calls work only in strict mode. |
11 // | 11 // |
12 (function() { | 12 (function() { |
13 function f(n) { | 13 function f(n) { |
14 if (n <= 0) { | 14 if (n <= 0) { |
15 return "foo"; | 15 return "foo"; |
16 } | 16 } |
17 return f(n - 1); | 17 return f(n - 1); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 var g_bound = g0.bind({}); | 136 var g_bound = g0.bind({}); |
137 function f(n) { | 137 function f(n) { |
138 return f_bound(n); | 138 return f_bound(n); |
139 } | 139 } |
140 assertEquals("foo", f(1e5)); | 140 assertEquals("foo", f(1e5)); |
141 assertEquals("bar", f(1e5 + 1)); | 141 assertEquals("bar", f(1e5 + 1)); |
142 %OptimizeFunctionOnNextCall(f); | 142 %OptimizeFunctionOnNextCall(f); |
143 assertEquals("foo", f(1e5)); | 143 assertEquals("foo", f(1e5)); |
144 assertEquals("bar", f(1e5 + 1)); | 144 assertEquals("bar", f(1e5 + 1)); |
145 })(); | 145 })(); |
OLD | NEW |