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 3 // found in the LICENSE file. 4 5 // Flags: --strong-mode 6 7 "use strong"; 8 9 function foo(param, fooCount, barCount) { 10 if (param === 0) 11 return {'foo': fooCount, 'bar': barCount}; 12 return bar(param - 1, fooCount + 1, barCount); 13 } 14 15 function bar(param, fooCount, barCount) { 16 if (param === 0) 17 return {'foo': fooCount, 'bar': barCount}; 18 return foo(param - 1, fooCount, barCount + 1); 19 } 20 21 (function TestMutuallyRecursiveFunctions() { 22 let obj = foo(10, 0, 0); 23 assertEquals(obj.foo, 5); 24 assertEquals(obj.bar, 5); 25 })(); 26