Commit 9ef1e35b authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Drop obsolete unused JSStrictNotEqual operator.

We don't need the JSStrictNotEqual operator in the compiler, because
this is never generated by the BytecodeGraphBuilder, and the code in
the AstGraphBuilder was dead code. Also remove the backing builtin
StrictNotEqual.

R=mstarzinger@chromium.org
BUG=v8:5267

Review-Url: https://codereview.chromium.org/2727003006
Cr-Commit-Position: refs/heads/master@{#43594}
parent 8ec7144e
......@@ -1603,15 +1603,7 @@ TF_BUILTIN(StrictEqual, CodeStubAssembler) {
Node* rhs = Parameter(1);
Node* context = Parameter(2);
Return(StrictEqual(kDontNegateResult, lhs, rhs, context));
}
TF_BUILTIN(StrictNotEqual, CodeStubAssembler) {
Node* lhs = Parameter(0);
Node* rhs = Parameter(1);
Node* context = Parameter(2);
Return(StrictEqual(kNegateResult, lhs, rhs, context));
Return(StrictEqual(lhs, rhs, context));
}
} // namespace internal
......
......@@ -604,7 +604,6 @@ class Isolate;
TFS(Equal, BUILTIN, kNoExtraICState, Compare, 1) \
TFS(NotEqual, BUILTIN, kNoExtraICState, Compare, 1) \
TFS(StrictEqual, BUILTIN, kNoExtraICState, Compare, 1) \
TFS(StrictNotEqual, BUILTIN, kNoExtraICState, Compare, 1) \
\
/* Object */ \
CPP(ObjectAssign) \
......
......@@ -239,7 +239,6 @@ TFS_BUILTIN(GreaterThanOrEqual)
TFS_BUILTIN(Equal)
TFS_BUILTIN(NotEqual)
TFS_BUILTIN(StrictEqual)
TFS_BUILTIN(StrictNotEqual)
TFS_BUILTIN(CreateIterResultObject)
TFS_BUILTIN(HasProperty)
TFS_BUILTIN(NonNumberToNumber)
......
......@@ -119,7 +119,6 @@ class V8_EXPORT_PRIVATE CodeFactory final {
static Callable Equal(Isolate* isolate);
static Callable NotEqual(Isolate* isolate);
static Callable StrictEqual(Isolate* isolate);
static Callable StrictNotEqual(Isolate* isolate);
static Callable StringAdd(Isolate* isolate, StringAddFlags flags,
PretenureFlag pretenure_flag);
......
......@@ -7323,8 +7323,7 @@ Node* CodeStubAssembler::Equal(ResultMode mode, Node* lhs, Node* rhs,
return result.value();
}
Node* CodeStubAssembler::StrictEqual(ResultMode mode, Node* lhs, Node* rhs,
Node* context) {
Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs, Node* context) {
// Here's pseudo-code for the algorithm below in case of kDontNegateResult
// mode; for kNegateResult mode we properly negate the result.
//
......@@ -7473,9 +7472,7 @@ Node* CodeStubAssembler::StrictEqual(ResultMode mode, Node* lhs, Node* rhs,
Bind(&if_rhsisstring);
{
Callable callable = (mode == kDontNegateResult)
? CodeFactory::StringEqual(isolate())
: CodeFactory::StringNotEqual(isolate());
Callable callable = CodeFactory::StringEqual(isolate());
result.Bind(CallStub(callable, context, lhs, rhs));
Goto(&end);
}
......@@ -7530,13 +7527,13 @@ Node* CodeStubAssembler::StrictEqual(ResultMode mode, Node* lhs, Node* rhs,
Bind(&if_equal);
{
result.Bind(BooleanConstant(mode == kDontNegateResult));
result.Bind(TrueConstant());
Goto(&end);
}
Bind(&if_notequal);
{
result.Bind(BooleanConstant(mode == kNegateResult));
result.Bind(FalseConstant());
Goto(&end);
}
......@@ -7621,7 +7618,7 @@ Node* CodeStubAssembler::SameValue(Node* lhs, Node* rhs, Node* context) {
Bind(&strict_equal);
{
Node* const is_equal = StrictEqual(kDontNegateResult, lhs, rhs, context);
Node* const is_equal = StrictEqual(lhs, rhs, context);
Node* const result = WordEqual(is_equal, TrueConstant());
var_result.Bind(result);
Goto(&out);
......
......@@ -1213,7 +1213,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
Node* Equal(ResultMode mode, Node* lhs, Node* rhs, Node* context);
Node* StrictEqual(ResultMode mode, Node* lhs, Node* rhs, Node* context);
Node* StrictEqual(Node* lhs, Node* rhs, Node* context);
// ECMA#sec-samevalue
// Similar to StrictEqual except that NaNs are treated as equal and minus zero
......
......@@ -1996,9 +1996,6 @@ void AstGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
case Token::EQ_STRICT:
op = javascript()->StrictEqual(hint);
break;
case Token::NE_STRICT:
op = javascript()->StrictNotEqual(hint);
break;
case Token::LT:
op = javascript()->LessThan(hint);
break;
......@@ -2816,7 +2813,6 @@ Node* AstGraphBuilder::TryFastToBoolean(Node* input) {
case IrOpcode::kJSEqual:
case IrOpcode::kJSNotEqual:
case IrOpcode::kJSStrictEqual:
case IrOpcode::kJSStrictNotEqual:
case IrOpcode::kJSLessThan:
case IrOpcode::kJSLessThanOrEqual:
case IrOpcode::kJSGreaterThan:
......
......@@ -127,15 +127,6 @@ void JSGenericLowering::LowerJSStrictEqual(Node* node) {
Operator::kEliminatable);
}
void JSGenericLowering::LowerJSStrictNotEqual(Node* node) {
// The !== operator doesn't need the current context.
NodeProperties::ReplaceContextInput(node, jsgraph()->NoContextConstant());
Callable callable = CodeFactory::StrictNotEqual(isolate());
node->RemoveInput(4); // control
ReplaceWithStubCall(node, callable, CallDescriptor::kNoFlags,
Operator::kEliminatable);
}
void JSGenericLowering::LowerJSToBoolean(Node* node) {
// The ToBoolean conversion doesn't need the current context.
NodeProperties::ReplaceContextInput(node, jsgraph()->NoContextConstant());
......
......@@ -528,7 +528,6 @@ CompareOperationHint CompareOperationHintOf(const Operator* op) {
DCHECK(op->opcode() == IrOpcode::kJSEqual ||
op->opcode() == IrOpcode::kJSNotEqual ||
op->opcode() == IrOpcode::kJSStrictEqual ||
op->opcode() == IrOpcode::kJSStrictNotEqual ||
op->opcode() == IrOpcode::kJSLessThan ||
op->opcode() == IrOpcode::kJSGreaterThan ||
op->opcode() == IrOpcode::kJSLessThanOrEqual ||
......@@ -576,7 +575,6 @@ CompareOperationHint CompareOperationHintOf(const Operator* op) {
V(Equal, Operator::kNoProperties) \
V(NotEqual, Operator::kNoProperties) \
V(StrictEqual, Operator::kPure) \
V(StrictNotEqual, Operator::kPure) \
V(LessThan, Operator::kNoProperties) \
V(GreaterThan, Operator::kNoProperties) \
V(LessThanOrEqual, Operator::kNoProperties) \
......
......@@ -565,7 +565,6 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final
const Operator* Equal(CompareOperationHint hint);
const Operator* NotEqual(CompareOperationHint hint);
const Operator* StrictEqual(CompareOperationHint hint);
const Operator* StrictNotEqual(CompareOperationHint hint);
const Operator* LessThan(CompareOperationHint hint);
const Operator* GreaterThan(CompareOperationHint hint);
const Operator* LessThanOrEqual(CompareOperationHint hint);
......
......@@ -191,7 +191,6 @@ Reduction JSTypeHintLowering::ReduceBinaryOperation(const Operator* op,
case IrOpcode::kJSEqual:
case IrOpcode::kJSStrictEqual:
case IrOpcode::kJSNotEqual:
case IrOpcode::kJSStrictNotEqual:
break;
case IrOpcode::kJSLessThan:
case IrOpcode::kJSGreaterThan:
......
......@@ -989,14 +989,13 @@ Reduction JSTypedLowering::ReduceJSEqual(Node* node, bool invert) {
return NoChange();
}
Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) {
Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node) {
JSBinopReduction r(this, node);
if (r.left() == r.right()) {
// x === x is always true if x != NaN
Node* replacement = graph()->NewNode(simplified()->ObjectIsNaN(), r.left());
if (!invert) {
replacement = graph()->NewNode(simplified()->BooleanNot(), replacement);
}
Node* replacement = graph()->NewNode(
simplified()->BooleanNot(),
graph()->NewNode(simplified()->ObjectIsNaN(), r.left()));
ReplaceWithValue(node, replacement);
return Replace(replacement);
}
......@@ -1005,47 +1004,47 @@ Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) {
// Number) an empty type intersection means the values cannot be strictly
// equal.
if (!r.left_type()->Maybe(r.right_type())) {
Node* replacement = jsgraph()->BooleanConstant(invert);
Node* replacement = jsgraph()->FalseConstant();
ReplaceWithValue(node, replacement);
return Replace(replacement);
}
}
Reduction const reduction = ReduceJSEqualTypeOf(node, invert);
Reduction const reduction = ReduceJSEqualTypeOf(node, false);
if (reduction.Changed()) return reduction;
if (r.BothInputsAre(Type::Unique())) {
return r.ChangeToPureOperator(simplified()->ReferenceEqual(), invert);
return r.ChangeToPureOperator(simplified()->ReferenceEqual());
}
if (r.OneInputIs(pointer_comparable_type_)) {
return r.ChangeToPureOperator(simplified()->ReferenceEqual(), invert);
return r.ChangeToPureOperator(simplified()->ReferenceEqual());
}
if (r.IsInternalizedStringCompareOperation()) {
r.CheckInputsToInternalizedString();
return r.ChangeToPureOperator(simplified()->ReferenceEqual(), invert);
return r.ChangeToPureOperator(simplified()->ReferenceEqual());
}
if (r.BothInputsAre(Type::String())) {
return r.ChangeToPureOperator(simplified()->StringEqual(), invert);
return r.ChangeToPureOperator(simplified()->StringEqual());
}
NumberOperationHint hint;
if (r.BothInputsAre(Type::Signed32()) ||
r.BothInputsAre(Type::Unsigned32())) {
return r.ChangeToPureOperator(simplified()->NumberEqual(), invert);
return r.ChangeToPureOperator(simplified()->NumberEqual());
} else if (r.GetCompareNumberOperationHint(&hint)) {
return r.ChangeToSpeculativeOperator(
simplified()->SpeculativeNumberEqual(hint), invert, Type::Boolean());
simplified()->SpeculativeNumberEqual(hint), false, Type::Boolean());
} else if (r.BothInputsAre(Type::Number())) {
return r.ChangeToPureOperator(simplified()->NumberEqual(), invert);
return r.ChangeToPureOperator(simplified()->NumberEqual());
} else if (r.IsReceiverCompareOperation()) {
// For strict equality, it's enough to know that one input is a Receiver,
// as a strict equality comparison with a Receiver can only yield true if
// both sides refer to the same Receiver than.
r.CheckLeftInputToReceiver();
return r.ChangeToPureOperator(simplified()->ReferenceEqual(), invert);
return r.ChangeToPureOperator(simplified()->ReferenceEqual());
} else if (r.IsStringCompareOperation()) {
r.CheckInputsToString();
return r.ChangeToPureOperator(simplified()->StringEqual(), invert);
return r.ChangeToPureOperator(simplified()->StringEqual());
}
return NoChange();
}
......@@ -2373,9 +2372,7 @@ Reduction JSTypedLowering::Reduce(Node* node) {
case IrOpcode::kJSNotEqual:
return ReduceJSEqual(node, true);
case IrOpcode::kJSStrictEqual:
return ReduceJSStrictEqual(node, false);
case IrOpcode::kJSStrictNotEqual:
return ReduceJSStrictEqual(node, true);
return ReduceJSStrictEqual(node);
case IrOpcode::kJSLessThan: // fall through
case IrOpcode::kJSGreaterThan: // fall through
case IrOpcode::kJSLessThanOrEqual: // fall through
......
......@@ -59,7 +59,7 @@ class V8_EXPORT_PRIVATE JSTypedLowering final
Reduction ReduceJSStoreModule(Node* node);
Reduction ReduceJSEqualTypeOf(Node* node, bool invert);
Reduction ReduceJSEqual(Node* node, bool invert);
Reduction ReduceJSStrictEqual(Node* node, bool invert);
Reduction ReduceJSStrictEqual(Node* node);
Reduction ReduceJSToBoolean(Node* node);
Reduction ReduceJSToInteger(Node* node);
Reduction ReduceJSToLength(Node* node);
......
......@@ -84,7 +84,6 @@
V(JSEqual) \
V(JSNotEqual) \
V(JSStrictEqual) \
V(JSStrictNotEqual) \
V(JSLessThan) \
V(JSGreaterThan) \
V(JSLessThanOrEqual) \
......
......@@ -32,7 +32,6 @@ bool OperatorProperties::HasFrameStateInput(const Operator* op) {
// Strict equality cannot lazily deoptimize.
case IrOpcode::kJSStrictEqual:
case IrOpcode::kJSStrictNotEqual:
return false;
// Binary operations
......
......@@ -935,11 +935,6 @@ Type* Typer::Visitor::JSStrictEqualTyper(Type* lhs, Type* rhs, Typer* t) {
}
Type* Typer::Visitor::JSStrictNotEqualTyper(Type* lhs, Type* rhs, Typer* t) {
return Invert(JSStrictEqualTyper(lhs, rhs, t), t);
}
// The EcmaScript specification defines the four relational comparison operators
// (<, <=, >=, >) with the help of a single abstract one. It behaves like <
// but returns undefined when the inputs cannot be compared.
......
......@@ -515,7 +515,6 @@ void Verifier::Visitor::Check(Node* node) {
case IrOpcode::kJSEqual:
case IrOpcode::kJSNotEqual:
case IrOpcode::kJSStrictEqual:
case IrOpcode::kJSStrictNotEqual:
case IrOpcode::kJSLessThan:
case IrOpcode::kJSGreaterThan:
case IrOpcode::kJSLessThanOrEqual:
......
......@@ -1305,8 +1305,7 @@ void Interpreter::DoCompareOpWithFeedback(Token::Value compare_op,
assembler->Equal(CodeStubAssembler::kNegateResult, lhs, rhs, context);
break;
case Token::EQ_STRICT:
result = assembler->StrictEqual(CodeStubAssembler::kDontNegateResult, lhs,
rhs, context);
result = assembler->StrictEqual(lhs, rhs, context);
break;
case Token::LT:
result = assembler->RelationalComparison(CodeStubAssembler::kLessThan,
......
......@@ -824,17 +824,6 @@ void CheckEqualityReduction(JSTypedLoweringTester* R, bool strict, Node* l,
Node* r = R->reduce(eq);
R->CheckBinop(expected, r);
}
{
const Operator* op =
strict ? R->javascript.StrictNotEqual(CompareOperationHint::kAny)
: R->javascript.NotEqual(CompareOperationHint::kAny);
Node* ne = R->Binop(op, p0, p1);
Node* n = R->reduce(ne);
CHECK_EQ(IrOpcode::kBooleanNot, n->opcode());
Node* r = n->InputAt(0);
R->CheckBinop(expected, r);
}
}
}
......
......@@ -356,12 +356,6 @@ TEST_F(TyperTest, TypeJSStrictEqual) {
}
TEST_F(TyperTest, TypeJSStrictNotEqual) {
TestBinaryCompareOp(javascript_.StrictNotEqual(CompareOperationHint::kAny),
std::not_equal_to<double>());
}
//------------------------------------------------------------------------------
// Monotonicity
......@@ -372,7 +366,6 @@ TEST_F(TyperTest, TypeJSStrictNotEqual) {
TEST_BINARY_MONOTONICITY(Equal)
TEST_BINARY_MONOTONICITY(NotEqual)
TEST_BINARY_MONOTONICITY(StrictEqual)
TEST_BINARY_MONOTONICITY(StrictNotEqual)
TEST_BINARY_MONOTONICITY(LessThan)
TEST_BINARY_MONOTONICITY(GreaterThan)
TEST_BINARY_MONOTONICITY(LessThanOrEqual)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment