PR-URL: https://github.com/nodejs/node/pull/60488 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Richard Lau <richard.lau@ibm.com>
29 lines
711 B
JavaScript
29 lines
711 B
JavaScript
// Copyright 2025 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
|
|
|
|
function testDouble() {
|
|
let v = 5.5;
|
|
return Math.max(v, v);
|
|
}
|
|
%PrepareFunctionForOptimization(testDouble);
|
|
testDouble();
|
|
|
|
%OptimizeMaglevOnNextCall(testDouble);
|
|
|
|
assertEquals(5.5, testDouble());
|
|
assertTrue(isMaglevved(testDouble));
|
|
|
|
function testObject() {
|
|
let v = {valueOf: () => {return 1.1;}}
|
|
return Math.max(v, v);
|
|
}
|
|
%PrepareFunctionForOptimization(testObject);
|
|
testObject();
|
|
|
|
%OptimizeMaglevOnNextCall(testObject);
|
|
|
|
assertEquals(1.1, testObject());
|
|
assertFalse(isMaglevved(testObject));
|