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

Side by Side Diff: src/compiler/machine-operator.h

Issue 1128133003: [turbofan] Make an OptionalOperator for MachineOperatorBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: OPTIONAL macro Created 5 years, 6 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/compiler/js-intrinsic-lowering.cc ('k') | src/compiler/machine-operator.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_COMPILER_MACHINE_OPERATOR_H_ 5 #ifndef V8_COMPILER_MACHINE_OPERATOR_H_
6 #define V8_COMPILER_MACHINE_OPERATOR_H_ 6 #define V8_COMPILER_MACHINE_OPERATOR_H_
7 7
8 #include "src/base/flags.h" 8 #include "src/base/flags.h"
9 #include "src/compiler/machine-type.h" 9 #include "src/compiler/machine-type.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 namespace compiler { 13 namespace compiler {
14 14
15 // Forward declarations. 15 // Forward declarations.
16 struct MachineOperatorGlobalCache; 16 struct MachineOperatorGlobalCache;
17 class Operator; 17 class Operator;
18 18
19 // For operators that are not supported on all platforms.
20 class OptionalOperator {
21 public:
22 explicit OptionalOperator(const Operator* op) : op_(op) {}
23
24 bool IsSupported() const { return op_ != nullptr; }
25 const Operator* op() const {
26 DCHECK_NOT_NULL(op_);
27 return op_;
28 }
29
30 private:
31 const Operator* op_;
32 };
19 33
20 // Supported write barrier modes. 34 // Supported write barrier modes.
21 enum WriteBarrierKind { kNoWriteBarrier, kFullWriteBarrier }; 35 enum WriteBarrierKind { kNoWriteBarrier, kFullWriteBarrier };
22 36
23 std::ostream& operator<<(std::ostream& os, WriteBarrierKind); 37 std::ostream& operator<<(std::ostream& os, WriteBarrierKind);
24 38
25 39
26 // A Load needs a MachineType. 40 // A Load needs a MachineType.
27 typedef MachineType LoadRepresentation; 41 typedef MachineType LoadRepresentation;
28 42
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 kNoFlags = 0u, 90 kNoFlags = 0u,
77 kFloat32Max = 1u << 0, 91 kFloat32Max = 1u << 0,
78 kFloat32Min = 1u << 1, 92 kFloat32Min = 1u << 1,
79 kFloat64Max = 1u << 2, 93 kFloat64Max = 1u << 2,
80 kFloat64Min = 1u << 3, 94 kFloat64Min = 1u << 3,
81 kFloat64RoundDown = 1u << 4, 95 kFloat64RoundDown = 1u << 4,
82 kFloat64RoundTruncate = 1u << 5, 96 kFloat64RoundTruncate = 1u << 5,
83 kFloat64RoundTiesAway = 1u << 6, 97 kFloat64RoundTiesAway = 1u << 6,
84 kInt32DivIsSafe = 1u << 7, 98 kInt32DivIsSafe = 1u << 7,
85 kUint32DivIsSafe = 1u << 8, 99 kUint32DivIsSafe = 1u << 8,
86 kWord32ShiftIsSafe = 1u << 9 100 kWord32ShiftIsSafe = 1u << 9,
101 kAllOptionalOps = kFloat32Max | kFloat32Min | kFloat64Max | kFloat64Min |
102 kFloat64RoundDown | kFloat64RoundTruncate |
103 kFloat64RoundTiesAway
87 }; 104 };
88 typedef base::Flags<Flag, unsigned> Flags; 105 typedef base::Flags<Flag, unsigned> Flags;
89 106
90 explicit MachineOperatorBuilder(Zone* zone, MachineType word = kMachPtr, 107 explicit MachineOperatorBuilder(Zone* zone, MachineType word = kMachPtr,
91 Flags supportedOperators = kNoFlags); 108 Flags supportedOperators = kNoFlags);
92 109
93 const Operator* Word32And(); 110 const Operator* Word32And();
94 const Operator* Word32Or(); 111 const Operator* Word32Or();
95 const Operator* Word32Xor(); 112 const Operator* Word32Xor();
96 const Operator* Word32Shl(); 113 const Operator* Word32Shl();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 const Operator* Float32Equal(); 196 const Operator* Float32Equal();
180 const Operator* Float32LessThan(); 197 const Operator* Float32LessThan();
181 const Operator* Float32LessThanOrEqual(); 198 const Operator* Float32LessThanOrEqual();
182 199
183 // Floating point comparisons complying to IEEE 754 (double-precision). 200 // Floating point comparisons complying to IEEE 754 (double-precision).
184 const Operator* Float64Equal(); 201 const Operator* Float64Equal();
185 const Operator* Float64LessThan(); 202 const Operator* Float64LessThan();
186 const Operator* Float64LessThanOrEqual(); 203 const Operator* Float64LessThanOrEqual();
187 204
188 // Floating point min/max complying to IEEE 754 (single-precision). 205 // Floating point min/max complying to IEEE 754 (single-precision).
189 const Operator* Float32Max(); 206 const OptionalOperator Float32Max();
190 const Operator* Float32Min(); 207 const OptionalOperator Float32Min();
191 bool HasFloat32Max() { return flags_ & kFloat32Max; }
192 bool HasFloat32Min() { return flags_ & kFloat32Min; }
193 208
194 // Floating point min/max complying to IEEE 754 (double-precision). 209 // Floating point min/max complying to IEEE 754 (double-precision).
195 const Operator* Float64Max(); 210 const OptionalOperator Float64Max();
196 const Operator* Float64Min(); 211 const OptionalOperator Float64Min();
197 bool HasFloat64Max() { return flags_ & kFloat64Max; }
198 bool HasFloat64Min() { return flags_ & kFloat64Min; }
199 212
200 // Floating point abs complying to IEEE 754 (single-precision). 213 // Floating point abs complying to IEEE 754 (single-precision).
201 const Operator* Float32Abs(); 214 const Operator* Float32Abs();
202 215
203 // Floating point abs complying to IEEE 754 (double-precision). 216 // Floating point abs complying to IEEE 754 (double-precision).
204 const Operator* Float64Abs(); 217 const Operator* Float64Abs();
205 218
206 // Floating point rounding. 219 // Floating point rounding.
207 const Operator* Float64RoundDown(); 220 const OptionalOperator Float64RoundDown();
208 const Operator* Float64RoundTruncate(); 221 const OptionalOperator Float64RoundTruncate();
209 const Operator* Float64RoundTiesAway(); 222 const OptionalOperator Float64RoundTiesAway();
210 bool HasFloat64RoundDown() { return flags_ & kFloat64RoundDown; }
211 bool HasFloat64RoundTruncate() { return flags_ & kFloat64RoundTruncate; }
212 bool HasFloat64RoundTiesAway() { return flags_ & kFloat64RoundTiesAway; }
213 223
214 // Floating point bit representation. 224 // Floating point bit representation.
215 const Operator* Float64ExtractLowWord32(); 225 const Operator* Float64ExtractLowWord32();
216 const Operator* Float64ExtractHighWord32(); 226 const Operator* Float64ExtractHighWord32();
217 const Operator* Float64InsertLowWord32(); 227 const Operator* Float64InsertLowWord32();
218 const Operator* Float64InsertHighWord32(); 228 const Operator* Float64InsertHighWord32();
219 229
220 // load [base + index] 230 // load [base + index]
221 const Operator* Load(LoadRepresentation rep); 231 const Operator* Load(LoadRepresentation rep);
222 232
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 }; 286 };
277 287
278 288
279 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) 289 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags)
280 290
281 } // namespace compiler 291 } // namespace compiler
282 } // namespace internal 292 } // namespace internal
283 } // namespace v8 293 } // namespace v8
284 294
285 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ 295 #endif // V8_COMPILER_MACHINE_OPERATOR_H_
OLDNEW
« no previous file with comments | « src/compiler/js-intrinsic-lowering.cc ('k') | src/compiler/machine-operator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698