Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 //-----------------------------------------------------------------------------
7 var BUGNUMBER = 507053;
8 var summary = 'TM: invalid results with setting a closure variable in a loop'
9 var actual = '';
10 var expect = '2,4,8,16,32,2,4,8,16,32,2,4,8,16,32,2,4,8,16,32,2,4,8,16,32,';
13 //-----------------------------------------------------------------------------
14 start_test();
15 jit(true);
17 var f = function() {
18 var p = 1;
20 function g() {
21 for (var i = 0; i < 5; ++i) {
22 p = p * 2;
23 actual += p + ',';
24 }
25 }
26 g();
27 }
29 for (var i = 0; i < 5; ++i) {
30 f();
31 }
33 jit(false);
34 finish_test();
35 //-----------------------------------------------------------------------------
37 function start_test()
38 {
39 enterFunc ('test');
40 printBugNumber(BUGNUMBER);
41 printStatus (summary);
42 }
44 function finish_test()
45 {
46 reportCompare(expect, actual, summary);
47 exitFunc ('test');
48 }