c87168bc8c
Import base::ieee754::tan() from fdlibm and introduce Float64Tan TurboFan operator based on that, similar to what we do for Float64Cos and Float64Sin. Rewrite Math.tan() as TurboFan builtin and use those operators to also inline Math.tan() into optimized TurboFan functions. Drive-by-fix: Kill the %_ConstructDouble intrinsics, and provide only the %ConstructDouble runtime entry for writing tests. BUG=v8:5086,v8:5126 R=yangguo@chromium.org Review-Url: https://codereview.chromium.org/2083453002 Cr-Commit-Position: refs/heads/master@{#37087}
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
// Copyright 2014 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 assertDoubleBits(hi, lo, x) {
|
|
hi = hi | 0;
|
|
lo = lo | 0;
|
|
assertEquals(x, %ConstructDouble(hi, lo));
|
|
assertEquals(hi, %_DoubleHi(x));
|
|
assertEquals(lo, %_DoubleLo(x));
|
|
assertEquals(x, %ConstructDouble(%_DoubleHi(x), %_DoubleLo(x)));
|
|
}
|
|
|
|
|
|
var tests = [0x7ff00000, 0x00000000, Infinity,
|
|
0xfff00000, 0x00000000, -Infinity,
|
|
0x80000000, 0x00000000, -0,
|
|
0x400921fb, 0x54442d18, Math.PI,
|
|
0xc00921fb, 0x54442d18, -Math.PI,
|
|
0x4005bf0a, 0x8b145769, Math.E,
|
|
0xc005bf0a, 0x8b145769, -Math.E,
|
|
0xbfe80000, 0x00000000, -0.75];
|
|
|
|
|
|
for (var i = 0; i < tests.length; i += 3) {
|
|
assertDoubleBits(tests[i], tests[i + 1], tests[i + 2]);
|
|
}
|
|
|
|
%OptimizeFunctionOnNextCall(assertDoubleBits);
|
|
|
|
for (var i = 0; i < tests.length; i += 3) {
|
|
assertDoubleBits(tests[i], tests[i + 1], tests[i + 2]);
|
|
assertOptimized(assertDoubleBits);
|
|
}
|