| // Copyright 2018 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 |
| (function TestOptimizedFastExpm1MinusZero() { |
| return Object.is(Math.expm1(-0), -0); |
| %PrepareFunctionForOptimization(foo); |
| %OptimizeFunctionOnNextCall(foo); |
| (function TestOptimizedExpm1MinusZeroSlowPath() { |
| return Object.is(Math.expm1(x), -0); |
| %PrepareFunctionForOptimization(f); |
| %PrepareFunctionForOptimization(g); |
| // Compile function optimistically for numbers (with fast inlined |
| %OptimizeFunctionOnNextCall(f); |
| // Invalidate the optimistic assumption, deopting and marking non-number |
| // input feedback in the call IC. |
| // Optimize again, now with non-lowered call to Math.expm1. |
| %OptimizeFunctionOnNextCall(g); |