OLD | NEW |
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_COMPILER_SIMPLIFIED_OPERATOR_H_ | 5 #ifndef V8_COMPILER_SIMPLIFIED_OPERATOR_H_ |
6 #define V8_COMPILER_SIMPLIFIED_OPERATOR_H_ | 6 #define V8_COMPILER_SIMPLIFIED_OPERATOR_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/base/compiler-specific.h" | 10 #include "src/base/compiler-specific.h" |
11 #include "src/compiler/operator.h" | 11 #include "src/compiler/operator.h" |
12 #include "src/compiler/types.h" | 12 #include "src/compiler/types.h" |
13 #include "src/globals.h" | 13 #include "src/globals.h" |
14 #include "src/handles.h" | 14 #include "src/handles.h" |
15 #include "src/machine-type.h" | 15 #include "src/machine-type.h" |
16 #include "src/objects.h" | 16 #include "src/objects.h" |
| 17 #include "src/zone/zone-handle-set.h" |
17 | 18 |
18 namespace v8 { | 19 namespace v8 { |
19 namespace internal { | 20 namespace internal { |
20 | 21 |
21 // Forward declarations. | 22 // Forward declarations. |
22 class Zone; | 23 class Zone; |
23 | 24 |
24 namespace compiler { | 25 namespace compiler { |
25 | 26 |
26 // Forward declarations. | 27 // Forward declarations. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 kCheckForMinusZero, | 137 kCheckForMinusZero, |
137 kDontCheckForMinusZero, | 138 kDontCheckForMinusZero, |
138 }; | 139 }; |
139 | 140 |
140 size_t hash_value(CheckForMinusZeroMode); | 141 size_t hash_value(CheckForMinusZeroMode); |
141 | 142 |
142 std::ostream& operator<<(std::ostream&, CheckForMinusZeroMode); | 143 std::ostream& operator<<(std::ostream&, CheckForMinusZeroMode); |
143 | 144 |
144 CheckForMinusZeroMode CheckMinusZeroModeOf(const Operator*) WARN_UNUSED_RESULT; | 145 CheckForMinusZeroMode CheckMinusZeroModeOf(const Operator*) WARN_UNUSED_RESULT; |
145 | 146 |
| 147 // A descriptor for map checks. |
| 148 class CheckMapsParameters final { |
| 149 public: |
| 150 explicit CheckMapsParameters(ZoneHandleSet<Map> const& maps) : maps_(maps) {} |
| 151 |
| 152 ZoneHandleSet<Map> const& maps() const { return maps_; } |
| 153 |
| 154 private: |
| 155 ZoneHandleSet<Map> const maps_; |
| 156 }; |
| 157 |
| 158 bool operator==(CheckMapsParameters const&, CheckMapsParameters const&); |
| 159 bool operator!=(CheckMapsParameters const&, CheckMapsParameters const&); |
| 160 |
| 161 size_t hash_value(CheckMapsParameters const&); |
| 162 |
| 163 std::ostream& operator<<(std::ostream&, CheckMapsParameters const&); |
| 164 |
| 165 CheckMapsParameters const& CheckMapsParametersOf(Operator const*) |
| 166 WARN_UNUSED_RESULT; |
| 167 |
146 // A descriptor for growing elements backing stores. | 168 // A descriptor for growing elements backing stores. |
147 enum class GrowFastElementsFlag : uint8_t { | 169 enum class GrowFastElementsFlag : uint8_t { |
148 kNone = 0u, | 170 kNone = 0u, |
149 kArrayObject = 1u << 0, // Update JSArray::length field. | 171 kArrayObject = 1u << 0, // Update JSArray::length field. |
150 kHoleyElements = 1u << 1, // Backing store is holey. | 172 kHoleyElements = 1u << 1, // Backing store is holey. |
151 kDoubleElements = 1u << 2, // Backing store contains doubles. | 173 kDoubleElements = 1u << 2, // Backing store contains doubles. |
152 }; | 174 }; |
153 typedef base::Flags<GrowFastElementsFlag> GrowFastElementsFlags; | 175 typedef base::Flags<GrowFastElementsFlag> GrowFastElementsFlags; |
154 | 176 |
155 DEFINE_OPERATORS_FOR_FLAGS(GrowFastElementsFlags) | 177 DEFINE_OPERATORS_FOR_FLAGS(GrowFastElementsFlags) |
156 | 178 |
157 std::ostream& operator<<(std::ostream&, GrowFastElementsFlags); | 179 std::ostream& operator<<(std::ostream&, GrowFastElementsFlags); |
158 | 180 |
159 GrowFastElementsFlags GrowFastElementsFlagsOf(const Operator*) | 181 GrowFastElementsFlags GrowFastElementsFlagsOf(const Operator*) |
160 WARN_UNUSED_RESULT; | 182 WARN_UNUSED_RESULT; |
161 | 183 |
162 // A descriptor for elements kind transitions. | 184 // A descriptor for elements kind transitions. |
163 enum class ElementsTransition : uint8_t { | 185 class ElementsTransition final { |
164 kFastTransition, // simple transition, just updating the map. | 186 public: |
165 kSlowTransition // full transition, round-trip to the runtime. | 187 enum Mode : uint8_t { |
| 188 kFastTransition, // simple transition, just updating the map. |
| 189 kSlowTransition // full transition, round-trip to the runtime. |
| 190 }; |
| 191 |
| 192 ElementsTransition(Mode mode, Handle<Map> source, Handle<Map> target) |
| 193 : mode_(mode), source_(source), target_(target) {} |
| 194 |
| 195 Mode mode() const { return mode_; } |
| 196 Handle<Map> source() const { return source_; } |
| 197 Handle<Map> target() const { return target_; } |
| 198 |
| 199 private: |
| 200 Mode const mode_; |
| 201 Handle<Map> const source_; |
| 202 Handle<Map> const target_; |
166 }; | 203 }; |
167 | 204 |
| 205 bool operator==(ElementsTransition const&, ElementsTransition const&); |
| 206 bool operator!=(ElementsTransition const&, ElementsTransition const&); |
| 207 |
168 size_t hash_value(ElementsTransition); | 208 size_t hash_value(ElementsTransition); |
169 | 209 |
170 std::ostream& operator<<(std::ostream&, ElementsTransition); | 210 std::ostream& operator<<(std::ostream&, ElementsTransition); |
171 | 211 |
172 ElementsTransition ElementsTransitionOf(const Operator* op) WARN_UNUSED_RESULT; | 212 ElementsTransition const& ElementsTransitionOf(const Operator* op) |
| 213 WARN_UNUSED_RESULT; |
173 | 214 |
174 // A hint for speculative number operations. | 215 // A hint for speculative number operations. |
175 enum class NumberOperationHint : uint8_t { | 216 enum class NumberOperationHint : uint8_t { |
176 kSignedSmall, // Inputs were always Smi so far, output was in Smi range. | 217 kSignedSmall, // Inputs were always Smi so far, output was in Smi range. |
177 kSigned32, // Inputs and output were Signed32 so far. | 218 kSigned32, // Inputs and output were Signed32 so far. |
178 kNumber, // Inputs were Number, output was Number. | 219 kNumber, // Inputs were Number, output was Number. |
179 kNumberOrOddball, // Inputs were Number or Oddball, output was Number. | 220 kNumberOrOddball, // Inputs were Number or Oddball, output was Number. |
180 }; | 221 }; |
181 | 222 |
182 size_t hash_value(NumberOperationHint); | 223 size_t hash_value(NumberOperationHint); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 const Operator* ChangeFloat64ToTagged(); | 356 const Operator* ChangeFloat64ToTagged(); |
316 const Operator* ChangeFloat64ToTaggedPointer(); | 357 const Operator* ChangeFloat64ToTaggedPointer(); |
317 const Operator* ChangeTaggedToBit(); | 358 const Operator* ChangeTaggedToBit(); |
318 const Operator* ChangeBitToTagged(); | 359 const Operator* ChangeBitToTagged(); |
319 const Operator* TruncateTaggedToWord32(); | 360 const Operator* TruncateTaggedToWord32(); |
320 const Operator* TruncateTaggedToFloat64(); | 361 const Operator* TruncateTaggedToFloat64(); |
321 const Operator* TruncateTaggedToBit(); | 362 const Operator* TruncateTaggedToBit(); |
322 | 363 |
323 const Operator* CheckIf(); | 364 const Operator* CheckIf(); |
324 const Operator* CheckBounds(); | 365 const Operator* CheckBounds(); |
325 const Operator* CheckMaps(int map_input_count); | 366 const Operator* CheckMaps(ZoneHandleSet<Map>); |
326 | 367 |
327 const Operator* CheckHeapObject(); | 368 const Operator* CheckHeapObject(); |
328 const Operator* CheckInternalizedString(); | 369 const Operator* CheckInternalizedString(); |
329 const Operator* CheckNumber(); | 370 const Operator* CheckNumber(); |
330 const Operator* CheckSmi(); | 371 const Operator* CheckSmi(); |
331 const Operator* CheckString(); | 372 const Operator* CheckString(); |
332 | 373 |
333 const Operator* CheckedInt32Add(); | 374 const Operator* CheckedInt32Add(); |
334 const Operator* CheckedInt32Sub(); | 375 const Operator* CheckedInt32Sub(); |
335 const Operator* CheckedInt32Div(); | 376 const Operator* CheckedInt32Div(); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 Zone* const zone_; | 448 Zone* const zone_; |
408 | 449 |
409 DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorBuilder); | 450 DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorBuilder); |
410 }; | 451 }; |
411 | 452 |
412 } // namespace compiler | 453 } // namespace compiler |
413 } // namespace internal | 454 } // namespace internal |
414 } // namespace v8 | 455 } // namespace v8 |
415 | 456 |
416 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_ | 457 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_ |
OLD | NEW |