OLD | NEW |
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/compiler/js-graph.h" | 5 #include "src/compiler/js-graph.h" |
6 #include "src/compiler/simplified-operator.h" | 6 #include "src/compiler/simplified-operator.h" |
7 #include "src/compiler/simplified-operator-reducer.h" | 7 #include "src/compiler/simplified-operator-reducer.h" |
8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
9 #include "src/types.h" | 9 #include "src/types.h" |
10 #include "test/unittests/compiler/graph-unittest.h" | 10 #include "test/unittests/compiler/graph-unittest.h" |
11 #include "test/unittests/compiler/node-test-utils.h" | 11 #include "test/unittests/compiler/node-test-utils.h" |
| 12 #include "testing/gmock-support.h" |
| 13 |
| 14 using testing::IsNaN; |
| 15 |
12 | 16 |
13 namespace v8 { | 17 namespace v8 { |
14 namespace internal { | 18 namespace internal { |
15 namespace compiler { | 19 namespace compiler { |
16 | 20 |
17 class SimplifiedOperatorReducerTest : public GraphTest { | 21 class SimplifiedOperatorReducerTest : public GraphTest { |
18 public: | 22 public: |
19 explicit SimplifiedOperatorReducerTest(int num_parameters = 1) | 23 explicit SimplifiedOperatorReducerTest(int num_parameters = 1) |
20 : GraphTest(num_parameters), simplified_(zone()) {} | 24 : GraphTest(num_parameters), simplified_(zone()) {} |
21 ~SimplifiedOperatorReducerTest() OVERRIDE {} | 25 ~SimplifiedOperatorReducerTest() OVERRIDE {} |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 0xfba5, 0x172dcc6, 0x114d8fc1, 0x182d6c9d, 0x1b1e3fad, 0x1db033bf, | 111 0xfba5, 0x172dcc6, 0x114d8fc1, 0x182d6c9d, 0x1b1e3fad, 0x1db033bf, |
108 0x1e1de755, 0x1f625c80, 0x28f6cf00, 0x2acb6a94, 0x2c20240e, 0x2f0fe54e, | 112 0x1e1de755, 0x1f625c80, 0x28f6cf00, 0x2acb6a94, 0x2c20240e, 0x2f0fe54e, |
109 0x31863a7c, 0x33325474, 0x3532fae3, 0x3bab82ea, 0x4c4b83a2, 0x4cd93d1e, | 113 0x31863a7c, 0x33325474, 0x3532fae3, 0x3bab82ea, 0x4c4b83a2, 0x4cd93d1e, |
110 0x4f7331d4, 0x5491b09b, 0x57cc6ff9, 0x60d3b4dc, 0x653f5904, 0x690ae256, | 114 0x4f7331d4, 0x5491b09b, 0x57cc6ff9, 0x60d3b4dc, 0x653f5904, 0x690ae256, |
111 0x69fe3276, 0x6bebf0ba, 0x6e2c69a3, 0x73b84ff7, 0x7b3a1924, 0x7ed032d9, | 115 0x69fe3276, 0x6bebf0ba, 0x6e2c69a3, 0x73b84ff7, 0x7b3a1924, 0x7ed032d9, |
112 0x84dd734b, 0x8552ea53, 0x8680754f, 0x8e9660eb, 0x94fe2b9c, 0x972d30cf, | 116 0x84dd734b, 0x8552ea53, 0x8680754f, 0x8e9660eb, 0x94fe2b9c, 0x972d30cf, |
113 0x9b98c482, 0xb158667e, 0xb432932c, 0xb5b70989, 0xb669971a, 0xb7c359d1, | 117 0x9b98c482, 0xb158667e, 0xb432932c, 0xb5b70989, 0xb669971a, 0xb7c359d1, |
114 0xbeb15c0d, 0xc171c53d, 0xc743dd38, 0xc8e2af50, 0xc98e2df0, 0xd9d1cdf9, | 118 0xbeb15c0d, 0xc171c53d, 0xc743dd38, 0xc8e2af50, 0xc98e2df0, 0xd9d1cdf9, |
115 0xdcc91049, 0xe46f396d, 0xee991950, 0xef64e521, 0xf7aeefc9, 0xffffffff}; | 119 0xdcc91049, 0xe46f396d, 0xee991950, 0xef64e521, 0xf7aeefc9, 0xffffffff}; |
116 | 120 |
117 | |
118 MATCHER(IsNaN, std::string(negation ? "isn't" : "is") + " NaN") { | |
119 return std::isnan(arg); | |
120 } | |
121 | |
122 } // namespace | 121 } // namespace |
123 | 122 |
124 | 123 |
125 // ----------------------------------------------------------------------------- | 124 // ----------------------------------------------------------------------------- |
126 // Unary operators | 125 // Unary operators |
127 | 126 |
128 | 127 |
129 namespace { | 128 namespace { |
130 | 129 |
131 struct UnaryOperator { | 130 struct UnaryOperator { |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 Reduce(graph()->NewNode(simplified()->ChangeUint32ToTagged(), | 473 Reduce(graph()->NewNode(simplified()->ChangeUint32ToTagged(), |
475 Int32Constant(bit_cast<int32_t>(n)))); | 474 Int32Constant(bit_cast<int32_t>(n)))); |
476 ASSERT_TRUE(reduction.Changed()); | 475 ASSERT_TRUE(reduction.Changed()); |
477 EXPECT_THAT(reduction.replacement(), IsNumberConstant(FastUI2D(n))); | 476 EXPECT_THAT(reduction.replacement(), IsNumberConstant(FastUI2D(n))); |
478 } | 477 } |
479 } | 478 } |
480 | 479 |
481 } // namespace compiler | 480 } // namespace compiler |
482 } // namespace internal | 481 } // namespace internal |
483 } // namespace v8 | 482 } // namespace v8 |
OLD | NEW |