Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 1 | // Copyright 2016 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 fn1() { |
| 6 | } |
| 7 | |
| 8 | function fn2() { |
| 9 | } |
| 10 | |
| 11 | function fn3() { |
| 12 | } |
| 13 | |
| 14 | function create(id) { |
| 15 | // Just some `FunctionTemplate` to hang on |
| 16 | var o = new version(); |
| 17 | |
| 18 | o.id = id; |
| 19 | o[0] = null; |
| 20 | |
| 21 | return o; |
| 22 | } |
| 23 | |
| 24 | function setM1(o) { |
| 25 | o.m1 = fn1; |
| 26 | } |
| 27 | |
| 28 | function setM2(o) { |
| 29 | o.m2 = fn2; |
| 30 | } |
| 31 | |
| 32 | function setAltM2(o) { |
| 33 | // Failing StoreIC happens here |
| 34 | o.m2 = fn3; |
| 35 | } |
| 36 | |
| 37 | function setAltM1(o) { |
| 38 | o.m1 = null; |
| 39 | } |
| 40 | |
| 41 | function test(o) { |
| 42 | o.m2(); |
| 43 | o.m1(); |
| 44 | } |
| 45 | |
| 46 | var p0 = create(0); |
| 47 | var p1 = create(1); |
| 48 | var p2 = create(2); |
| 49 | |
| 50 | setM1(p0); |
| 51 | setM1(p1); |
| 52 | setM1(p2); |
| 53 | |
| 54 | setM2(p0); |
| 55 | setAltM2(p0); |
| 56 | setAltM1(p0); |
| 57 | |
| 58 | setAltM2(p1); |
| 59 | |
| 60 | setAltM2(p2); |
| 61 | test(p2); |