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 7function Inner() { 8 this.property = "OK"; 9 this.o2 = 1; 10} 11 12function Outer(inner) { 13 this.inner = inner; 14} 15 16var inner = new Inner(); 17var outer = new Outer(inner); 18 19Outer.prototype.boom = function() { 20 return this.inner.property; 21} 22 23assertEquals("OK", outer.boom()); 24assertEquals("OK", outer.boom()); 25%OptimizeFunctionOnNextCall(Outer.prototype.boom); 26assertEquals("OK", outer.boom()); 27 28inner = 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. 32delete outer.inner; 33 34outer = new Outer({field: 1.51, property: "OK"}); 35 36assertEquals("OK", outer.boom()); 37