2016-02-01 18:10:33 +01:00
|
|
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/*---
|
|
|
|
description: Statement within statement is a candidate for tail-call optimization.
|
2018-01-10 21:44:22 +01:00
|
|
|
esid: sec-static-semantics-hascallintailposition
|
2016-02-01 18:10:33 +01:00
|
|
|
flags: [onlyStrict]
|
|
|
|
features: [tail-call-optimization]
|
2017-06-23 17:06:32 +02:00
|
|
|
includes: [tcoHelper.js]
|
2016-02-01 18:10:33 +01:00
|
|
|
---*/
|
|
|
|
|
|
|
|
var callCount = 0;
|
|
|
|
(function f(n) {
|
|
|
|
if (n === 0) {
|
|
|
|
callCount += 1
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var x;
|
|
|
|
for (x = 0; x < 1; ++x) {
|
|
|
|
return f(n - 1);
|
|
|
|
}
|
|
|
|
}($MAX_ITERATIONS));
|
|
|
|
assert.sameValue(callCount, 1);
|