Home | History | Annotate | Download | only in regress
      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: --allow-natives-syntax
      6 
      7 function Inner() {
      8   this.property = "OK";
      9   this.o2 = 1;
     10 }
     11 
     12 function Outer(inner) {
     13   this.inner = inner;
     14 }
     15 
     16 var inner = new Inner();
     17 var outer = new Outer(inner);
     18 
     19 Outer.prototype.boom = function() {
     20   return this.inner.property;
     21 }
     22 
     23 assertEquals("OK", outer.boom());
     24 assertEquals("OK", outer.boom());
     25 %OptimizeFunctionOnNextCall(Outer.prototype.boom);
     26 assertEquals("OK", outer.boom());
     27 
     28 inner = undefined;
     29 %SetAllocationTimeout(0 /*interval*/, 2 /*timeout*/);
     30 // Call something that will do GC while holding a handle to outer's map.
     31 // The key is that this lets inner's map die while keeping outer's map alive.
     32 delete outer.inner;
     33 
     34 outer = new Outer({field: 1.51, property: "OK"});
     35 
     36 assertEquals("OK", outer.boom());
     37