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.
5 // Flags: --allow-natives-syntax
12 function Outer(inner) {
16 var inner = new Inner();
17 var outer = new Outer(inner);
19 Outer.prototype.boom = function() {
20 return this.inner.property;
23 assertEquals("OK", outer.boom());
24 assertEquals("OK", outer.boom());
25 %OptimizeFunctionOnNextCall(Outer.prototype.boom);
26 assertEquals("OK", outer.boom());
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.
34 outer = new Outer({field: 1.51, property: "OK"});
36 assertEquals("OK", outer.boom());