Commit 6f559b7e authored by jarin's avatar jarin Committed by Commit bot

[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}
parent dcb502a4
......@@ -204,7 +204,7 @@ Node* JSGraph::EmptyFrameState() {
if (!empty_frame_state_.is_set()) {
Node* values = graph()->NewNode(common()->StateValues(0));
Node* state_node = graph()->NewNode(
common()->FrameState(JS_FRAME, BailoutId(0),
common()->FrameState(JS_FRAME, BailoutId::None(),
OutputFrameStateCombine::Ignore()),
values, values, values, NoContextConstant(), UndefinedConstant());
empty_frame_state_.set(state_node);
......
This diff is collapsed.
......@@ -52,7 +52,7 @@ class JSTypedLowering FINAL : public Reducer {
Reduction ReduceUI32Shift(Node* node, Signedness left_signedness,
const Operator* shift_op);
Node* ConvertToNumber(Node* input);
Node* ConvertPrimitiveToNumber(Node* input);
template <IrOpcode::Value>
Node* FindConversion(Node* input);
void InsertConversion(Node* conversion);
......
......@@ -95,6 +95,9 @@
'test-debug/DebugStepFunctionApply': [PASS, NO_VARIANTS],
'test-debug/DebugStepFunctionCall': [PASS, NO_VARIANTS],
# TODO(jarin): Cannot lazy-deoptimize from conversions before comparisons.
'test-js-typed-lowering/OrderCompareEffects': [SKIP],
# TODO(jochen): Reenable after we removed the CHECK() from the marking queue.
'test-mark-compact/MarkingDeque': [SKIP],
......
......@@ -67,7 +67,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
Node* stack = graph.NewNode(common.StateValues(0));
Node* state_node =
graph.NewNode(common.FrameState(JS_FRAME, BailoutId(0),
graph.NewNode(common.FrameState(JS_FRAME, BailoutId::None(),
OutputFrameStateCombine::Ignore()),
parameters, locals, stack, context, UndefinedConstant());
......
// 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";
} };
counter = 0;
assertEquals(1, f(deopt, o));
assertEquals(2, counter);
%OptimizeFunctionOnNextCall(f);
counter = 0;
assertEquals(-1, f(o, deopt));
assertEquals(2, counter);
%OptimizeFunctionOnNextCall(f);
counter = 0;
assertEquals(0, f(deopt, deopt));
assertEquals(2, counter);
......@@ -68,6 +68,7 @@
'compare-known-objects-slow': [PASS, NO_VARIANTS],
'elements-kind': [PASS, NO_VARIANTS],
'opt-elements-kind': [PASS, NO_VARIANTS],
'smi-representation': [PASS, NO_VARIANTS],
# Some tests are just too slow to run for now.
'big-object-literal': [PASS, NO_VARIANTS],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment