tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

regress-427798.js (1321B)


      1 /* -*- indent-tabs-mode: nil; js-indent-level: 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/. */
      5 
      6 //-----------------------------------------------------------------------------
      7 var BUGNUMBER = 427798;
      8 var summary = 'js_PutBlockObject is slow';
      9 var actual = 'Good result';
     10 var expect = 'Good result';
     11 
     12 
     13 //-----------------------------------------------------------------------------
     14 test();
     15 //-----------------------------------------------------------------------------
     16 
     17 function test()
     18 {
     19  printBugNumber(BUGNUMBER);
     20  printStatus (summary);
     21 
     22  function f(N)
     23  {
     24    for (var i = 0; i != N; ++i) {
     25      var f, g;
     26      {
     27        let j = i + 1;
     28        f = function() { j += 2; return j; }
     29        if (f() != i + 3)
     30          throw "Bad result";
     31      }
     32      if (f() != i + 5)
     33        throw "Bad result";
     34      {
     35        let j = i + 1, k = i + 2;
     36        f = function() { j += 2; k++; return j + k; }
     37        if (f() != i + i + 6)
     38          throw "Bad result";
     39      }
     40      if (f() != i + i + 9)
     41        throw "Bad result";
     42    }
     43  }
     44 
     45  try
     46  {
     47    f(20*1000);
     48  }
     49  catch(ex)
     50  {
     51    actual = ex + '';
     52  }
     53 
     54  reportCompare(expect, actual, summary);
     55 }