| // Copyright 2014 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 --block-concurrent-recompilation |
| return function add_field(obj) { |
| function get_closure2() { |
| return function cc(obj) { |
| %PrepareFunctionForOptimization(f1); |
| %OptimizeFunctionOnNextCall(f1); |
| %PrepareFunctionForOptimization(f1); |
| %OptimizeFunctionOnNextCall(f1); |
| // Optimize add_field and install its code in optimized code cache. |
| // Optimize dummy function to remove the add_field from head of optimized |
| // function list in the context. |
| // Kill add_field in new space GC. |
| for(var i = 0; i < 3; i++) gc(true); |
| // Fetch optimized code of add_field from cache and crash. |