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

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

Issue 677433002: Add floor, ceil, round (truncate) instructions for ia32, x64 (if SSE4.1) and (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address changes and fix compilation on mac. Created 6 years, 1 month 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 | « src/compiler/x64/instruction-selector-x64.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/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/compiler/instruction-selector.h"
10 #include "src/compiler/pipeline.h" 11 #include "src/compiler/pipeline.h"
11 #include "src/compiler/raw-machine-assembler.h" 12 #include "src/compiler/raw-machine-assembler.h"
12 #include "src/simulator.h" 13 #include "src/simulator.h"
13 #include "test/cctest/compiler/call-tester.h" 14 #include "test/cctest/compiler/call-tester.h"
14 15
15 namespace v8 { 16 namespace v8 {
16 namespace internal { 17 namespace internal {
17 namespace compiler { 18 namespace compiler {
18 19
19 template <typename MachineAssembler> 20 template <typename MachineAssembler>
20 class MachineAssemblerTester : public HandleAndZoneScope, 21 class MachineAssemblerTester : public HandleAndZoneScope,
21 public CallHelper, 22 public CallHelper,
22 public MachineAssembler { 23 public MachineAssembler {
23 public: 24 public:
24 MachineAssemblerTester(MachineType return_type, MachineType p0, 25 MachineAssemblerTester(MachineType return_type, MachineType p0,
25 MachineType p1, MachineType p2, MachineType p3, 26 MachineType p1, MachineType p2, MachineType p3,
26 MachineType p4) 27 MachineType p4,
28 MachineOperatorBuilder::Flags flags =
29 MachineOperatorBuilder::Flag::kNoFlags)
27 : HandleAndZoneScope(), 30 : HandleAndZoneScope(),
28 CallHelper( 31 CallHelper(
29 main_isolate(), 32 main_isolate(),
30 MakeMachineSignature(main_zone(), return_type, p0, p1, p2, p3, p4)), 33 MakeMachineSignature(main_zone(), return_type, p0, p1, p2, p3, p4)),
31 MachineAssembler( 34 MachineAssembler(
32 new (main_zone()) Graph(main_zone()), 35 new (main_zone()) Graph(main_zone()),
33 MakeMachineSignature(main_zone(), return_type, p0, p1, p2, p3, p4), 36 MakeMachineSignature(main_zone(), return_type, p0, p1, p2, p3, p4),
34 kMachPtr) {} 37 kMachPtr, flags) {}
35 38
36 Node* LoadFromPointer(void* address, MachineType rep, int32_t offset = 0) { 39 Node* LoadFromPointer(void* address, MachineType rep, int32_t offset = 0) {
37 return this->Load(rep, this->PointerConstant(address), 40 return this->Load(rep, this->PointerConstant(address),
38 this->Int32Constant(offset)); 41 this->Int32Constant(offset));
39 } 42 }
40 43
41 void StoreToPointer(void* address, MachineType rep, Node* node) { 44 void StoreToPointer(void* address, MachineType rep, Node* node) {
42 this->Store(rep, this->PointerConstant(address), node); 45 this->Store(rep, this->PointerConstant(address), node);
43 } 46 }
44 47
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 class RawMachineAssemblerTester 85 class RawMachineAssemblerTester
83 : public MachineAssemblerTester<RawMachineAssembler>, 86 : public MachineAssemblerTester<RawMachineAssembler>,
84 public CallHelper2<ReturnType, RawMachineAssemblerTester<ReturnType> > { 87 public CallHelper2<ReturnType, RawMachineAssemblerTester<ReturnType> > {
85 public: 88 public:
86 RawMachineAssemblerTester(MachineType p0 = kMachNone, 89 RawMachineAssemblerTester(MachineType p0 = kMachNone,
87 MachineType p1 = kMachNone, 90 MachineType p1 = kMachNone,
88 MachineType p2 = kMachNone, 91 MachineType p2 = kMachNone,
89 MachineType p3 = kMachNone, 92 MachineType p3 = kMachNone,
90 MachineType p4 = kMachNone) 93 MachineType p4 = kMachNone)
91 : MachineAssemblerTester<RawMachineAssembler>( 94 : MachineAssemblerTester<RawMachineAssembler>(
92 ReturnValueTraits<ReturnType>::Representation(), p0, p1, p2, p3, 95 ReturnValueTraits<ReturnType>::Representation(), p0, p1, p2, p3, p4,
93 p4) {} 96 InstructionSelector::SupportedMachineOperatorFlags()) {}
94 97
95 template <typename Ci, typename Fn> 98 template <typename Ci, typename Fn>
96 void Run(const Ci& ci, const Fn& fn) { 99 void Run(const Ci& ci, const Fn& fn) {
97 typename Ci::const_iterator i; 100 typename Ci::const_iterator i;
98 for (i = ci.begin(); i != ci.end(); ++i) { 101 for (i = ci.begin(); i != ci.end(); ++i) {
99 CHECK_EQ(fn(*i), this->Call(*i)); 102 CHECK_EQ(fn(*i), this->Call(*i));
100 } 103 }
101 } 104 }
102 105
103 template <typename Ci, typename Cj, typename Fn> 106 template <typename Ci, typename Cj, typename Fn>
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 332
330 void Run(RawMachineAssemblerTester<int32_t>* m); 333 void Run(RawMachineAssemblerTester<int32_t>* m);
331 void RunLeft(RawMachineAssemblerTester<int32_t>* m); 334 void RunLeft(RawMachineAssemblerTester<int32_t>* m);
332 void RunRight(RawMachineAssemblerTester<int32_t>* m); 335 void RunRight(RawMachineAssemblerTester<int32_t>* m);
333 }; 336 };
334 } // namespace compiler 337 } // namespace compiler
335 } // namespace internal 338 } // namespace internal
336 } // namespace v8 339 } // namespace v8
337 340
338 #endif // V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ 341 #endif // V8_CCTEST_COMPILER_CODEGEN_TESTER_H_
OLDNEW
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | test/cctest/compiler/test-run-machops.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698