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

Side by Side Diff: test/unittests/compiler/value-numbering-reducer-unittest.cc

Issue 644083003: [turbofan] Reduce memory consumption of graph building (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add missing arraysize Created 6 years, 1 month 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 | Annotate | Revision Log
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 <limits> 5 #include <limits>
6 6
7 #include "src/compiler/graph.h" 7 #include "src/compiler/graph.h"
8 #include "src/compiler/value-numbering-reducer.h" 8 #include "src/compiler/value-numbering-reducer.h"
9 #include "test/unittests/test-utils.h" 9 #include "test/unittests/test-utils.h"
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 Node* n1 = graph()->NewNode(&op); 60 Node* n1 = graph()->NewNode(&op);
61 EXPECT_FALSE(Reduce(n0).Changed()); 61 EXPECT_FALSE(Reduce(n0).Changed());
62 EXPECT_FALSE(Reduce(n1).Changed()); 62 EXPECT_FALSE(Reduce(n1).Changed());
63 } 63 }
64 64
65 65
66 TEST_F(ValueNumberingReducerTest, OperatorEqualityNotIdentity) { 66 TEST_F(ValueNumberingReducerTest, OperatorEqualityNotIdentity) {
67 static const size_t kMaxInputCount = 16; 67 static const size_t kMaxInputCount = 16;
68 Node* inputs[kMaxInputCount]; 68 Node* inputs[kMaxInputCount];
69 for (size_t i = 0; i < arraysize(inputs); ++i) { 69 for (size_t i = 0; i < arraysize(inputs); ++i) {
70 Operator::Opcode opcode = static_cast<Operator::Opcode>( 70 Operator::Opcode opcode =
71 std::numeric_limits<Operator::Opcode>::max() - i); 71 static_cast<Operator::Opcode>(IrOpcode::kLast - i);
Benedikt Meurer 2014/10/27 09:29:14 What is the purpose of this change?
Michael Starzinger 2014/10/27 09:34:19 Is there any particular reason for this change? I
72 inputs[i] = graph()->NewNode(new (zone()) SimpleOperator( 72 inputs[i] = graph()->NewNode(new (zone()) SimpleOperator(
73 opcode, Operator::kEliminatable, 0, 1, "Operator")); 73 opcode, Operator::kEliminatable, 0, 1, "Operator"));
74 } 74 }
75 TRACED_FORRANGE(size_t, input_count, 0, arraysize(inputs)) { 75 TRACED_FORRANGE(size_t, input_count, 0, arraysize(inputs)) {
76 const SimpleOperator op1(static_cast<Operator::Opcode>(input_count), 76 const SimpleOperator op1(static_cast<Operator::Opcode>(input_count),
77 Operator::kEliminatable, 77 Operator::kEliminatable,
78 static_cast<int>(input_count), 1, "op"); 78 static_cast<int>(input_count), 1, "op");
79 Node* n1 = graph()->NewNode(&op1, static_cast<int>(input_count), inputs); 79 Node* n1 = graph()->NewNode(&op1, static_cast<int>(input_count), inputs);
80 Reduction r1 = Reduce(n1); 80 Reduction r1 = Reduce(n1);
81 EXPECT_FALSE(r1.Changed()); 81 EXPECT_FALSE(r1.Changed());
82 82
83 const SimpleOperator op2(static_cast<Operator::Opcode>(input_count), 83 const SimpleOperator op2(static_cast<Operator::Opcode>(input_count),
84 Operator::kEliminatable, 84 Operator::kEliminatable,
85 static_cast<int>(input_count), 1, "op"); 85 static_cast<int>(input_count), 1, "op");
86 Node* n2 = graph()->NewNode(&op2, static_cast<int>(input_count), inputs); 86 Node* n2 = graph()->NewNode(&op2, static_cast<int>(input_count), inputs);
87 Reduction r2 = Reduce(n2); 87 Reduction r2 = Reduce(n2);
88 EXPECT_TRUE(r2.Changed()); 88 EXPECT_TRUE(r2.Changed());
89 EXPECT_EQ(n1, r2.replacement()); 89 EXPECT_EQ(n1, r2.replacement());
90 } 90 }
91 } 91 }
92 92
93 93
94 TEST_F(ValueNumberingReducerTest, SubsequentReductionsYieldTheSameNode) { 94 TEST_F(ValueNumberingReducerTest, SubsequentReductionsYieldTheSameNode) {
95 static const size_t kMaxInputCount = 16; 95 static const size_t kMaxInputCount = 16;
96 Node* inputs[kMaxInputCount]; 96 Node* inputs[kMaxInputCount];
97 for (size_t i = 0; i < arraysize(inputs); ++i) { 97 for (size_t i = 0; i < arraysize(inputs); ++i) {
98 Operator::Opcode opcode = static_cast<Operator::Opcode>( 98 Operator::Opcode opcode =
99 std::numeric_limits<Operator::Opcode>::max() - i); 99 static_cast<Operator::Opcode>(IrOpcode::kLast - i);
Benedikt Meurer 2014/10/27 09:29:14 What is the purpose of this change?
100 inputs[i] = graph()->NewNode(new (zone()) SimpleOperator( 100 inputs[i] = graph()->NewNode(new (zone()) SimpleOperator(
101 opcode, Operator::kEliminatable, 0, 1, "Operator")); 101 opcode, Operator::kEliminatable, 0, 1, "Operator"));
102 } 102 }
103 TRACED_FORRANGE(size_t, input_count, 0, arraysize(inputs)) { 103 TRACED_FORRANGE(size_t, input_count, 0, arraysize(inputs)) {
104 const SimpleOperator op1(1, Operator::kEliminatable, 104 const SimpleOperator op1(1, Operator::kEliminatable,
105 static_cast<int>(input_count), 1, "op1"); 105 static_cast<int>(input_count), 1, "op1");
106 Node* n = graph()->NewNode(&op1, static_cast<int>(input_count), inputs); 106 Node* n = graph()->NewNode(&op1, static_cast<int>(input_count), inputs);
107 Reduction r = Reduce(n); 107 Reduction r = Reduce(n);
108 EXPECT_FALSE(r.Changed()); 108 EXPECT_FALSE(r.Changed());
109 109
(...skipping 10 matching lines...) Expand all
120 120
121 TEST_F(ValueNumberingReducerTest, WontReplaceNodeWithItself) { 121 TEST_F(ValueNumberingReducerTest, WontReplaceNodeWithItself) {
122 Node* n = graph()->NewNode(&kOp0); 122 Node* n = graph()->NewNode(&kOp0);
123 EXPECT_FALSE(Reduce(n).Changed()); 123 EXPECT_FALSE(Reduce(n).Changed());
124 EXPECT_FALSE(Reduce(n).Changed()); 124 EXPECT_FALSE(Reduce(n).Changed());
125 } 125 }
126 126
127 } // namespace compiler 127 } // namespace compiler
128 } // namespace internal 128 } // namespace internal
129 } // namespace v8 129 } // namespace v8
OLDNEW
« src/compiler/graph-builder.cc ('K') | « test/cctest/compiler/simplified-graph-builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698