Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 1 | // Copyright 2014 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 | // Flags: --allow-natives-syntax |
| 5 | |
| 6 | function genM() { |
| 7 | "use strict"; |
| 8 | return function () { |
| 9 | return this.field; |
| 10 | }; |
| 11 | } |
| 12 | |
| 13 | function genR() { |
| 14 | var x = { |
| 15 | field: 10 |
| 16 | } |
| 17 | return x; |
| 18 | } |
| 19 | |
| 20 | method = {}; |
| 21 | receiver = {}; |
| 22 | |
| 23 | method = genM("A"); |
| 24 | receiver = genR("A"); |
| 25 | |
| 26 | var foo = (function () { |
| 27 | return function suspect (name) { |
| 28 | "use strict"; |
| 29 | return method.apply(receiver, arguments); |
| 30 | } |
| 31 | })(); |
| 32 | |
| 33 | foo("a", "b", "c"); |
| 34 | foo("a", "b", "c"); |
| 35 | foo("a", "b", "c"); |
| 36 | %OptimizeFunctionOnNextCall(foo); |
| 37 | foo("a", "b", "c"); |