| // 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 --expose-gc |
| // o1.map now thinks "inner" has type Inner.map1. |
| // Let Inner.map1 die by migrating i2 to Inner.map2: |
| // o1.map's descriptor for "inner" is now a cleared weak reference; |
| // o1.inner's actual map is Inner.map2. |
| // Prepare Inner.map3, deprecating Inner.map2. |
| // o2.map (Outer.map2) now says that o2.inner's type is Inner.map3. |
| // Migrate o1 to Outer.map2. |
| // o1.map now thinks that o1.inner has map Inner.map3 just like o2.inner, |
| // but in fact o1.inner.map is still Inner.map2! |
| %PrepareFunctionForOptimization(loader); |
| %OptimizeFunctionOnNextCall(loader); |
| assertEquals(0.5, loader(o2)); |
| assertEquals(3, loader(o1)); |
| gc(); // Crashes with --verify-heap. |