9284ad5731
Instead provide an abstraction that makes it hard to forget dealing with unreliable maps. This also fixes a deopt loop in Function.prototype.bind and one in Array.prototype.reduce. Bug: v8:9137 Change-Id: If6a51182c8693a62e9fb6d302cec19b4d48e25cb Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1578501 Commit-Queue: Georg Neis <neis@chromium.org> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Cr-Commit-Position: refs/heads/master@{#61106}
25 lines
608 B
JavaScript
25 lines
608 B
JavaScript
// 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.
|
|
|
|
// Flags: --allow-natives-syntax --opt
|
|
// Flags: --no-flush-bytecode --no-stress-flush-bytecode
|
|
|
|
function changeMap(obj) {
|
|
obj.blub = 42;
|
|
}
|
|
|
|
function foo(obj) {
|
|
return obj.bind(changeMap(obj));
|
|
}
|
|
|
|
%NeverOptimizeFunction(changeMap);
|
|
%PrepareFunctionForOptimization(foo);
|
|
foo(function(){});
|
|
foo(function(){});
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
foo(function(){});
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
foo(function(){});
|
|
assertOptimized(foo);
|