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