OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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: --allow-natives-syntax |
| 6 |
| 7 function C1() { } |
| 8 C1.prototype.f = function () { return 1; } |
| 9 |
| 10 function C2() { } |
| 11 C2.prototype.f = function () { throw 2; } |
| 12 |
| 13 var o1 = new C1(); |
| 14 var o2 = new C2(); |
| 15 |
| 16 function foo(o) { |
| 17 return o.f(); |
| 18 } |
| 19 |
| 20 foo(o1); |
| 21 try { foo(o2); } catch(e) {} |
| 22 foo(o1); |
| 23 try { foo(o2); } catch(e) {} |
| 24 %OptimizeFunctionOnNextCall(foo); |
| 25 assertEquals(1, foo(o1)); |
| 26 assertThrows(() => foo(o2)); |
OLD | NEW |