Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Side by Side Diff: test/unittests/compiler/machine-operator-reducer-unittest.cc

Issue 2029413005: [builtins] Migrate Math.log to TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typo. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/base/bits.h" 5 #include "src/base/bits.h"
6 #include "src/base/division-by-constant.h" 6 #include "src/base/division-by-constant.h"
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/machine-operator-reducer.h" 8 #include "src/compiler/machine-operator-reducer.h"
9 #include "src/compiler/typer.h" 9 #include "src/compiler/typer.h"
10 #include "src/conversions-inl.h" 10 #include "src/conversions-inl.h"
11 #include "test/unittests/compiler/graph-unittest.h" 11 #include "test/unittests/compiler/graph-unittest.h"
12 #include "test/unittests/compiler/node-test-utils.h" 12 #include "test/unittests/compiler/node-test-utils.h"
13 #include "testing/gmock-support.h" 13 #include "testing/gmock-support.h"
14 14
15 using testing::AllOf; 15 using testing::AllOf;
16 using testing::BitEq; 16 using testing::BitEq;
17 using testing::Capture; 17 using testing::Capture;
18 using testing::CaptureEq; 18 using testing::CaptureEq;
19 using testing::NanSensitiveDoubleEq;
19 20
20 namespace v8 { 21 namespace v8 {
21 namespace internal { 22 namespace internal {
22 namespace compiler { 23 namespace compiler {
23 24
24 class MachineOperatorReducerTest : public TypedGraphTest { 25 class MachineOperatorReducerTest : public TypedGraphTest {
25 public: 26 public:
26 explicit MachineOperatorReducerTest(int num_parameters = 2) 27 explicit MachineOperatorReducerTest(int num_parameters = 2)
27 : TypedGraphTest(num_parameters), machine_(zone()) {} 28 : TypedGraphTest(num_parameters), machine_(zone()) {}
28 29
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 Reduction r = Reduce( 1393 Reduction r = Reduce(
1393 graph()->NewNode(machine()->Float64Mul(), Float64Constant(-1.0), p0)); 1394 graph()->NewNode(machine()->Float64Mul(), Float64Constant(-1.0), p0));
1394 ASSERT_TRUE(r.Changed()); 1395 ASSERT_TRUE(r.Changed());
1395 EXPECT_THAT(r.replacement(), 1396 EXPECT_THAT(r.replacement(),
1396 IsFloat64Sub(IsFloat64Constant(BitEq(-0.0)), p0)); 1397 IsFloat64Sub(IsFloat64Constant(BitEq(-0.0)), p0));
1397 } 1398 }
1398 } 1399 }
1399 1400
1400 1401
1401 // ----------------------------------------------------------------------------- 1402 // -----------------------------------------------------------------------------
1403 // Float64Log
1404
1405 TEST_F(MachineOperatorReducerTest, Float64LogWithConstant) {
1406 TRACED_FOREACH(double, x, kFloat64Values) {
1407 Reduction const r =
1408 Reduce(graph()->NewNode(machine()->Float64Log(), Float64Constant(x)));
1409 ASSERT_TRUE(r.Changed());
1410 EXPECT_THAT(r.replacement(),
1411 IsFloat64Constant(NanSensitiveDoubleEq(std::log(x))));
1412 }
1413 }
1414
1415 // -----------------------------------------------------------------------------
1402 // Float64InsertLowWord32 1416 // Float64InsertLowWord32
1403 1417
1404
1405 TEST_F(MachineOperatorReducerTest, Float64InsertLowWord32WithConstant) { 1418 TEST_F(MachineOperatorReducerTest, Float64InsertLowWord32WithConstant) {
1406 TRACED_FOREACH(double, x, kFloat64Values) { 1419 TRACED_FOREACH(double, x, kFloat64Values) {
1407 TRACED_FOREACH(uint32_t, y, kUint32Values) { 1420 TRACED_FOREACH(uint32_t, y, kUint32Values) {
1408 Reduction const r = 1421 Reduction const r =
1409 Reduce(graph()->NewNode(machine()->Float64InsertLowWord32(), 1422 Reduce(graph()->NewNode(machine()->Float64InsertLowWord32(),
1410 Float64Constant(x), Uint32Constant(y))); 1423 Float64Constant(x), Uint32Constant(y)));
1411 ASSERT_TRUE(r.Changed()); 1424 ASSERT_TRUE(r.Changed());
1412 EXPECT_THAT( 1425 EXPECT_THAT(
1413 r.replacement(), 1426 r.replacement(),
1414 IsFloat64Constant(BitEq(bit_cast<double>( 1427 IsFloat64Constant(BitEq(bit_cast<double>(
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 Reduction r = Reduce(node); 1656 Reduction r = Reduce(node);
1644 ASSERT_TRUE(r.Changed()); 1657 ASSERT_TRUE(r.Changed());
1645 EXPECT_THAT(r.replacement(), 1658 EXPECT_THAT(r.replacement(),
1646 IsStore(rep, base, index, value, effect, control)); 1659 IsStore(rep, base, index, value, effect, control));
1647 } 1660 }
1648 } 1661 }
1649 1662
1650 } // namespace compiler 1663 } // namespace compiler
1651 } // namespace internal 1664 } // namespace internal
1652 } // namespace v8 1665 } // namespace v8
OLDNEW
« test/mjsunit/regress/regress-1246.js ('K') | « test/mjsunit/regress/regress-1246.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698