2015-03-19 08:51:22 +00:00
|
|
|
// Copyright 2015 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
// Flags: --allow-natives-syntax
|
|
|
|
|
|
|
|
function Inner() {
|
|
|
|
this.property = "OK";
|
|
|
|
this.o2 = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
function Outer(inner) {
|
|
|
|
this.inner = inner;
|
|
|
|
}
|
|
|
|
|
|
|
|
var inner = new Inner();
|
|
|
|
var outer = new Outer(inner);
|
|
|
|
|
|
|
|
Outer.prototype.boom = function() {
|
|
|
|
return this.inner.property;
|
2019-06-14 12:54:11 +00:00
|
|
|
};
|
2015-03-19 08:51:22 +00:00
|
|
|
|
2019-06-14 12:54:11 +00:00
|
|
|
%PrepareFunctionForOptimization(Outer.prototype.boom);
|
2015-03-19 08:51:22 +00:00
|
|
|
assertEquals("OK", outer.boom());
|
|
|
|
assertEquals("OK", outer.boom());
|
|
|
|
%OptimizeFunctionOnNextCall(Outer.prototype.boom);
|
|
|
|
assertEquals("OK", outer.boom());
|
|
|
|
|
|
|
|
inner = undefined;
|
2022-02-24 14:58:27 +00:00
|
|
|
%SetAllocationTimeout(6 /*interval*/, 2 /*timeout*/);
|
2015-03-19 08:51:22 +00:00
|
|
|
// Call something that will do GC while holding a handle to outer's map.
|
|
|
|
// The key is that this lets inner's map die while keeping outer's map alive.
|
|
|
|
delete outer.inner;
|
|
|
|
|
|
|
|
outer = new Outer({field: 1.51, property: "OK"});
|
|
|
|
|
|
|
|
assertEquals("OK", outer.boom());
|