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.
|
|
|
|
|
2017-04-28 13:33:43 +00:00
|
|
|
// Flags: --allow-natives-syntax --opt
|
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);
|