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

Side by Side Diff: test/cctest/compiler/test-loop-analysis.cc

Issue 893533003: Revert "Make GCC happy again." and "Initial switch to Chromium-style CHECK_* and DCHECK_* macros.". (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/compiler/access-builder.h" 7 #include "src/compiler/access-builder.h"
8 #include "src/compiler/common-operator.h" 8 #include "src/compiler/common-operator.h"
9 #include "src/compiler/graph.h" 9 #include "src/compiler/graph.h"
10 #include "src/compiler/graph-visualizer.h" 10 #include "src/compiler/graph-visualizer.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 Zone zone; 130 Zone zone;
131 loop_tree = LoopFinder::BuildLoopTree(&graph, &zone); 131 loop_tree = LoopFinder::BuildLoopTree(&graph, &zone);
132 } 132 }
133 return loop_tree; 133 return loop_tree;
134 } 134 }
135 135
136 void CheckLoop(Node** header, int header_count, Node** body, int body_count) { 136 void CheckLoop(Node** header, int header_count, Node** body, int body_count) {
137 LoopTree* tree = GetLoopTree(); 137 LoopTree* tree = GetLoopTree();
138 LoopTree::Loop* loop = tree->ContainingLoop(header[0]); 138 LoopTree::Loop* loop = tree->ContainingLoop(header[0]);
139 CHECK(loop); 139 CHECK_NE(NULL, loop);
140 140
141 CHECK(header_count == static_cast<int>(loop->HeaderSize())); 141 CHECK(header_count == static_cast<int>(loop->HeaderSize()));
142 for (int i = 0; i < header_count; i++) { 142 for (int i = 0; i < header_count; i++) {
143 // Each header node should be in the loop. 143 // Each header node should be in the loop.
144 CHECK_EQ(loop, tree->ContainingLoop(header[i])); 144 CHECK_EQ(loop, tree->ContainingLoop(header[i]));
145 CheckRangeContains(tree->HeaderNodes(loop), header[i]); 145 CheckRangeContains(tree->HeaderNodes(loop), header[i]);
146 } 146 }
147 147
148 CHECK_EQ(body_count, static_cast<int>(loop->BodySize())); 148 CHECK_EQ(body_count, static_cast<int>(loop->BodySize()));
149 // TODO(turbofan): O(n^2) set equivalence in this test. 149 // TODO(turbofan): O(n^2) set equivalence in this test.
150 for (int i = 0; i < body_count; i++) { 150 for (int i = 0; i < body_count; i++) {
151 // Each body node should be contained in the loop. 151 // Each body node should be contained in the loop.
152 CHECK(tree->Contains(loop, body[i])); 152 CHECK(tree->Contains(loop, body[i]));
153 CheckRangeContains(tree->BodyNodes(loop), body[i]); 153 CheckRangeContains(tree->BodyNodes(loop), body[i]);
154 } 154 }
155 } 155 }
156 156
157 void CheckRangeContains(NodeRange range, Node* node) { 157 void CheckRangeContains(NodeRange range, Node* node) {
158 CHECK_NE(range.end(), std::find(range.begin(), range.end(), node)); 158 CHECK_NE(range.end(), std::find(range.begin(), range.end(), node));
159 } 159 }
160 160
161 void CheckNestedLoops(Node** chain, int chain_count) { 161 void CheckNestedLoops(Node** chain, int chain_count) {
162 LoopTree* tree = GetLoopTree(); 162 LoopTree* tree = GetLoopTree();
163 for (int i = 0; i < chain_count; i++) { 163 for (int i = 0; i < chain_count; i++) {
164 Node* header = chain[i]; 164 Node* header = chain[i];
165 // Each header should be in a loop. 165 // Each header should be in a loop.
166 LoopTree::Loop* loop = tree->ContainingLoop(header); 166 LoopTree::Loop* loop = tree->ContainingLoop(header);
167 CHECK(loop); 167 CHECK_NE(NULL, loop);
168 // Check parentage. 168 // Check parentage.
169 LoopTree::Loop* parent = 169 LoopTree::Loop* parent =
170 i == 0 ? NULL : tree->ContainingLoop(chain[i - 1]); 170 i == 0 ? NULL : tree->ContainingLoop(chain[i - 1]);
171 CHECK_EQ(parent, loop->parent()); 171 CHECK_EQ(parent, loop->parent());
172 for (int j = i - 1; j >= 0; j--) { 172 for (int j = i - 1; j >= 0; j--) {
173 // This loop should be nested inside all the outer loops. 173 // This loop should be nested inside all the outer loops.
174 Node* outer_header = chain[j]; 174 Node* outer_header = chain[j];
175 LoopTree::Loop* outer = tree->ContainingLoop(outer_header); 175 LoopTree::Loop* outer = tree->ContainingLoop(outer_header);
176 CHECK(tree->Contains(outer, header)); 176 CHECK(tree->Contains(outer, header));
177 CHECK(!tree->Contains(loop, outer_header)); 177 CHECK(!tree->Contains(loop, outer_header));
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 TEST(LaManyChained_64) { RunManyChainedLoops_i(64); } 968 TEST(LaManyChained_64) { RunManyChainedLoops_i(64); }
969 969
970 TEST(LaManyNested_30) { RunManyNestedLoops_i(30); } 970 TEST(LaManyNested_30) { RunManyNestedLoops_i(30); }
971 TEST(LaManyNested_31) { RunManyNestedLoops_i(31); } 971 TEST(LaManyNested_31) { RunManyNestedLoops_i(31); }
972 TEST(LaManyNested_32) { RunManyNestedLoops_i(32); } 972 TEST(LaManyNested_32) { RunManyNestedLoops_i(32); }
973 TEST(LaManyNested_33) { RunManyNestedLoops_i(33); } 973 TEST(LaManyNested_33) { RunManyNestedLoops_i(33); }
974 TEST(LaManyNested_34) { RunManyNestedLoops_i(34); } 974 TEST(LaManyNested_34) { RunManyNestedLoops_i(34); }
975 TEST(LaManyNested_62) { RunManyNestedLoops_i(62); } 975 TEST(LaManyNested_62) { RunManyNestedLoops_i(62); }
976 TEST(LaManyNested_63) { RunManyNestedLoops_i(63); } 976 TEST(LaManyNested_63) { RunManyNestedLoops_i(63); }
977 TEST(LaManyNested_64) { RunManyNestedLoops_i(64); } 977 TEST(LaManyNested_64) { RunManyNestedLoops_i(64); }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-linkage.cc ('k') | test/cctest/compiler/test-loop-assignment-analysis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698