aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/regress/regress-crbug-880207.js
blob: 09796a9ff4d01bb566c05feaebe69d5b9f650dd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// 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() {
  function foo() {
    return Object.is(Math.expm1(-0), -0);
  }

  assertTrue(foo());
  %OptimizeFunctionOnNextCall(foo);
  assertTrue(foo());
})();

(function TestOptimizedExpm1MinusZeroSlowPath() {
  function f(x) {
    return Object.is(Math.expm1(x), -0);
  }

  function g() {
    return f(-0);
  }

  f(0);
  // Compile function optimistically for numbers (with fast inlined
  // path for Math.expm1).
  %OptimizeFunctionOnNextCall(f);
  // Invalidate the optimistic assumption, deopting and marking non-number
  // input feedback in the call IC.
  f("0");
  // Optimize again, now with non-lowered call to Math.expm1.
  assertTrue(g());
  %OptimizeFunctionOnNextCall(g);
  assertTrue(g());
})();