v8/test/mjsunit/maglev/spill-double.js
Victor Gomes 4837f37279 [maglev] Float64 box/unbox elision
- Supports Float64 Add for SmiAdd bytecode
- Adds a Float64Constant and ChangeInt32ToFloat64 nodes
- Converts floats to tagged in Phi node inputs
- Fixes spill double representation
- Fixes materialisation during a deopt of a double in the stack

Bug: v8:7700
Change-Id: I9217a64313b4bd5d0015f935c23771ecf9a2c7ca
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3610426
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80255}
2022-04-28 13:17:48 +00:00

38 lines
856 B
JavaScript

// Copyright 2022 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 --maglev --no-stress-opt
// This tests that we can lazy deopt with a double spilled.
const value = 2.2;
function test(x) {
return x;
}
function g(x) {
assertEquals(value + 1, x);
}
function f(b, a) {
var x = a + 1;
if (test(b)) { // This forces x to be spilled.
g(x); // When we lazy deopt, we call g with the materialized
// value from the stack.
}
return x + 1;
}
%PrepareFunctionForOptimization(f);
assertEquals(4.2, f(false, value));
%OptimizeMaglevOnNextCall(f);
assertEquals(4.2, f(false, value));
assertTrue(isMaglevved(f));
// We should deopt here.
assertEquals(4.2, f(true, value));
assertFalse(isMaglevved(f));