Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 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 | function Parent() {} |
| 6 | |
| 7 | function Child() {} |
| 8 | Child.prototype = new Parent(); |
| 9 | var child = new Child(); |
| 10 | |
| 11 | function crash() { |
| 12 | return child.__proto__; |
| 13 | } |
| 14 | |
| 15 | crash(); |
| 16 | crash(); |
| 17 | |
| 18 | // Trigger a fast->slow->fast dance of Parent.prototype's map... |
| 19 | Parent.prototype.__defineSetter__("foo", function() { print("A"); }); |
| 20 | Parent.prototype.__defineSetter__("foo", function() { print("B"); }); |
| 21 | // ...and collect more type feedback. |
| 22 | crash(); |
| 23 | |
| 24 | // Now modify the prototype chain. The right cell fails to get invalidated. |
| 25 | delete Object.prototype.__proto__; |
| 26 | crash(); |