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

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

Issue 539973002: Make MSVC happy again. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 <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 "src/test/test-utils.h" 9 #include "src/test/test-utils.h"
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 static const size_t kMaxInputCount = 16; 56 static const size_t kMaxInputCount = 16;
57 Node* inputs[kMaxInputCount]; 57 Node* inputs[kMaxInputCount];
58 for (size_t i = 0; i < arraysize(inputs); ++i) { 58 for (size_t i = 0; i < arraysize(inputs); ++i) {
59 Operator::Opcode opcode = static_cast<Operator::Opcode>( 59 Operator::Opcode opcode = static_cast<Operator::Opcode>(
60 std::numeric_limits<Operator::Opcode>::max() - i); 60 std::numeric_limits<Operator::Opcode>::max() - i);
61 inputs[i] = graph()->NewNode(new (zone()) SimpleOperator( 61 inputs[i] = graph()->NewNode(new (zone()) SimpleOperator(
62 opcode, Operator::kNoProperties, 0, 1, "Operator")); 62 opcode, Operator::kNoProperties, 0, 1, "Operator"));
63 } 63 }
64 TRACED_FORRANGE(size_t, input_count, 0, arraysize(inputs)) { 64 TRACED_FORRANGE(size_t, input_count, 0, arraysize(inputs)) {
65 const SimpleOperator op1(static_cast<Operator::Opcode>(input_count), 65 const SimpleOperator op1(static_cast<Operator::Opcode>(input_count),
66 Operator::kNoProperties, input_count, 1, "op"); 66 Operator::kNoProperties,
67 Node* n1 = graph()->NewNode(&op1, input_count, inputs); 67 static_cast<int>(input_count), 1, "op");
68 Node* n1 = graph()->NewNode(&op1, static_cast<int>(input_count), inputs);
68 Reduction r1 = Reduce(n1); 69 Reduction r1 = Reduce(n1);
69 EXPECT_FALSE(r1.Changed()); 70 EXPECT_FALSE(r1.Changed());
70 71
71 const SimpleOperator op2(static_cast<Operator::Opcode>(input_count), 72 const SimpleOperator op2(static_cast<Operator::Opcode>(input_count),
72 Operator::kNoProperties, input_count, 1, "op"); 73 Operator::kNoProperties,
73 Node* n2 = graph()->NewNode(&op2, input_count, inputs); 74 static_cast<int>(input_count), 1, "op");
75 Node* n2 = graph()->NewNode(&op2, static_cast<int>(input_count), inputs);
74 Reduction r2 = Reduce(n2); 76 Reduction r2 = Reduce(n2);
75 EXPECT_TRUE(r2.Changed()); 77 EXPECT_TRUE(r2.Changed());
76 EXPECT_EQ(n1, r2.replacement()); 78 EXPECT_EQ(n1, r2.replacement());
77 } 79 }
78 } 80 }
79 81
80 82
81 TEST_F(ValueNumberingReducerTest, SubsequentReductionsYieldTheSameNode) { 83 TEST_F(ValueNumberingReducerTest, SubsequentReductionsYieldTheSameNode) {
82 static const size_t kMaxInputCount = 16; 84 static const size_t kMaxInputCount = 16;
83 Node* inputs[kMaxInputCount]; 85 Node* inputs[kMaxInputCount];
84 for (size_t i = 0; i < arraysize(inputs); ++i) { 86 for (size_t i = 0; i < arraysize(inputs); ++i) {
85 Operator::Opcode opcode = static_cast<Operator::Opcode>( 87 Operator::Opcode opcode = static_cast<Operator::Opcode>(
86 std::numeric_limits<Operator::Opcode>::max() - i); 88 std::numeric_limits<Operator::Opcode>::max() - i);
87 inputs[i] = graph()->NewNode(new (zone()) SimpleOperator( 89 inputs[i] = graph()->NewNode(new (zone()) SimpleOperator(
88 opcode, Operator::kNoProperties, 0, 1, "Operator")); 90 opcode, Operator::kNoProperties, 0, 1, "Operator"));
89 } 91 }
90 TRACED_FORRANGE(size_t, input_count, 0, arraysize(inputs)) { 92 TRACED_FORRANGE(size_t, input_count, 0, arraysize(inputs)) {
91 const SimpleOperator op1(1, Operator::kNoProperties, input_count, 1, "op1"); 93 const SimpleOperator op1(1, Operator::kNoProperties,
92 Node* n = graph()->NewNode(&op1, input_count, inputs); 94 static_cast<int>(input_count), 1, "op1");
95 Node* n = graph()->NewNode(&op1, static_cast<int>(input_count), inputs);
93 Reduction r = Reduce(n); 96 Reduction r = Reduce(n);
94 EXPECT_FALSE(r.Changed()); 97 EXPECT_FALSE(r.Changed());
95 98
96 r = Reduce(graph()->NewNode(&op1, input_count, inputs)); 99 r = Reduce(graph()->NewNode(&op1, static_cast<int>(input_count), inputs));
97 ASSERT_TRUE(r.Changed()); 100 ASSERT_TRUE(r.Changed());
98 EXPECT_EQ(n, r.replacement()); 101 EXPECT_EQ(n, r.replacement());
99 102
100 r = Reduce(graph()->NewNode(&op1, input_count, inputs)); 103 r = Reduce(graph()->NewNode(&op1, static_cast<int>(input_count), inputs));
101 ASSERT_TRUE(r.Changed()); 104 ASSERT_TRUE(r.Changed());
102 EXPECT_EQ(n, r.replacement()); 105 EXPECT_EQ(n, r.replacement());
103 } 106 }
104 } 107 }
105 108
106 } // namespace compiler 109 } // namespace compiler
107 } // namespace internal 110 } // namespace internal
108 } // namespace v8 111 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698