Home | History | Annotate | Download | only in mjsunit
      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
      3 // found in the LICENSE file.
      4 
      5 // Flags: --expose-gc --min-semi-space-size=32
      6 
      7 // We need to set --min-semi-space-size to enable allocation site pretenuring.
      8 
      9 function foo(i) {
     10   with({}) {};
     11   x = {};
     12   x.a = 0.23;
     13   x.b = 0.3;
     14   return x;
     15 }
     16 
     17 var all = [];
     18 function step() {
     19   for (var i = 0; i < 100; i++) {
     20     var z = foo(i);
     21     // Write unboxed double in object slack.
     22     z.c = 0.1 + z.b
     23     all.push(z);
     24   }
     25   gc(1);
     26   gc(1);
     27 }
     28 
     29 step();
     30 // Now foo will allocate objects in old space.
     31 step();
     32