Index: src/compiler/simplified-operator.cc |
diff --git a/src/compiler/simplified-operator.cc b/src/compiler/simplified-operator.cc |
index f360c4ac0fe419382b7f34e288c1973e8ccc906f..5d32ffc7c94d2ab83f76f011b459242806410878 100644 |
--- a/src/compiler/simplified-operator.cc |
+++ b/src/compiler/simplified-operator.cc |
@@ -371,7 +371,8 @@ size_t hash_value(NumberOperationHint hint) { |
} |
NumberOperationHint NumberOperationHintOf(const Operator* op) { |
- DCHECK(op->opcode() == IrOpcode::kSpeculativeNumberAdd || |
+ DCHECK(op->opcode() == IrOpcode::kSpeculativeToNumber || |
+ op->opcode() == IrOpcode::kSpeculativeNumberAdd || |
op->opcode() == IrOpcode::kSpeculativeNumberSubtract || |
op->opcode() == IrOpcode::kSpeculativeNumberMultiply || |
op->opcode() == IrOpcode::kSpeculativeNumberDivide || |
@@ -684,6 +685,26 @@ struct SimplifiedOperatorGlobalCache final { |
SPECULATIVE_NUMBER_BINOP_LIST(SPECULATIVE_NUMBER_BINOP) |
#undef SPECULATIVE_NUMBER_BINOP |
+ template <NumberOperationHint kHint> |
+ struct SpeculativeToNumberOperator final |
+ : public Operator1<NumberOperationHint> { |
+ SpeculativeToNumberOperator() |
+ : Operator1<NumberOperationHint>( |
+ IrOpcode::kSpeculativeToNumber, // opcode |
+ Operator::kFoldable | Operator::kNoThrow, // flags |
+ "SpeculativeToNumber", // name |
+ 1, 1, 1, 1, 1, 0, // counts |
+ kHint) {} // parameter |
+ }; |
+ SpeculativeToNumberOperator<NumberOperationHint::kSignedSmall> |
+ kSpeculativeToNumberSignedSmallOperator; |
+ SpeculativeToNumberOperator<NumberOperationHint::kSigned32> |
+ kSpeculativeToNumberSigned32Operator; |
+ SpeculativeToNumberOperator<NumberOperationHint::kNumber> |
+ kSpeculativeToNumberNumberOperator; |
+ SpeculativeToNumberOperator<NumberOperationHint::kNumberOrOddball> |
+ kSpeculativeToNumberNumberOrOddballOperator; |
+ |
#define BUFFER_ACCESS(Type, type, TYPE, ctype, size) \ |
struct LoadBuffer##Type##Operator final : public Operator1<BufferAccess> { \ |
LoadBuffer##Type##Operator() \ |
@@ -795,6 +816,22 @@ const Operator* SimplifiedOperatorBuilder::CheckFloat64Hole( |
return nullptr; |
} |
+const Operator* SimplifiedOperatorBuilder::SpeculativeToNumber( |
+ NumberOperationHint hint) { |
+ switch (hint) { |
+ case NumberOperationHint::kSignedSmall: |
+ return &cache_.kSpeculativeToNumberSignedSmallOperator; |
+ case NumberOperationHint::kSigned32: |
+ return &cache_.kSpeculativeToNumberSigned32Operator; |
+ case NumberOperationHint::kNumber: |
+ return &cache_.kSpeculativeToNumberNumberOperator; |
+ case NumberOperationHint::kNumberOrOddball: |
+ return &cache_.kSpeculativeToNumberNumberOrOddballOperator; |
+ } |
+ UNREACHABLE(); |
+ return nullptr; |
+} |
+ |
const Operator* SimplifiedOperatorBuilder::EnsureWritableFastElements() { |
return &cache_.kEnsureWritableFastElements; |
} |