v8/test/mjsunit/compiler/deopt-tonumber-binop.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
833 B
JavaScript
Raw Normal View History

[turbofan] Fix lazy deopt for JSToNumber conversions in binary operations. This slightly hacky change provides lazy deopt points for to-number conversions in binops: When we deopt from a to-number conversion, we create a frame state with the already-converted value(s) so that we do not repeat the side effect of the conversion. Embenchen numbers are below. It is not quite clear what happened to fasta - the hot code looks nearly identical. Current: EmbenchenBox2d(RunTime): 12746 ms. d8-master: EmbenchenBox2d(RunTime): 13861 ms. ----------- bullet.js Current: EmbenchenBullet(RunTime): 17680 ms. d8-master: EmbenchenBullet(RunTime): 19170 ms. ----------- copy.js Current: EmbenchenCopy(RunTime): 4939 ms. d8-master: EmbenchenCopy(RunTime): 4943 ms. ----------- corrections.js Current: EmbenchenCorrections(RunTime): 6639 ms. d8-master: EmbenchenCorrections(RunTime): 6728 ms. ----------- fannkuch.js Current: EmbenchenFannkuch(RunTime): 4630 ms. d8-master: EmbenchenFannkuch(RunTime): 4872 ms. ----------- fasta.js Current: EmbenchenFasta(RunTime): 10209 ms. d8-master: EmbenchenFasta(RunTime): 9673 ms. ----------- lua_binarytrees.js Current: EmbenchenLuaBinaryTrees(RunTime): 12936 ms. d8-master: EmbenchenLuaBinaryTrees(RunTime): 15529 ms. ----------- memops.js Current: EmbenchenMemOps(RunTime): 7357 ms. d8-master: EmbenchenMemOps(RunTime): 7340 ms. ----------- primes.js Current: EmbenchenPrimes(RunTime): 7530 ms. d8-master: EmbenchenPrimes(RunTime): 7457 ms. ----------- skinning.js Current: EmbenchenSkinning(RunTime): 15832 ms. d8-master: EmbenchenSkinning(RunTime): 15630 ms. ----------- zlib.js Current: EmbenchenZLib(RunTime): 11176 ms. d8-master: EmbenchenZLib(RunTime): 11324 ms. BUG= Review URL: https://codereview.chromium.org/985713003 Cr-Commit-Position: refs/heads/master@{#27071}
2015-03-09 13:24:29 +00:00
// Copyright 2015 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 f(x, y) {
return x - y;
}
return f;
})();
var counter = 0;
var deopt = { toString : function() {
%DeoptimizeFunction(f);
counter++;
return "2";
} };
var o = { toString : function() {
counter++;
return "1";
} };
%PrepareFunctionForOptimization(f);
[turbofan] Fix lazy deopt for JSToNumber conversions in binary operations. This slightly hacky change provides lazy deopt points for to-number conversions in binops: When we deopt from a to-number conversion, we create a frame state with the already-converted value(s) so that we do not repeat the side effect of the conversion. Embenchen numbers are below. It is not quite clear what happened to fasta - the hot code looks nearly identical. Current: EmbenchenBox2d(RunTime): 12746 ms. d8-master: EmbenchenBox2d(RunTime): 13861 ms. ----------- bullet.js Current: EmbenchenBullet(RunTime): 17680 ms. d8-master: EmbenchenBullet(RunTime): 19170 ms. ----------- copy.js Current: EmbenchenCopy(RunTime): 4939 ms. d8-master: EmbenchenCopy(RunTime): 4943 ms. ----------- corrections.js Current: EmbenchenCorrections(RunTime): 6639 ms. d8-master: EmbenchenCorrections(RunTime): 6728 ms. ----------- fannkuch.js Current: EmbenchenFannkuch(RunTime): 4630 ms. d8-master: EmbenchenFannkuch(RunTime): 4872 ms. ----------- fasta.js Current: EmbenchenFasta(RunTime): 10209 ms. d8-master: EmbenchenFasta(RunTime): 9673 ms. ----------- lua_binarytrees.js Current: EmbenchenLuaBinaryTrees(RunTime): 12936 ms. d8-master: EmbenchenLuaBinaryTrees(RunTime): 15529 ms. ----------- memops.js Current: EmbenchenMemOps(RunTime): 7357 ms. d8-master: EmbenchenMemOps(RunTime): 7340 ms. ----------- primes.js Current: EmbenchenPrimes(RunTime): 7530 ms. d8-master: EmbenchenPrimes(RunTime): 7457 ms. ----------- skinning.js Current: EmbenchenSkinning(RunTime): 15832 ms. d8-master: EmbenchenSkinning(RunTime): 15630 ms. ----------- zlib.js Current: EmbenchenZLib(RunTime): 11176 ms. d8-master: EmbenchenZLib(RunTime): 11324 ms. BUG= Review URL: https://codereview.chromium.org/985713003 Cr-Commit-Position: refs/heads/master@{#27071}
2015-03-09 13:24:29 +00:00
counter = 0;
assertEquals(1, f(deopt, o));
assertEquals(2, counter);
%OptimizeFunctionOnNextCall(f);
counter = 0;
assertEquals(-1, f(o, deopt));
assertEquals(2, counter);
%PrepareFunctionForOptimization(f);
[turbofan] Fix lazy deopt for JSToNumber conversions in binary operations. This slightly hacky change provides lazy deopt points for to-number conversions in binops: When we deopt from a to-number conversion, we create a frame state with the already-converted value(s) so that we do not repeat the side effect of the conversion. Embenchen numbers are below. It is not quite clear what happened to fasta - the hot code looks nearly identical. Current: EmbenchenBox2d(RunTime): 12746 ms. d8-master: EmbenchenBox2d(RunTime): 13861 ms. ----------- bullet.js Current: EmbenchenBullet(RunTime): 17680 ms. d8-master: EmbenchenBullet(RunTime): 19170 ms. ----------- copy.js Current: EmbenchenCopy(RunTime): 4939 ms. d8-master: EmbenchenCopy(RunTime): 4943 ms. ----------- corrections.js Current: EmbenchenCorrections(RunTime): 6639 ms. d8-master: EmbenchenCorrections(RunTime): 6728 ms. ----------- fannkuch.js Current: EmbenchenFannkuch(RunTime): 4630 ms. d8-master: EmbenchenFannkuch(RunTime): 4872 ms. ----------- fasta.js Current: EmbenchenFasta(RunTime): 10209 ms. d8-master: EmbenchenFasta(RunTime): 9673 ms. ----------- lua_binarytrees.js Current: EmbenchenLuaBinaryTrees(RunTime): 12936 ms. d8-master: EmbenchenLuaBinaryTrees(RunTime): 15529 ms. ----------- memops.js Current: EmbenchenMemOps(RunTime): 7357 ms. d8-master: EmbenchenMemOps(RunTime): 7340 ms. ----------- primes.js Current: EmbenchenPrimes(RunTime): 7530 ms. d8-master: EmbenchenPrimes(RunTime): 7457 ms. ----------- skinning.js Current: EmbenchenSkinning(RunTime): 15832 ms. d8-master: EmbenchenSkinning(RunTime): 15630 ms. ----------- zlib.js Current: EmbenchenZLib(RunTime): 11176 ms. d8-master: EmbenchenZLib(RunTime): 11324 ms. BUG= Review URL: https://codereview.chromium.org/985713003 Cr-Commit-Position: refs/heads/master@{#27071}
2015-03-09 13:24:29 +00:00
%OptimizeFunctionOnNextCall(f);
counter = 0;
assertEquals(0, f(deopt, deopt));
assertEquals(2, counter);