2014-09-03 12:13:46 +00:00
|
|
|
// Copyright 2014 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
// Flags: --allow-natives-syntax
|
|
|
|
|
|
|
|
var o1 = {};
|
|
|
|
var o2 = {};
|
|
|
|
|
|
|
|
function foo(x) {
|
|
|
|
return x.bar;
|
|
|
|
}
|
|
|
|
|
2019-06-12 14:00:50 +00:00
|
|
|
Object.defineProperty(o1, 'bar', {value: 200});
|
2014-09-03 12:13:46 +00:00
|
|
|
foo(o1);
|
|
|
|
foo(o1);
|
|
|
|
|
|
|
|
function f(b) {
|
|
|
|
var o = o2;
|
2019-06-12 14:00:50 +00:00
|
|
|
if (b) {
|
|
|
|
return foo(o);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
%PrepareFunctionForOptimization(f);
|
2014-09-03 12:13:46 +00:00
|
|
|
f(false);
|
|
|
|
%OptimizeFunctionOnNextCall(f);
|
|
|
|
assertEquals(undefined, f(false));
|
2019-06-12 14:00:50 +00:00
|
|
|
Object.defineProperty(o2, 'bar', {value: 100});
|
2014-09-03 12:13:46 +00:00
|
|
|
assertEquals(100, f(true));
|