v8/test/mjsunit/maglev/load-named.js
Leszek Swirski 7ada6c8bbc [maglev] Add LoadDoubleField
Add an unboxing double field load node, and fix a couple of locations
where it might be used enough to pass tests.

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

60 lines
1.5 KiB
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
// Checks simple monomorphic load of a Smi field works
(function() {
function load(o) {
return o.smi;
}
%PrepareFunctionForOptimization(load);
assertEquals(42, load({smi:42}));
%OptimizeMaglevOnNextCall(load);
assertEquals(42, load({smi:42}));
assertTrue(isMaglevved(load));
// We should deopt here.
assertEquals(42, load({y:0, smi:42}));
assertFalse(isMaglevved(load));
})();
// Checks simple monomorphic load of a Double field works
(function() {
function load(o) {
return o.float64;
}
%PrepareFunctionForOptimization(load);
assertEquals(42.5, load({float64:42.5}));
%OptimizeMaglevOnNextCall(load);
assertEquals(42.5, load({float64:42.5}));
assertTrue(isMaglevved(load));
// We should deopt here.
assertEquals(42.5, load({y:0, float64:42.5}));
assertFalse(isMaglevved(load));
})();
// Checks simple monomorphic load of a Double field works with a float64 add.
(function() {
function load(o) {
return o.float64 + o.float64;
}
%PrepareFunctionForOptimization(load);
assertEquals(85, load({float64:42.5}));
%OptimizeMaglevOnNextCall(load);
assertEquals(85, load({float64:42.5}));
assertTrue(isMaglevved(load));
// We should deopt here.
assertEquals(85, load({y:0, float64:42.5}));
assertFalse(isMaglevved(load));
})();