2016-12-02 15:07:02 +00:00
|
|
|
// Copyright 2016 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.
|
2022-04-04 13:07:12 +00:00
|
|
|
//
|
2022-04-28 14:22:23 +00:00
|
|
|
// Flags: --allow-natives-syntax --turbofan --no-use-osr
|
2022-04-04 13:07:12 +00:00
|
|
|
//
|
|
|
|
// Why not OSR? Because it may inline the `store` function into OSR'd code
|
|
|
|
// below before it has a chance to be optimized, making
|
|
|
|
// `assertOptimized(store)` fail.
|
2016-12-02 15:07:02 +00:00
|
|
|
|
2019-06-12 14:00:50 +00:00
|
|
|
function load(o) {
|
|
|
|
return o.x;
|
|
|
|
};
|
2016-12-02 15:07:02 +00:00
|
|
|
for (var x = 0; x < 1000; ++x) {
|
2019-06-17 15:48:42 +00:00
|
|
|
%PrepareFunctionForOptimization(load);
|
2016-12-02 15:07:02 +00:00
|
|
|
load({x});
|
|
|
|
load({x});
|
2017-01-27 10:13:53 +00:00
|
|
|
%OptimizeFunctionOnNextCall(load);
|
2019-06-12 14:00:50 +00:00
|
|
|
try {
|
|
|
|
load();
|
|
|
|
} catch (e) {
|
|
|
|
}
|
2016-12-02 15:07:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
assertOptimized(load);
|
|
|
|
|
2019-06-12 14:00:50 +00:00
|
|
|
function store(o) {
|
|
|
|
o.x = -1;
|
|
|
|
};
|
2016-12-02 15:07:02 +00:00
|
|
|
for (var x = 0; x < 1000; ++x) {
|
2019-06-17 15:48:42 +00:00
|
|
|
%PrepareFunctionForOptimization(store);
|
2016-12-02 15:07:02 +00:00
|
|
|
store({x});
|
|
|
|
store({x});
|
2017-01-27 10:13:53 +00:00
|
|
|
%OptimizeFunctionOnNextCall(store);
|
2019-06-12 14:00:50 +00:00
|
|
|
try {
|
|
|
|
store();
|
|
|
|
} catch (e) {
|
|
|
|
}
|
2016-12-02 15:07:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
assertOptimized(store);
|