| Index: src/compiler/simplified-operator.cc
|
| diff --git a/src/compiler/simplified-operator.cc b/src/compiler/simplified-operator.cc
|
| index 66b419242dbdb75e3240d0aee68cc0d1a589b392..3d5504be625b6cb07130b68512f6b4e28a6487cd 100644
|
| --- a/src/compiler/simplified-operator.cc
|
| +++ b/src/compiler/simplified-operator.cc
|
| @@ -261,21 +261,34 @@ ElementsTransition ElementsTransitionOf(const Operator* op) {
|
| return OpParameter<ElementsTransition>(op);
|
| }
|
|
|
| -BinaryOperationHints::Hint BinaryOperationHintOf(const Operator* op) {
|
| +size_t hash_value(NumberOperationHint hint) {
|
| + return static_cast<uint8_t>(hint);
|
| +}
|
| +
|
| +std::ostream& operator<<(std::ostream& os, NumberOperationHint hint) {
|
| + switch (hint) {
|
| + case NumberOperationHint::kNone:
|
| + return os << "None";
|
| + case NumberOperationHint::kSigned32:
|
| + return os << "Signed32";
|
| + case NumberOperationHint::kNumberOrOddball:
|
| + return os << "NumberOrOddball";
|
| + }
|
| + UNREACHABLE();
|
| + return os;
|
| +}
|
| +
|
| +NumberOperationHint NumberOperationHintOf(const Operator* op) {
|
| DCHECK(op->opcode() == IrOpcode::kSpeculativeNumberAdd ||
|
| op->opcode() == IrOpcode::kSpeculativeNumberSubtract ||
|
| op->opcode() == IrOpcode::kSpeculativeNumberMultiply ||
|
| op->opcode() == IrOpcode::kSpeculativeNumberDivide ||
|
| op->opcode() == IrOpcode::kSpeculativeNumberModulus ||
|
| - op->opcode() == IrOpcode::kSpeculativeNumberShiftLeft);
|
| - return OpParameter<BinaryOperationHints::Hint>(op);
|
| -}
|
| -
|
| -CompareOperationHints::Hint CompareOperationHintOf(const Operator* op) {
|
| - DCHECK(op->opcode() == IrOpcode::kSpeculativeNumberEqual ||
|
| + op->opcode() == IrOpcode::kSpeculativeNumberShiftLeft ||
|
| + op->opcode() == IrOpcode::kSpeculativeNumberEqual ||
|
| op->opcode() == IrOpcode::kSpeculativeNumberLessThan ||
|
| op->opcode() == IrOpcode::kSpeculativeNumberLessThanOrEqual);
|
| - return OpParameter<CompareOperationHints::Hint>(op);
|
| + return OpParameter<NumberOperationHint>(op);
|
| }
|
|
|
| #define PURE_OP_LIST(V) \
|
| @@ -362,7 +375,10 @@ CompareOperationHints::Hint CompareOperationHintOf(const Operator* op) {
|
| V(SpeculativeNumberDivide) \
|
| V(SpeculativeNumberMultiply) \
|
| V(SpeculativeNumberModulus) \
|
| - V(SpeculativeNumberShiftLeft)
|
| + V(SpeculativeNumberShiftLeft) \
|
| + V(SpeculativeNumberEqual) \
|
| + V(SpeculativeNumberLessThan) \
|
| + V(SpeculativeNumberLessThanOrEqual)
|
|
|
| #define CHECKED_OP_LIST(V) \
|
| V(CheckBounds, 2, 1) \
|
| @@ -455,6 +471,21 @@ struct SimplifiedOperatorGlobalCache final {
|
| AllocateOperator<NOT_TENURED> kAllocateNotTenuredOperator;
|
| AllocateOperator<TENURED> kAllocateTenuredOperator;
|
|
|
| +#define SPECULATIVE_BINOP(Name) \
|
| + template <NumberOperationHint kHint> \
|
| + struct Name##Operator final : public Operator1<NumberOperationHint> { \
|
| + Name##Operator() \
|
| + : Operator1<NumberOperationHint>( \
|
| + IrOpcode::k##Name, Operator::kFoldable | Operator::kNoThrow, \
|
| + #Name, 2, 1, 1, 1, 1, 0, kHint) {} \
|
| + }; \
|
| + Name##Operator<NumberOperationHint::kNone> k##Name##NoneOperator; \
|
| + Name##Operator<NumberOperationHint::kSigned32> k##Name##Signed32Operator; \
|
| + Name##Operator<NumberOperationHint::kNumberOrOddball> \
|
| + k##Name##NumberOrOddballOperator;
|
| + SPECULATIVE_BINOP_LIST(SPECULATIVE_BINOP)
|
| +#undef SPECULATIVE_BINOP
|
| +
|
| #define BUFFER_ACCESS(Type, type, TYPE, ctype, size) \
|
| struct LoadBuffer##Type##Operator final : public Operator1<BufferAccess> { \
|
| LoadBuffer##Type##Operator() \
|
| @@ -585,39 +616,21 @@ const Operator* SimplifiedOperatorBuilder::StoreBuffer(BufferAccess access) {
|
| return nullptr;
|
| }
|
|
|
| -#define SPECULATIVE_BINOP_DEF(Name) \
|
| - const Operator* SimplifiedOperatorBuilder::Name( \
|
| - BinaryOperationHints::Hint hint) { \
|
| - return new (zone()) Operator1<BinaryOperationHints::Hint>( \
|
| - IrOpcode::k##Name, Operator::kFoldable | Operator::kNoThrow, #Name, 2, \
|
| - 1, 1, 1, 1, 0, hint); \
|
| +#define SPECULATIVE_BINOP(Name) \
|
| + const Operator* SimplifiedOperatorBuilder::Name(NumberOperationHint hint) { \
|
| + switch (hint) { \
|
| + case NumberOperationHint::kNone: \
|
| + return &cache_.k##Name##NoneOperator; \
|
| + case NumberOperationHint::kSigned32: \
|
| + return &cache_.k##Name##Signed32Operator; \
|
| + case NumberOperationHint::kNumberOrOddball: \
|
| + return &cache_.k##Name##NumberOrOddballOperator; \
|
| + } \
|
| + UNREACHABLE(); \
|
| + return nullptr; \
|
| }
|
| -SPECULATIVE_BINOP_LIST(SPECULATIVE_BINOP_DEF)
|
| -#undef SPECULATIVE_BINOP_DEF
|
| -
|
| -const Operator* SimplifiedOperatorBuilder::SpeculativeNumberEqual(
|
| - CompareOperationHints::Hint hint) {
|
| - return new (zone()) Operator1<CompareOperationHints::Hint>(
|
| - IrOpcode::kSpeculativeNumberEqual,
|
| - Operator::kFoldable | Operator::kNoThrow, "SpeculativeNumberEqual", 2, 1,
|
| - 1, 1, 1, 0, hint);
|
| -}
|
| -
|
| -const Operator* SimplifiedOperatorBuilder::SpeculativeNumberLessThan(
|
| - CompareOperationHints::Hint hint) {
|
| - return new (zone()) Operator1<CompareOperationHints::Hint>(
|
| - IrOpcode::kSpeculativeNumberLessThan,
|
| - Operator::kFoldable | Operator::kNoThrow, "SpeculativeNumberLessThan", 2,
|
| - 1, 1, 1, 1, 0, hint);
|
| -}
|
| -
|
| -const Operator* SimplifiedOperatorBuilder::SpeculativeNumberLessThanOrEqual(
|
| - CompareOperationHints::Hint hint) {
|
| - return new (zone()) Operator1<CompareOperationHints::Hint>(
|
| - IrOpcode::kSpeculativeNumberLessThanOrEqual,
|
| - Operator::kFoldable | Operator::kNoThrow,
|
| - "SpeculativeNumberLessThanOrEqual", 2, 1, 1, 1, 1, 0, hint);
|
| -}
|
| +SPECULATIVE_BINOP_LIST(SPECULATIVE_BINOP)
|
| +#undef SPECULATIVE_BINOP
|
|
|
| #define ACCESS_OP_LIST(V) \
|
| V(LoadField, FieldAccess, Operator::kNoWrite, 1, 1, 1) \
|
|
|