blob: 303639c74f0840f8af6b69ff7b01e9f364716ebe [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// 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));