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

Side by Side Diff: test/cctest/compiler/graph-builder-tester.h

Issue 1506753002: [test] Test expectations in cctest should use CHECK and not DCHECK. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/cctest/compiler/c-signature.h ('k') | test/cctest/compiler/test-instruction.cc » ('j') | 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 #ifndef V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ 5 #ifndef V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_
6 #define V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ 6 #define V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_
7 7
8 #include "src/compiler/common-operator.h" 8 #include "src/compiler/common-operator.h"
9 #include "src/compiler/instruction-selector.h" 9 #include "src/compiler/instruction-selector.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 effect_(NULL), 61 effect_(NULL),
62 return_(NULL), 62 return_(NULL),
63 parameters_(main_zone()->template NewArray<Node*>(parameter_count())) { 63 parameters_(main_zone()->template NewArray<Node*>(parameter_count())) {
64 Begin(static_cast<int>(parameter_count())); 64 Begin(static_cast<int>(parameter_count()));
65 InitParameters(); 65 InitParameters();
66 } 66 }
67 virtual ~GraphBuilderTester() {} 67 virtual ~GraphBuilderTester() {}
68 68
69 void GenerateCode() { Generate(); } 69 void GenerateCode() { Generate(); }
70 Node* Parameter(size_t index) { 70 Node* Parameter(size_t index) {
71 DCHECK(index < parameter_count()); 71 CHECK_LT(index, parameter_count());
72 return parameters_[index]; 72 return parameters_[index];
73 } 73 }
74 74
75 Isolate* isolate() { return main_isolate(); } 75 Isolate* isolate() { return main_isolate(); }
76 Factory* factory() { return isolate()->factory(); } 76 Factory* factory() { return isolate()->factory(); }
77 77
78 // Initialize graph and builder. 78 // Initialize graph and builder.
79 void Begin(int num_parameters) { 79 void Begin(int num_parameters) {
80 DCHECK(graph()->start() == NULL); 80 CHECK_NULL(graph()->start());
81 Node* start = graph()->NewNode(common()->Start(num_parameters + 3)); 81 Node* start = graph()->NewNode(common()->Start(num_parameters + 3));
82 graph()->SetStart(start); 82 graph()->SetStart(start);
83 effect_ = start; 83 effect_ = start;
84 } 84 }
85 85
86 void Return(Node* value) { 86 void Return(Node* value) {
87 return_ = 87 return_ =
88 graph()->NewNode(common()->Return(), value, effect_, graph()->start()); 88 graph()->NewNode(common()->Return(), value, effect_, graph()->start());
89 effect_ = NULL; 89 effect_ = NULL;
90 } 90 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } 228 }
229 229
230 Handle<Code> GetCode() { 230 Handle<Code> GetCode() {
231 Generate(); 231 Generate();
232 return code_.ToHandleChecked(); 232 return code_.ToHandleChecked();
233 } 233 }
234 234
235 protected: 235 protected:
236 Node* MakeNode(const Operator* op, int value_input_count, 236 Node* MakeNode(const Operator* op, int value_input_count,
237 Node** value_inputs) { 237 Node** value_inputs) {
238 DCHECK(op->ValueInputCount() == value_input_count); 238 CHECK_EQ(op->ValueInputCount(), value_input_count);
239 239
240 DCHECK(!OperatorProperties::HasContextInput(op)); 240 CHECK(!OperatorProperties::HasContextInput(op));
241 DCHECK_EQ(0, OperatorProperties::GetFrameStateInputCount(op)); 241 CHECK_EQ(0, OperatorProperties::GetFrameStateInputCount(op));
242 bool has_control = op->ControlInputCount() == 1; 242 bool has_control = op->ControlInputCount() == 1;
243 bool has_effect = op->EffectInputCount() == 1; 243 bool has_effect = op->EffectInputCount() == 1;
244 244
245 DCHECK(op->ControlInputCount() < 2); 245 CHECK_LT(op->ControlInputCount(), 2);
246 DCHECK(op->EffectInputCount() < 2); 246 CHECK_LT(op->EffectInputCount(), 2);
247 247
248 Node* result = NULL; 248 Node* result = NULL;
249 if (!has_control && !has_effect) { 249 if (!has_control && !has_effect) {
250 result = graph()->NewNode(op, value_input_count, value_inputs); 250 result = graph()->NewNode(op, value_input_count, value_inputs);
251 } else { 251 } else {
252 int input_count_with_deps = value_input_count; 252 int input_count_with_deps = value_input_count;
253 if (has_control) ++input_count_with_deps; 253 if (has_control) ++input_count_with_deps;
254 if (has_effect) ++input_count_with_deps; 254 if (has_effect) ++input_count_with_deps;
255 Node** buffer = zone()->template NewArray<Node*>(input_count_with_deps); 255 Node** buffer = zone()->template NewArray<Node*>(input_count_with_deps);
256 memcpy(buffer, value_inputs, kPointerSize * value_input_count); 256 memcpy(buffer, value_inputs, kPointerSize * value_input_count);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 Node* return_; 303 Node* return_;
304 Node** parameters_; 304 Node** parameters_;
305 MaybeHandle<Code> code_; 305 MaybeHandle<Code> code_;
306 }; 306 };
307 307
308 } // namespace compiler 308 } // namespace compiler
309 } // namespace internal 309 } // namespace internal
310 } // namespace v8 310 } // namespace v8
311 311
312 #endif // V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ 312 #endif // V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_
OLDNEW
« no previous file with comments | « test/cctest/compiler/c-signature.h ('k') | test/cctest/compiler/test-instruction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698