OLD | NEW |
(Empty) | |
| 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 |
| 5 // Flags: --allow-natives-syntax |
| 6 |
| 7 var o1 = {}; |
| 8 var o2 = {}; |
| 9 |
| 10 function foo(x) { |
| 11 return x.bar; |
| 12 } |
| 13 |
| 14 Object.defineProperty(o1, "bar", {value:200}); |
| 15 foo(o1); |
| 16 foo(o1); |
| 17 |
| 18 function f(b) { |
| 19 var o = o2; |
| 20 if (b) { return foo(o) } |
| 21 } |
| 22 |
| 23 f(false); |
| 24 %OptimizeFunctionOnNextCall(f); |
| 25 assertEquals(undefined, f(false)); |
| 26 Object.defineProperty(o2, "bar", {value: 100}); |
| 27 assertEquals(100, f(true)); |
OLD | NEW |