5 #ifndef V8_COMPILER_SIMPLIFIED_OPERATOR_H_ 6 #define V8_COMPILER_SIMPLIFIED_OPERATOR_H_ 10 #include "src/base/compiler-specific.h" 11 #include "src/compiler/operator.h" 12 #include "src/compiler/types.h" 13 #include "src/deoptimize-reason.h" 14 #include "src/globals.h" 15 #include "src/handles.h" 16 #include "src/machine-type.h" 17 #include "src/maybe-handles.h" 18 #include "src/objects.h" 19 #include "src/type-hints.h" 20 #include "src/vector-slot-pair.h" 21 #include "src/zone/zone-handle-set.h" 27 enum class AbortReason : uint8_t;
34 struct SimplifiedOperatorGlobalCache;
36 enum BaseTaggedness : uint8_t { kUntaggedBase, kTaggedBase };
38 size_t hash_value(BaseTaggedness);
40 std::ostream& operator<<(std::ostream&, BaseTaggedness);
42 size_t hash_value(LoadSensitivity);
44 std::ostream& operator<<(std::ostream&, LoadSensitivity);
50 BaseTaggedness base_is_tagged;
56 WriteBarrierKind write_barrier_kind;
57 LoadSensitivity load_sensitivity;
60 : base_is_tagged(kTaggedBase),
63 machine_type(MachineType::None()),
64 write_barrier_kind(kFullWriteBarrier),
65 load_sensitivity(LoadSensitivity::kUnsafe) {}
69 WriteBarrierKind write_barrier_kind,
70 LoadSensitivity load_sensitivity = LoadSensitivity::kUnsafe)
71 : base_is_tagged(base_is_tagged),
76 machine_type(machine_type),
77 write_barrier_kind(write_barrier_kind),
78 load_sensitivity(load_sensitivity) {}
80 int tag()
const {
return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; }
87 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&,
FieldAccess const&);
90 V8_WARN_UNUSED_RESULT;
94 PrintVerbosity verbose)
const;
101 BaseTaggedness base_is_tagged;
105 WriteBarrierKind write_barrier_kind;
106 LoadSensitivity load_sensitivity;
109 : base_is_tagged(kTaggedBase),
112 machine_type(MachineType::None()),
113 write_barrier_kind(kFullWriteBarrier),
114 load_sensitivity(LoadSensitivity::kUnsafe) {}
117 MachineType machine_type, WriteBarrierKind write_barrier_kind,
118 LoadSensitivity load_sensitivity = LoadSensitivity::kUnsafe)
119 : base_is_tagged(base_is_tagged),
120 header_size(header_size),
122 machine_type(machine_type),
123 write_barrier_kind(write_barrier_kind),
124 load_sensitivity(load_sensitivity) {}
126 int tag()
const {
return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; }
133 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&,
ElementAccess const&);
136 V8_WARN_UNUSED_RESULT;
138 ExternalArrayType ExternalArrayTypeOf(
const Operator* op) V8_WARN_UNUSED_RESULT;
141 ConvertReceiverMode ConvertReceiverModeOf(
Operator const* op)
142 V8_WARN_UNUSED_RESULT;
150 : feedback_(feedback) {}
170 : reason_(reason), feedback_(feedback) {}
173 DeoptimizeReason reason()
const {
return reason_; }
176 DeoptimizeReason reason_;
187 V8_WARN_UNUSED_RESULT;
189 enum class CheckFloat64HoleMode : uint8_t {
194 size_t hash_value(CheckFloat64HoleMode);
196 std::ostream& operator<<(std::ostream&, CheckFloat64HoleMode);
202 : mode_(mode), feedback_(feedback) {}
204 CheckFloat64HoleMode mode()
const {
return mode_; }
208 CheckFloat64HoleMode mode_;
213 V8_WARN_UNUSED_RESULT;
224 enum class CheckTaggedInputMode : uint8_t {
229 size_t hash_value(CheckTaggedInputMode);
231 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, CheckTaggedInputMode);
237 : mode_(mode), feedback_(feedback) {}
239 CheckTaggedInputMode mode()
const {
return mode_; }
243 CheckTaggedInputMode mode_;
248 V8_WARN_UNUSED_RESULT;
250 std::ostream& operator<<(std::ostream&,
258 enum class CheckForMinusZeroMode : uint8_t {
260 kDontCheckForMinusZero,
263 size_t hash_value(CheckForMinusZeroMode);
265 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&,
266 CheckForMinusZeroMode);
268 CheckForMinusZeroMode CheckMinusZeroModeOf(
const Operator*)
269 V8_WARN_UNUSED_RESULT;
275 : mode_(mode), feedback_(feedback) {}
277 CheckForMinusZeroMode mode()
const {
return mode_; }
281 CheckForMinusZeroMode mode_;
286 V8_WARN_UNUSED_RESULT;
296 enum class CheckMapsFlag : uint8_t {
298 kTryMigrateInstance = 1u << 0,
302 DEFINE_OPERATORS_FOR_FLAGS(CheckMapsFlags)
304 std::ostream& operator<<(std::ostream&, CheckMapsFlags);
332 : flags_(flags), maps_info_(maps), feedback_(feedback) {}
352 V8_WARN_UNUSED_RESULT;
358 V8_WARN_UNUSED_RESULT;
361 enum class GrowFastElementsMode : uint8_t {
366 inline size_t hash_value(GrowFastElementsMode mode) {
367 return static_cast<uint8_t
>(mode);
370 std::ostream& operator<<(std::ostream&, GrowFastElementsMode);
376 : mode_(mode), feedback_(feedback) {}
378 GrowFastElementsMode mode()
const {
return mode_; }
382 GrowFastElementsMode mode_;
394 V8_WARN_UNUSED_RESULT;
399 enum Mode : uint8_t {
405 : mode_(mode), source_(source), target_(target) {}
407 Mode mode()
const {
return mode_; }
424 V8_WARN_UNUSED_RESULT;
433 Type ValueTypeParameterOf(
const Operator* op) V8_WARN_UNUSED_RESULT;
436 enum class NumberOperationHint : uint8_t {
444 size_t hash_value(NumberOperationHint);
446 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, NumberOperationHint);
448 V8_EXPORT_PRIVATE NumberOperationHint NumberOperationHintOf(
const Operator* op)
449 V8_WARN_UNUSED_RESULT;
455 : hint_(hint), feedback_(feedback) {}
457 NumberOperationHint hint()
const {
return hint_; }
461 NumberOperationHint hint_;
466 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&,
471 V8_WARN_UNUSED_RESULT;
473 int FormalParameterCountOf(
const Operator* op) V8_WARN_UNUSED_RESULT;
474 bool IsRestLengthOf(
const Operator* op) V8_WARN_UNUSED_RESULT;
479 : type_(
type), pretenure_(pretenure) {}
482 PretenureFlag pretenure()
const {
return pretenure_; }
486 PretenureFlag pretenure_;
489 bool IsCheckedWithFeedback(
const Operator* op);
497 PretenureFlag PretenureFlagOf(
const Operator* op) V8_WARN_UNUSED_RESULT;
499 Type AllocateTypeOf(
const Operator* op) V8_WARN_UNUSED_RESULT;
501 UnicodeEncoding UnicodeEncodingOf(
const Operator*) V8_WARN_UNUSED_RESULT;
503 AbortReason AbortReasonOf(
const Operator* op) V8_WARN_UNUSED_RESULT;
505 DeoptimizeReason DeoptimizeReasonOf(
const Operator* op) V8_WARN_UNUSED_RESULT;
507 int NewArgumentsElementsMappedCountOf(
const Operator* op) V8_WARN_UNUSED_RESULT;
532 :
public NON_EXPORTED_BASE(ZoneObject) {
540 const Operator* NumberLessThanOrEqual();
551 const Operator* NumberShiftRightLogical();
589 const Operator* NumberToUint8Clamped();
593 const Operator* SpeculativeSafeIntegerAdd(NumberOperationHint hint);
594 const Operator* SpeculativeSafeIntegerSubtract(NumberOperationHint hint);
596 const Operator* SpeculativeNumberAdd(NumberOperationHint hint);
597 const Operator* SpeculativeNumberSubtract(NumberOperationHint hint);
598 const Operator* SpeculativeNumberMultiply(NumberOperationHint hint);
599 const Operator* SpeculativeNumberDivide(NumberOperationHint hint);
600 const Operator* SpeculativeNumberModulus(NumberOperationHint hint);
601 const Operator* SpeculativeNumberShiftLeft(NumberOperationHint hint);
602 const Operator* SpeculativeNumberShiftRight(NumberOperationHint hint);
603 const Operator* SpeculativeNumberShiftRightLogical(NumberOperationHint hint);
604 const Operator* SpeculativeNumberBitwiseAnd(NumberOperationHint hint);
605 const Operator* SpeculativeNumberBitwiseOr(NumberOperationHint hint);
606 const Operator* SpeculativeNumberBitwiseXor(NumberOperationHint hint);
608 const Operator* SpeculativeNumberLessThan(NumberOperationHint hint);
609 const Operator* SpeculativeNumberLessThanOrEqual(NumberOperationHint hint);
610 const Operator* SpeculativeNumberEqual(NumberOperationHint hint);
622 const Operator* StringLessThanOrEqual();
624 const Operator* StringCodePointAt(UnicodeEncoding encoding);
625 const Operator* StringFromSingleCharCode();
626 const Operator* StringFromSingleCodePoint(UnicodeEncoding encoding);
629 const Operator* StringToLowerCaseIntl();
630 const Operator* StringToUpperCaseIntl();
633 const Operator* FindOrderedHashMapEntry();
634 const Operator* FindOrderedHashMapEntryForInt32Key();
636 const Operator* SpeculativeToNumber(NumberOperationHint hint,
640 const Operator* PlainPrimitiveToNumber();
641 const Operator* PlainPrimitiveToWord32();
642 const Operator* PlainPrimitiveToFloat64();
644 const Operator* ChangeTaggedSignedToInt32();
645 const Operator* ChangeTaggedSignedToInt64();
646 const Operator* ChangeTaggedToInt32();
647 const Operator* ChangeTaggedToInt64();
648 const Operator* ChangeTaggedToUint32();
649 const Operator* ChangeTaggedToFloat64();
650 const Operator* ChangeTaggedToTaggedSigned();
651 const Operator* ChangeInt31ToTaggedSigned();
652 const Operator* ChangeInt32ToTagged();
653 const Operator* ChangeInt64ToTagged();
654 const Operator* ChangeUint32ToTagged();
655 const Operator* ChangeUint64ToTagged();
656 const Operator* ChangeFloat64ToTagged(CheckForMinusZeroMode);
657 const Operator* ChangeFloat64ToTaggedPointer();
658 const Operator* ChangeTaggedToBit();
659 const Operator* ChangeBitToTagged();
660 const Operator* TruncateTaggedToWord32();
661 const Operator* TruncateTaggedToFloat64();
662 const Operator* TruncateTaggedToBit();
663 const Operator* TruncateTaggedPointerToBit();
670 const Operator* CheckEqualsInternalizedString();
671 const Operator* CheckEqualsSymbol();
674 const Operator* CheckIf(DeoptimizeReason deoptimize_reason,
676 const Operator* CheckInternalizedString();
679 const Operator* CheckNotTaggedHole();
682 const Operator* CheckReceiverOrNullOrUndefined();
687 const Operator* CheckedFloat64ToInt32(CheckForMinusZeroMode,
689 const Operator* CheckedFloat64ToInt64(CheckForMinusZeroMode,
694 const Operator* CheckedInt32Mul(CheckForMinusZeroMode);
700 const Operator* CheckedTaggedToFloat64(CheckTaggedInputMode,
702 const Operator* CheckedTaggedToInt32(CheckForMinusZeroMode,
704 const Operator* CheckedTaggedToInt64(CheckForMinusZeroMode,
708 const Operator* CheckedTruncateTaggedToWord32(CheckTaggedInputMode,
719 const Operator* ConvertReceiver(ConvertReceiverMode);
721 const Operator* ConvertTaggedHoleToUndefined();
723 const Operator* ObjectIsArrayBufferView();
726 const Operator* ObjectIsConstructor();
727 const Operator* ObjectIsDetectableCallable();
728 const Operator* ObjectIsMinusZero();
729 const Operator* NumberIsMinusZero();
732 const Operator* ObjectIsNonCallable();
738 const Operator* ObjectIsUndetectable();
740 const Operator* NumberIsFloat64Hole();
742 const Operator* ObjectIsFiniteNumber();
744 const Operator* ObjectIsSafeInteger();
745 const Operator* NumberIsSafeInteger();
749 const Operator* ArgumentsLength(
int formal_parameter_count,
750 bool is_rest_length);
752 const Operator* NewDoubleElements(PretenureFlag);
753 const Operator* NewSmiOrObjectElements(PretenureFlag);
756 const Operator* NewArgumentsElements(
int mapped_count);
762 const Operator* EnsureWritableFastElements();
765 const Operator* MaybeGrowFastElements(GrowFastElementsMode mode,
772 const Operator* AllocateRaw(
Type type, PretenureFlag pretenure = NOT_TENURED);
788 const Operator* StoreSignedSmallElement();
798 const Operator* LoadTypedElement(ExternalArrayType
const&);
801 const Operator* LoadDataViewElement(ExternalArrayType
const&);
804 const Operator* StoreTypedElement(ExternalArrayType
const&);
807 const Operator* StoreDataViewElement(ExternalArrayType
const&);
810 const Operator* RuntimeAbort(AbortReason reason);
815 Zone* zone()
const {
return zone_; }
827 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_