2019-05-01 08:39:49 +00:00
|
|
|
// Copyright 2019 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-28 14:22:23 +00:00
|
|
|
// Flags: --allow-natives-syntax --turbofan
|
2021-08-02 15:10:58 +00:00
|
|
|
// Flags: --no-flush-bytecode --no-stress-flush-code
|
2019-05-01 08:39:49 +00:00
|
|
|
|
|
|
|
function changeMap(obj) {
|
|
|
|
obj.blub = 42;
|
|
|
|
}
|
|
|
|
|
|
|
|
function reducer(acc, val, i, obj) {
|
|
|
|
return changeMap(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
function foo(obj) {
|
|
|
|
return obj.reduce(reducer);
|
|
|
|
}
|
|
|
|
|
|
|
|
%NeverOptimizeFunction(reducer);
|
|
|
|
%PrepareFunctionForOptimization(foo);
|
|
|
|
foo([0, 1, 2]);
|
|
|
|
foo([0, 1, 2]);
|
|
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
|
|
foo([0, 1, 2]);
|
2019-06-14 13:05:18 +00:00
|
|
|
%PrepareFunctionForOptimization(foo);
|
2019-05-01 08:39:49 +00:00
|
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
|
|
foo([0, 1, 2]);
|
|
|
|
assertOptimized(foo);
|