Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +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 | // Flags: --harmony-tailcalls --allow-natives-syntax |
| 6 | |
| 7 | "use strict"; |
| 8 | |
| 9 | function h() { |
| 10 | var stack = (new Error("boom")).stack; |
| 11 | print(stack); |
| 12 | %DeoptimizeFunction(f1); |
| 13 | %DeoptimizeFunction(f2); |
| 14 | %DeoptimizeFunction(f3); |
| 15 | %DeoptimizeFunction(g); |
| 16 | %DeoptimizeFunction(h); |
| 17 | return 1; |
| 18 | } |
| 19 | %NeverOptimizeFunction(h); |
| 20 | |
| 21 | function g(v) { |
| 22 | return h(); |
| 23 | } |
| 24 | %SetForceInlineFlag(g); |
| 25 | |
| 26 | |
| 27 | function f1() { |
| 28 | var o = {}; |
| 29 | o.__defineGetter__('p', g); |
| 30 | o.p; |
| 31 | } |
| 32 | |
| 33 | f1(); |
| 34 | f1(); |
| 35 | %OptimizeFunctionOnNextCall(f1); |
| 36 | f1(); |
| 37 | |
| 38 | |
| 39 | function f2() { |
| 40 | var o = {}; |
| 41 | o.__defineSetter__('q', g); |
| 42 | o.q = 1; |
| 43 | } |
| 44 | |
| 45 | f2(); |
| 46 | f2(); |
| 47 | %OptimizeFunctionOnNextCall(f2); |
| 48 | f2(); |
| 49 | |
| 50 | |
| 51 | function A() { |
| 52 | return h(); |
| 53 | } |
| 54 | |
| 55 | function f3() { |
| 56 | new A(); |
| 57 | } |
| 58 | |
| 59 | f3(); |
| 60 | f3(); |
| 61 | %OptimizeFunctionOnNextCall(f3); |
| 62 | f3(); |