Index: src/compiler/simplified-operator.cc |
diff --git a/src/compiler/simplified-operator.cc b/src/compiler/simplified-operator.cc |
index cd7fa198ffb19348535a4620c0fa924cbb9b3566..9c11aa7eb59a1e39d296e8d6a8245768a1bbddb2 100644 |
--- a/src/compiler/simplified-operator.cc |
+++ b/src/compiler/simplified-operator.cc |
@@ -284,7 +284,8 @@ std::ostream& operator<<(std::ostream& os, CheckTaggedInputMode mode) { |
} |
CheckTaggedInputMode CheckTaggedInputModeOf(const Operator* op) { |
- DCHECK_EQ(IrOpcode::kCheckedTaggedToFloat64, op->opcode()); |
+ DCHECK(op->opcode() == IrOpcode::kCheckedTaggedToFloat64 || |
+ op->opcode() == IrOpcode::kCheckedTruncateTaggedToWord32); |
return OpParameter<CheckTaggedInputMode>(op); |
} |
@@ -514,32 +515,31 @@ UnicodeEncoding UnicodeEncodingOf(const Operator* op) { |
V(SpeculativeNumberLessThan) \ |
V(SpeculativeNumberLessThanOrEqual) |
-#define CHECKED_OP_LIST(V) \ |
- V(CheckBounds, 2, 1) \ |
- V(CheckHeapObject, 1, 1) \ |
- V(CheckIf, 1, 0) \ |
- V(CheckInternalizedString, 1, 1) \ |
- V(CheckNumber, 1, 1) \ |
- V(CheckReceiver, 1, 1) \ |
- V(CheckSmi, 1, 1) \ |
- V(CheckString, 1, 1) \ |
- V(CheckSeqString, 1, 1) \ |
- V(CheckSymbol, 1, 1) \ |
- V(CheckTaggedHole, 1, 0) \ |
- V(CheckNotTaggedHole, 1, 0) \ |
- V(CheckedInt32Add, 2, 1) \ |
- V(CheckedInt32Sub, 2, 1) \ |
- V(CheckedInt32Div, 2, 1) \ |
- V(CheckedInt32Mod, 2, 1) \ |
- V(CheckedUint32Div, 2, 1) \ |
- V(CheckedUint32Mod, 2, 1) \ |
- V(CheckedUint32ToInt32, 1, 1) \ |
- V(CheckedUint32ToTaggedSigned, 1, 1) \ |
- V(CheckedInt32ToTaggedSigned, 1, 1) \ |
- V(CheckedTaggedSignedToInt32, 1, 1) \ |
- V(CheckedTaggedToTaggedSigned, 1, 1) \ |
- V(CheckedTaggedToTaggedPointer, 1, 1) \ |
- V(CheckedTruncateTaggedToWord32, 1, 1) |
+#define CHECKED_OP_LIST(V) \ |
+ V(CheckBounds, 2, 1) \ |
+ V(CheckHeapObject, 1, 1) \ |
+ V(CheckIf, 1, 0) \ |
+ V(CheckInternalizedString, 1, 1) \ |
+ V(CheckNumber, 1, 1) \ |
+ V(CheckReceiver, 1, 1) \ |
+ V(CheckSmi, 1, 1) \ |
+ V(CheckString, 1, 1) \ |
+ V(CheckSeqString, 1, 1) \ |
+ V(CheckSymbol, 1, 1) \ |
+ V(CheckTaggedHole, 1, 0) \ |
+ V(CheckNotTaggedHole, 1, 0) \ |
+ V(CheckedInt32Add, 2, 1) \ |
+ V(CheckedInt32Sub, 2, 1) \ |
+ V(CheckedInt32Div, 2, 1) \ |
+ V(CheckedInt32Mod, 2, 1) \ |
+ V(CheckedUint32Div, 2, 1) \ |
+ V(CheckedUint32Mod, 2, 1) \ |
+ V(CheckedUint32ToInt32, 1, 1) \ |
+ V(CheckedUint32ToTaggedSigned, 1, 1) \ |
+ V(CheckedInt32ToTaggedSigned, 1, 1) \ |
+ V(CheckedTaggedSignedToInt32, 1, 1) \ |
+ V(CheckedTaggedToTaggedSigned, 1, 1) \ |
+ V(CheckedTaggedToTaggedPointer, 1, 1) |
struct SimplifiedOperatorGlobalCache final { |
#define PURE(Name, properties, value_input_count, control_input_count) \ |
@@ -666,6 +666,20 @@ struct SimplifiedOperatorGlobalCache final { |
CheckedTaggedToFloat64Operator<CheckTaggedInputMode::kNumberOrOddball> |
kCheckedTaggedToFloat64NumberOrOddballOperator; |
+ template <CheckTaggedInputMode kMode> |
+ struct CheckedTruncateTaggedToWord32Operator final |
+ : public Operator1<CheckTaggedInputMode> { |
+ CheckedTruncateTaggedToWord32Operator() |
+ : Operator1<CheckTaggedInputMode>( |
+ IrOpcode::kCheckedTruncateTaggedToWord32, |
+ Operator::kFoldable | Operator::kNoThrow, |
+ "CheckedTruncateTaggedToWord32", 1, 1, 1, 1, 1, 0, kMode) {} |
+ }; |
+ CheckedTruncateTaggedToWord32Operator<CheckTaggedInputMode::kNumber> |
+ kCheckedTruncateTaggedToWord32NumberOperator; |
+ CheckedTruncateTaggedToWord32Operator<CheckTaggedInputMode::kNumberOrOddball> |
+ kCheckedTruncateTaggedToWord32NumberOrOddballOperator; |
+ |
template <CheckFloat64HoleMode kMode> |
struct CheckFloat64HoleNaNOperator final |
: public Operator1<CheckFloat64HoleMode> { |
@@ -822,6 +836,17 @@ const Operator* SimplifiedOperatorBuilder::CheckedTaggedToFloat64( |
UNREACHABLE(); |
} |
+const Operator* SimplifiedOperatorBuilder::CheckedTruncateTaggedToWord32( |
+ CheckTaggedInputMode mode) { |
+ switch (mode) { |
+ case CheckTaggedInputMode::kNumber: |
+ return &cache_.kCheckedTruncateTaggedToWord32NumberOperator; |
+ case CheckTaggedInputMode::kNumberOrOddball: |
+ return &cache_.kCheckedTruncateTaggedToWord32NumberOrOddballOperator; |
+ } |
+ UNREACHABLE(); |
+} |
+ |
const Operator* SimplifiedOperatorBuilder::CheckMaps(CheckMapsFlags flags, |
ZoneHandleSet<Map> maps) { |
CheckMapsParameters const parameters(flags, maps); |