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

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

Issue 819103002: [turbofan] Minor cleanup to reduce code duplication. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « test/unittests/compiler/js-typed-lowering-unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 namespace compiler { 15 namespace compiler {
16 16
17 class SimplifiedOperatorReducerTest : public GraphTest { 17 class SimplifiedOperatorReducerTest : public GraphTest {
18 public: 18 public:
19 explicit SimplifiedOperatorReducerTest(int num_parameters = 1) 19 explicit SimplifiedOperatorReducerTest(int num_parameters = 1)
20 : GraphTest(num_parameters), simplified_(zone()) {} 20 : GraphTest(num_parameters), simplified_(zone()) {}
21 virtual ~SimplifiedOperatorReducerTest() {} 21 ~SimplifiedOperatorReducerTest() OVERRIDE {}
22 22
23 protected: 23 protected:
24 Reduction Reduce(Node* node) { 24 Reduction Reduce(Node* node) {
25 MachineOperatorBuilder machine(zone()); 25 MachineOperatorBuilder machine(zone());
26 JSOperatorBuilder javascript(zone()); 26 JSOperatorBuilder javascript(zone());
27 JSGraph jsgraph(graph(), common(), &javascript, &machine); 27 JSGraph jsgraph(graph(), common(), &javascript, &machine);
28 SimplifiedOperatorReducer reducer(&jsgraph); 28 SimplifiedOperatorReducer reducer(&jsgraph);
29 return reducer.Reduce(node); 29 return reducer.Reduce(node);
30 } 30 }
31 31
32 SimplifiedOperatorBuilder* simplified() { return &simplified_; } 32 SimplifiedOperatorBuilder* simplified() { return &simplified_; }
33 33
34 private: 34 private:
35 SimplifiedOperatorBuilder simplified_; 35 SimplifiedOperatorBuilder simplified_;
36 }; 36 };
37 37
38 38
39 template <typename T> 39 template <typename T>
40 class SimplifiedOperatorReducerTestWithParam 40 class SimplifiedOperatorReducerTestWithParam
41 : public SimplifiedOperatorReducerTest, 41 : public SimplifiedOperatorReducerTest,
42 public ::testing::WithParamInterface<T> { 42 public ::testing::WithParamInterface<T> {
43 public: 43 public:
44 explicit SimplifiedOperatorReducerTestWithParam(int num_parameters = 1) 44 explicit SimplifiedOperatorReducerTestWithParam(int num_parameters = 1)
45 : SimplifiedOperatorReducerTest(num_parameters) {} 45 : SimplifiedOperatorReducerTest(num_parameters) {}
46 virtual ~SimplifiedOperatorReducerTestWithParam() {} 46 ~SimplifiedOperatorReducerTestWithParam() OVERRIDE {}
47 }; 47 };
48 48
49 49
50 namespace { 50 namespace {
51 51
52 static const double kFloat64Values[] = { 52 static const double kFloat64Values[] = {
53 -V8_INFINITY, -6.52696e+290, -1.05768e+290, -5.34203e+268, -1.01997e+268, 53 -V8_INFINITY, -6.52696e+290, -1.05768e+290, -5.34203e+268, -1.01997e+268,
54 -8.22758e+266, -1.58402e+261, -5.15246e+241, -5.92107e+226, -1.21477e+226, 54 -8.22758e+266, -1.58402e+261, -5.15246e+241, -5.92107e+226, -1.21477e+226,
55 -1.67913e+188, -1.6257e+184, -2.60043e+170, -2.52941e+168, -3.06033e+116, 55 -1.67913e+188, -1.6257e+184, -2.60043e+170, -2.52941e+168, -3.06033e+116,
56 -4.56201e+52, -3.56788e+50, -9.9066e+38, -3.07261e+31, -2.1271e+09, 56 -4.56201e+52, -3.56788e+50, -9.9066e+38, -3.07261e+31, -2.1271e+09,
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 Reduce(graph()->NewNode(simplified()->ChangeUint32ToTagged(), 474 Reduce(graph()->NewNode(simplified()->ChangeUint32ToTagged(),
475 Int32Constant(bit_cast<int32_t>(n)))); 475 Int32Constant(bit_cast<int32_t>(n))));
476 ASSERT_TRUE(reduction.Changed()); 476 ASSERT_TRUE(reduction.Changed());
477 EXPECT_THAT(reduction.replacement(), IsNumberConstant(FastUI2D(n))); 477 EXPECT_THAT(reduction.replacement(), IsNumberConstant(FastUI2D(n)));
478 } 478 }
479 } 479 }
480 480
481 } // namespace compiler 481 } // namespace compiler
482 } // namespace internal 482 } // namespace internal
483 } // namespace v8 483 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/js-typed-lowering-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698