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

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

Issue 1702023002: [wasm] Replace the BufferedRawMachineAssemblerTester in the WasmRunner. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Code cleanup. Created 4 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
« no previous file with comments | « test/cctest/compiler/call-tester.h ('k') | test/cctest/compiler/value-helper.h » ('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_CODEGEN_TESTER_H_ 5 #ifndef V8_CCTEST_COMPILER_CODEGEN_TESTER_H_
6 #define V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ 6 #define V8_CCTEST_COMPILER_CODEGEN_TESTER_H_
7 7
8 #include "src/compiler/instruction-selector.h" 8 #include "src/compiler/instruction-selector.h"
9 #include "src/compiler/pipeline.h" 9 #include "src/compiler/pipeline.h"
10 #include "src/compiler/raw-machine-assembler.h" 10 #include "src/compiler/raw-machine-assembler.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // memory it is possible to return 64 bit values. 106 // memory it is possible to return 64 bit values.
107 void Return(Node* input) { 107 void Return(Node* input) {
108 Store(MachineTypeForC<ReturnType>().representation(), 108 Store(MachineTypeForC<ReturnType>().representation(),
109 RawMachineAssembler::Parameter(return_parameter_index_), input, 109 RawMachineAssembler::Parameter(return_parameter_index_), input,
110 kNoWriteBarrier); 110 kNoWriteBarrier);
111 RawMachineAssembler::Return(Int32Constant(1234)); 111 RawMachineAssembler::Return(Int32Constant(1234));
112 } 112 }
113 113
114 ReturnType Call() { 114 ReturnType Call() {
115 ReturnType return_value; 115 ReturnType return_value;
116 test_graph_signature_->VerifyParams(); 116 CSignature::VerifyParams(test_graph_signature_);
117 CallHelper<int32_t>::Call(reinterpret_cast<void*>(&return_value)); 117 CallHelper<int32_t>::Call(reinterpret_cast<void*>(&return_value));
118 return return_value; 118 return return_value;
119 } 119 }
120 120
121 template <typename P0> 121 template <typename P0>
122 ReturnType Call(P0 p0) { 122 ReturnType Call(P0 p0) {
123 ReturnType return_value; 123 ReturnType return_value;
124 test_graph_signature_->VerifyParams<P0>(); 124 CSignature::VerifyParams<P0>(test_graph_signature_);
125 CallHelper<int32_t>::Call(reinterpret_cast<void*>(&p0), 125 CallHelper<int32_t>::Call(reinterpret_cast<void*>(&p0),
126 reinterpret_cast<void*>(&return_value)); 126 reinterpret_cast<void*>(&return_value));
127 return return_value; 127 return return_value;
128 } 128 }
129 129
130 template <typename P0, typename P1> 130 template <typename P0, typename P1>
131 ReturnType Call(P0 p0, P1 p1) { 131 ReturnType Call(P0 p0, P1 p1) {
132 ReturnType return_value; 132 ReturnType return_value;
133 test_graph_signature_->VerifyParams<P0, P1>(); 133 CSignature::VerifyParams<P0, P1>(test_graph_signature_);
134 CallHelper<int32_t>::Call(reinterpret_cast<void*>(&p0), 134 CallHelper<int32_t>::Call(reinterpret_cast<void*>(&p0),
135 reinterpret_cast<void*>(&p1), 135 reinterpret_cast<void*>(&p1),
136 reinterpret_cast<void*>(&return_value)); 136 reinterpret_cast<void*>(&return_value));
137 return return_value; 137 return return_value;
138 } 138 }
139 139
140 template <typename P0, typename P1, typename P2> 140 template <typename P0, typename P1, typename P2>
141 ReturnType Call(P0 p0, P1 p1, P2 p2) { 141 ReturnType Call(P0 p0, P1 p1, P2 p2) {
142 ReturnType return_value; 142 ReturnType return_value;
143 test_graph_signature_->VerifyParams<P0, P1, P2>(); 143 CSignature::VerifyParams<P0, P1, P2>(test_graph_signature_);
144 CallHelper<int32_t>::Call( 144 CallHelper<int32_t>::Call(
145 reinterpret_cast<void*>(&p0), reinterpret_cast<void*>(&p1), 145 reinterpret_cast<void*>(&p0), reinterpret_cast<void*>(&p1),
146 reinterpret_cast<void*>(&p2), reinterpret_cast<void*>(&return_value)); 146 reinterpret_cast<void*>(&p2), reinterpret_cast<void*>(&return_value));
147 return return_value; 147 return return_value;
148 } 148 }
149 149
150 template <typename P0, typename P1, typename P2, typename P3> 150 template <typename P0, typename P1, typename P2, typename P3>
151 ReturnType Call(P0 p0, P1 p1, P2 p2, P3 p3) { 151 ReturnType Call(P0 p0, P1 p1, P2 p2, P3 p3) {
152 ReturnType return_value; 152 ReturnType return_value;
153 test_graph_signature_->VerifyParams<P0, P1, P2, P3>(); 153 CSignature::VerifyParams<P0, P1, P2, P3>(test_graph_signature_);
154 CallHelper<int32_t>::Call( 154 CallHelper<int32_t>::Call(
155 reinterpret_cast<void*>(&p0), reinterpret_cast<void*>(&p1), 155 reinterpret_cast<void*>(&p0), reinterpret_cast<void*>(&p1),
156 reinterpret_cast<void*>(&p2), reinterpret_cast<void*>(&p3), 156 reinterpret_cast<void*>(&p2), reinterpret_cast<void*>(&p3),
157 reinterpret_cast<void*>(&return_value)); 157 reinterpret_cast<void*>(&return_value));
158 return return_value; 158 return return_value;
159 } 159 }
160 160
161 private: 161 private:
162 BufferedRawMachineAssemblerTester(uint32_t return_parameter_index, 162 BufferedRawMachineAssemblerTester(uint32_t return_parameter_index,
163 MachineType p0, MachineType p1, 163 MachineType p0, MachineType p1,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 // to the IR graph, and adds Load nodes to the IR graph to load the 255 // to the IR graph, and adds Load nodes to the IR graph to load the
256 // parameters from memory. Thereby it is possible to pass 64 bit parameters 256 // parameters from memory. Thereby it is possible to pass 64 bit parameters
257 // to the IR graph. 257 // to the IR graph.
258 Node* Parameter(size_t index) { 258 Node* Parameter(size_t index) {
259 CHECK(index >= 0 && index < 4); 259 CHECK(index >= 0 && index < 4);
260 return parameter_nodes_[index]; 260 return parameter_nodes_[index];
261 } 261 }
262 262
263 263
264 void Call() { 264 void Call() {
265 test_graph_signature_->VerifyParams(); 265 CSignature::VerifyParams(test_graph_signature_);
266 CallHelper<void>::Call(); 266 CallHelper<void>::Call();
267 } 267 }
268 268
269 template <typename P0> 269 template <typename P0>
270 void Call(P0 p0) { 270 void Call(P0 p0) {
271 test_graph_signature_->VerifyParams<P0>(); 271 CSignature::VerifyParams<P0>(test_graph_signature_);
272 CallHelper<void>::Call(reinterpret_cast<void*>(&p0)); 272 CallHelper<void>::Call(reinterpret_cast<void*>(&p0));
273 } 273 }
274 274
275 template <typename P0, typename P1> 275 template <typename P0, typename P1>
276 void Call(P0 p0, P1 p1) { 276 void Call(P0 p0, P1 p1) {
277 test_graph_signature_->VerifyParams<P0, P1>(); 277 CSignature::VerifyParams<P0, P1>(test_graph_signature_);
278 CallHelper<void>::Call(reinterpret_cast<void*>(&p0), 278 CallHelper<void>::Call(reinterpret_cast<void*>(&p0),
279 reinterpret_cast<void*>(&p1)); 279 reinterpret_cast<void*>(&p1));
280 } 280 }
281 281
282 template <typename P0, typename P1, typename P2> 282 template <typename P0, typename P1, typename P2>
283 void Call(P0 p0, P1 p1, P2 p2) { 283 void Call(P0 p0, P1 p1, P2 p2) {
284 test_graph_signature_->VerifyParams<P0, P1, P2>(); 284 CSignature::VerifyParams<P0, P1, P2>(test_graph_signature_);
285 CallHelper<void>::Call(reinterpret_cast<void*>(&p0), 285 CallHelper<void>::Call(reinterpret_cast<void*>(&p0),
286 reinterpret_cast<void*>(&p1), 286 reinterpret_cast<void*>(&p1),
287 reinterpret_cast<void*>(&p2)); 287 reinterpret_cast<void*>(&p2));
288 } 288 }
289 289
290 template <typename P0, typename P1, typename P2, typename P3> 290 template <typename P0, typename P1, typename P2, typename P3>
291 void Call(P0 p0, P1 p1, P2 p2, P3 p3) { 291 void Call(P0 p0, P1 p1, P2 p2, P3 p3) {
292 test_graph_signature_->VerifyParams<P0, P1, P2, P3>(); 292 CSignature::VerifyParams<P0, P1, P2, P3>(test_graph_signature_);
293 CallHelper<void>::Call( 293 CallHelper<void>::Call(
294 reinterpret_cast<void*>(&p0), reinterpret_cast<void*>(&p1), 294 reinterpret_cast<void*>(&p0), reinterpret_cast<void*>(&p1),
295 reinterpret_cast<void*>(&p2), reinterpret_cast<void*>(&p3)); 295 reinterpret_cast<void*>(&p2), reinterpret_cast<void*>(&p3));
296 } 296 }
297 297
298 private: 298 private:
299 CSignature* test_graph_signature_; 299 CSignature* test_graph_signature_;
300 Node* parameter_nodes_[4]; 300 Node* parameter_nodes_[4];
301 }; 301 };
302 static const bool USE_RESULT_BUFFER = true; 302 static const bool USE_RESULT_BUFFER = true;
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 533
534 private: 534 private:
535 BinopGen<int32_t>* gen; 535 BinopGen<int32_t>* gen;
536 int32_t input_a; 536 int32_t input_a;
537 int32_t input_b; 537 int32_t input_b;
538 538
539 void Run(RawMachineAssemblerTester<int32_t>* m); 539 void Run(RawMachineAssemblerTester<int32_t>* m);
540 void RunLeft(RawMachineAssemblerTester<int32_t>* m); 540 void RunLeft(RawMachineAssemblerTester<int32_t>* m);
541 void RunRight(RawMachineAssemblerTester<int32_t>* m); 541 void RunRight(RawMachineAssemblerTester<int32_t>* m);
542 }; 542 };
543
544 // TODO(bmeurer): Drop this crap once we switch to GTest/Gmock.
545 static inline void CheckFloatEq(volatile float x, volatile float y) {
546 if (std::isnan(x)) {
547 CHECK(std::isnan(y));
548 } else {
549 CHECK_EQ(x, y);
550 }
551 }
552
553 static inline void CheckDoubleEq(volatile double x, volatile double y) {
554 if (std::isnan(x)) {
555 CHECK(std::isnan(y));
556 } else {
557 CHECK_EQ(x, y);
558 }
559 }
560
561 } // namespace compiler 543 } // namespace compiler
562 } // namespace internal 544 } // namespace internal
563 } // namespace v8 545 } // namespace v8
564 546
565 #endif // V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ 547 #endif // V8_CCTEST_COMPILER_CODEGEN_TESTER_H_
OLDNEW
« no previous file with comments | « test/cctest/compiler/call-tester.h ('k') | test/cctest/compiler/value-helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698