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

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

Issue 1661463002: [wasm] Provide backoff implementations for the Fxx rounding instructions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@trunc64-external-reference
Patch Set: rebase. 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 | « src/snapshot/serialize.cc ('k') | test/cctest/compiler/test-run-machops.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_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 22 matching lines...) Expand all
33 RawMachineAssembler( 33 RawMachineAssembler(
34 main_isolate(), new (main_zone()) Graph(main_zone()), 34 main_isolate(), new (main_zone()) Graph(main_zone()),
35 Linkage::GetSimplifiedCDescriptor( 35 Linkage::GetSimplifiedCDescriptor(
36 main_zone(), 36 main_zone(),
37 CSignature::New(main_zone(), MachineTypeForC<ReturnType>(), p0, 37 CSignature::New(main_zone(), MachineTypeForC<ReturnType>(), p0,
38 p1, p2, p3, p4), 38 p1, p2, p3, p4),
39 true), 39 true),
40 MachineType::PointerRepresentation(), 40 MachineType::PointerRepresentation(),
41 InstructionSelector::SupportedMachineOperatorFlags()) {} 41 InstructionSelector::SupportedMachineOperatorFlags()) {}
42 42
43 virtual ~RawMachineAssemblerTester() {}
44
43 void CheckNumber(double expected, Object* number) { 45 void CheckNumber(double expected, Object* number) {
44 CHECK(this->isolate()->factory()->NewNumber(expected)->SameValue(number)); 46 CHECK(this->isolate()->factory()->NewNumber(expected)->SameValue(number));
45 } 47 }
46 48
47 void CheckString(const char* expected, Object* string) { 49 void CheckString(const char* expected, Object* string) {
48 CHECK( 50 CHECK(
49 this->isolate()->factory()->InternalizeUtf8String(expected)->SameValue( 51 this->isolate()->factory()->InternalizeUtf8String(expected)->SameValue(
50 string)); 52 string));
51 } 53 }
52 54
(...skipping 26 matching lines...) Expand all
79 class BufferedRawMachineAssemblerTester 81 class BufferedRawMachineAssemblerTester
80 : public RawMachineAssemblerTester<int32_t> { 82 : public RawMachineAssemblerTester<int32_t> {
81 public: 83 public:
82 BufferedRawMachineAssemblerTester(MachineType p0 = MachineType::None(), 84 BufferedRawMachineAssemblerTester(MachineType p0 = MachineType::None(),
83 MachineType p1 = MachineType::None(), 85 MachineType p1 = MachineType::None(),
84 MachineType p2 = MachineType::None(), 86 MachineType p2 = MachineType::None(),
85 MachineType p3 = MachineType::None()) 87 MachineType p3 = MachineType::None())
86 : BufferedRawMachineAssemblerTester(ComputeParameterCount(p0, p1, p2, p3), 88 : BufferedRawMachineAssemblerTester(ComputeParameterCount(p0, p1, p2, p3),
87 p0, p1, p2, p3) {} 89 p0, p1, p2, p3) {}
88 90
91 virtual byte* Generate() { return RawMachineAssemblerTester::Generate(); }
89 92
90 // The BufferedRawMachineAssemblerTester does not pass parameters directly 93 // The BufferedRawMachineAssemblerTester does not pass parameters directly
91 // to the constructed IR graph. Instead it passes a pointer to the parameter 94 // to the constructed IR graph. Instead it passes a pointer to the parameter
92 // to the IR graph, and adds Load nodes to the IR graph to load the 95 // to the IR graph, and adds Load nodes to the IR graph to load the
93 // parameters from memory. Thereby it is possible to pass 64 bit parameters 96 // parameters from memory. Thereby it is possible to pass 64 bit parameters
94 // to the IR graph. 97 // to the IR graph.
95 Node* Parameter(size_t index) { 98 Node* Parameter(size_t index) {
96 CHECK(index < 4); 99 CHECK(index < 4);
97 return parameter_nodes_[index]; 100 return parameter_nodes_[index];
98 } 101 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 ? nullptr 241 ? nullptr
239 : Load(p1, RawMachineAssembler::Parameter(1)); 242 : Load(p1, RawMachineAssembler::Parameter(1));
240 parameter_nodes_[2] = p2 == MachineType::None() 243 parameter_nodes_[2] = p2 == MachineType::None()
241 ? nullptr 244 ? nullptr
242 : Load(p2, RawMachineAssembler::Parameter(2)); 245 : Load(p2, RawMachineAssembler::Parameter(2));
243 parameter_nodes_[3] = p3 == MachineType::None() 246 parameter_nodes_[3] = p3 == MachineType::None()
244 ? nullptr 247 ? nullptr
245 : Load(p3, RawMachineAssembler::Parameter(3)); 248 : Load(p3, RawMachineAssembler::Parameter(3));
246 } 249 }
247 250
251 virtual byte* Generate() { return RawMachineAssemblerTester::Generate(); }
252
248 // The BufferedRawMachineAssemblerTester does not pass parameters directly 253 // The BufferedRawMachineAssemblerTester does not pass parameters directly
249 // to the constructed IR graph. Instead it passes a pointer to the parameter 254 // to the constructed IR graph. Instead it passes a pointer to the parameter
250 // 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
251 // 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
252 // to the IR graph. 257 // to the IR graph.
253 Node* Parameter(size_t index) { 258 Node* Parameter(size_t index) {
254 CHECK(index >= 0 && index < 4); 259 CHECK(index >= 0 && index < 4);
255 return parameter_nodes_[index]; 260 return parameter_nodes_[index];
256 } 261 }
257 262
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 public: 521 public:
517 virtual void gen(RawMachineAssemblerTester<int32_t>* m, Node* a, Node* b) = 0; 522 virtual void gen(RawMachineAssemblerTester<int32_t>* m, Node* a, Node* b) = 0;
518 virtual T expected(T a, T b) = 0; 523 virtual T expected(T a, T b) = 0;
519 virtual ~BinopGen() {} 524 virtual ~BinopGen() {}
520 }; 525 };
521 526
522 // A helper class to generate various combination of input shape combinations 527 // A helper class to generate various combination of input shape combinations
523 // and run the generated code to ensure it produces the correct results. 528 // and run the generated code to ensure it produces the correct results.
524 class Int32BinopInputShapeTester { 529 class Int32BinopInputShapeTester {
525 public: 530 public:
526 explicit Int32BinopInputShapeTester(BinopGen<int32_t>* g) : gen(g) {} 531 explicit Int32BinopInputShapeTester(BinopGen<int32_t>* g)
532 : gen(g), input_a(0), input_b(0) {}
527 533
528 void TestAllInputShapes(); 534 void TestAllInputShapes();
529 535
530 private: 536 private:
531 BinopGen<int32_t>* gen; 537 BinopGen<int32_t>* gen;
532 int32_t input_a; 538 int32_t input_a;
533 int32_t input_b; 539 int32_t input_b;
534 540
535 void Run(RawMachineAssemblerTester<int32_t>* m); 541 void Run(RawMachineAssemblerTester<int32_t>* m);
536 void RunLeft(RawMachineAssemblerTester<int32_t>* m); 542 void RunLeft(RawMachineAssemblerTester<int32_t>* m);
(...skipping 15 matching lines...) Expand all
552 } else { 558 } else {
553 CHECK_EQ(x, y); 559 CHECK_EQ(x, y);
554 } 560 }
555 } 561 }
556 562
557 } // namespace compiler 563 } // namespace compiler
558 } // namespace internal 564 } // namespace internal
559 } // namespace v8 565 } // namespace v8
560 566
561 #endif // V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ 567 #endif // V8_CCTEST_COMPILER_CODEGEN_TESTER_H_
OLDNEW
« no previous file with comments | « src/snapshot/serialize.cc ('k') | test/cctest/compiler/test-run-machops.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698