61ce45c9e2
With bytecode flushing and lazy feedback allocation, we need to call %PrepareForOptimization before we call %OptimizeFunctionOnNextCall, ideally after declaring the function. Bug: v8:8801, v8:8394, v8:9183 Change-Id: I6bf119e726426df8527d97546b6ce806112c894d Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1643167 Auto-Submit: Mathias Bynens <mathias@chromium.org> Reviewed-by: Mythri Alle <mythria@chromium.org> Commit-Queue: Mathias Bynens <mathias@chromium.org> Cr-Commit-Position: refs/heads/master@{#61988}
28 lines
515 B
JavaScript
28 lines
515 B
JavaScript
// 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.
|
|
|
|
// Flags: --allow-natives-syntax
|
|
|
|
var f = (function() {
|
|
"use asm";
|
|
function foo(x) {
|
|
return x < x;
|
|
}
|
|
return foo;
|
|
})();
|
|
|
|
%PrepareFunctionForOptimization(f);
|
|
|
|
function deopt(f) {
|
|
return {
|
|
toString: function() {
|
|
%DeoptimizeFunction(f);
|
|
return "2";
|
|
}
|
|
};
|
|
}
|
|
|
|
%OptimizeFunctionOnNextCall(f);
|
|
assertFalse(f(deopt(f)));
|