Commit aa894aff authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

Remove dead handling of Token::NE from all backends.

The parser already changes all negative equality comparison operations
to their positive pendants in {ParserBase::ParseBinaryExpression}. No
other source of the Token::NE exists in the system. We can remove all
handling from the compiler and interpreter backends.

R=bmeurer@chromium.org

Change-Id: I58722c08dd8e498f20c65886fce86b8172737b10
Reviewed-on: https://chromium-review.googlesource.com/449716Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43627}
parent ead3656c
...@@ -1587,15 +1587,7 @@ TF_BUILTIN(Equal, CodeStubAssembler) { ...@@ -1587,15 +1587,7 @@ TF_BUILTIN(Equal, CodeStubAssembler) {
Node* rhs = Parameter(1); Node* rhs = Parameter(1);
Node* context = Parameter(2); Node* context = Parameter(2);
Return(Equal(kDontNegateResult, lhs, rhs, context)); Return(Equal(lhs, rhs, context));
}
TF_BUILTIN(NotEqual, CodeStubAssembler) {
Node* lhs = Parameter(0);
Node* rhs = Parameter(1);
Node* context = Parameter(2);
Return(Equal(kNegateResult, lhs, rhs, context));
} }
TF_BUILTIN(StrictEqual, CodeStubAssembler) { TF_BUILTIN(StrictEqual, CodeStubAssembler) {
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
typedef CodeStubAssembler::ResultMode ResultMode;
typedef CodeStubAssembler::RelationalComparisonMode RelationalComparisonMode; typedef CodeStubAssembler::RelationalComparisonMode RelationalComparisonMode;
class StringBuiltinsAssembler : public CodeStubAssembler { class StringBuiltinsAssembler : public CodeStubAssembler {
...@@ -105,7 +104,7 @@ class StringBuiltinsAssembler : public CodeStubAssembler { ...@@ -105,7 +104,7 @@ class StringBuiltinsAssembler : public CodeStubAssembler {
arraysize(values)); arraysize(values));
} }
void GenerateStringEqual(ResultMode mode); void GenerateStringEqual();
void GenerateStringRelationalComparison(RelationalComparisonMode mode); void GenerateStringRelationalComparison(RelationalComparisonMode mode);
Node* ToSmiBetweenZeroAnd(Node* context, Node* value, Node* limit); Node* ToSmiBetweenZeroAnd(Node* context, Node* value, Node* limit);
...@@ -144,9 +143,8 @@ class StringBuiltinsAssembler : public CodeStubAssembler { ...@@ -144,9 +143,8 @@ class StringBuiltinsAssembler : public CodeStubAssembler {
const NodeFunction1& generic_call); const NodeFunction1& generic_call);
}; };
void StringBuiltinsAssembler::GenerateStringEqual(ResultMode mode) { void StringBuiltinsAssembler::GenerateStringEqual() {
// Here's pseudo-code for the algorithm below in case of kDontNegateResult // Here's pseudo-code for the algorithm below:
// mode; for kNegateResult mode we properly negate the result.
// //
// if (lhs == rhs) return true; // if (lhs == rhs) return true;
// if (lhs->length() != rhs->length()) return false; // if (lhs->length() != rhs->length()) return false;
...@@ -262,17 +260,14 @@ void StringBuiltinsAssembler::GenerateStringEqual(ResultMode mode) { ...@@ -262,17 +260,14 @@ void StringBuiltinsAssembler::GenerateStringEqual(ResultMode mode) {
rhs_instance_type, &restart); rhs_instance_type, &restart);
// TODO(bmeurer): Add support for two byte string equality checks. // TODO(bmeurer): Add support for two byte string equality checks.
Runtime::FunctionId function_id = (mode == ResultMode::kDontNegateResult) TailCallRuntime(Runtime::kStringEqual, context, lhs, rhs);
? Runtime::kStringEqual
: Runtime::kStringNotEqual;
TailCallRuntime(function_id, context, lhs, rhs);
} }
Bind(&if_equal); Bind(&if_equal);
Return(BooleanConstant(mode == ResultMode::kDontNegateResult)); Return(TrueConstant());
Bind(&if_notequal); Bind(&if_notequal);
Return(BooleanConstant(mode == ResultMode::kNegateResult)); Return(FalseConstant());
} }
void StringBuiltinsAssembler::GenerateStringRelationalComparison( void StringBuiltinsAssembler::GenerateStringRelationalComparison(
...@@ -439,13 +434,7 @@ void StringBuiltinsAssembler::GenerateStringRelationalComparison( ...@@ -439,13 +434,7 @@ void StringBuiltinsAssembler::GenerateStringRelationalComparison(
} }
} }
TF_BUILTIN(StringEqual, StringBuiltinsAssembler) { TF_BUILTIN(StringEqual, StringBuiltinsAssembler) { GenerateStringEqual(); }
GenerateStringEqual(ResultMode::kDontNegateResult);
}
TF_BUILTIN(StringNotEqual, StringBuiltinsAssembler) {
GenerateStringEqual(ResultMode::kNegateResult);
}
TF_BUILTIN(StringLessThan, StringBuiltinsAssembler) { TF_BUILTIN(StringLessThan, StringBuiltinsAssembler) {
GenerateStringRelationalComparison(RelationalComparisonMode::kLessThan); GenerateStringRelationalComparison(RelationalComparisonMode::kLessThan);
......
...@@ -146,7 +146,6 @@ class Isolate; ...@@ -146,7 +146,6 @@ class Isolate;
TFS(StringIndexOf, BUILTIN, kNoExtraICState, StringIndexOf, 1) \ TFS(StringIndexOf, BUILTIN, kNoExtraICState, StringIndexOf, 1) \
TFS(StringLessThan, BUILTIN, kNoExtraICState, Compare, 1) \ TFS(StringLessThan, BUILTIN, kNoExtraICState, Compare, 1) \
TFS(StringLessThanOrEqual, BUILTIN, kNoExtraICState, Compare, 1) \ TFS(StringLessThanOrEqual, BUILTIN, kNoExtraICState, Compare, 1) \
TFS(StringNotEqual, BUILTIN, kNoExtraICState, Compare, 1) \
\ \
/* Interpreter */ \ /* Interpreter */ \
ASM(InterpreterEntryTrampoline) \ ASM(InterpreterEntryTrampoline) \
...@@ -603,7 +602,6 @@ class Isolate; ...@@ -603,7 +602,6 @@ class Isolate;
TFS(GreaterThan, BUILTIN, kNoExtraICState, Compare, 1) \ TFS(GreaterThan, BUILTIN, kNoExtraICState, Compare, 1) \
TFS(GreaterThanOrEqual, BUILTIN, kNoExtraICState, Compare, 1) \ TFS(GreaterThanOrEqual, BUILTIN, kNoExtraICState, Compare, 1) \
TFS(Equal, BUILTIN, kNoExtraICState, Compare, 1) \ TFS(Equal, BUILTIN, kNoExtraICState, Compare, 1) \
TFS(NotEqual, BUILTIN, kNoExtraICState, Compare, 1) \
TFS(StrictEqual, BUILTIN, kNoExtraICState, Compare, 1) \ TFS(StrictEqual, BUILTIN, kNoExtraICState, Compare, 1) \
\ \
/* Object */ \ /* Object */ \
......
...@@ -237,7 +237,6 @@ TFS_BUILTIN(LessThanOrEqual) ...@@ -237,7 +237,6 @@ TFS_BUILTIN(LessThanOrEqual)
TFS_BUILTIN(GreaterThan) TFS_BUILTIN(GreaterThan)
TFS_BUILTIN(GreaterThanOrEqual) TFS_BUILTIN(GreaterThanOrEqual)
TFS_BUILTIN(Equal) TFS_BUILTIN(Equal)
TFS_BUILTIN(NotEqual)
TFS_BUILTIN(StrictEqual) TFS_BUILTIN(StrictEqual)
TFS_BUILTIN(CreateIterResultObject) TFS_BUILTIN(CreateIterResultObject)
TFS_BUILTIN(HasProperty) TFS_BUILTIN(HasProperty)
...@@ -270,7 +269,6 @@ TFS_BUILTIN(RegExpSplit) ...@@ -270,7 +269,6 @@ TFS_BUILTIN(RegExpSplit)
TFS_BUILTIN(StringCharAt) TFS_BUILTIN(StringCharAt)
TFS_BUILTIN(StringCharCodeAt) TFS_BUILTIN(StringCharCodeAt)
TFS_BUILTIN(StringEqual) TFS_BUILTIN(StringEqual)
TFS_BUILTIN(StringNotEqual)
TFS_BUILTIN(StringLessThan) TFS_BUILTIN(StringLessThan)
TFS_BUILTIN(StringLessThanOrEqual) TFS_BUILTIN(StringLessThanOrEqual)
TFS_BUILTIN(StringGreaterThan) TFS_BUILTIN(StringGreaterThan)
...@@ -291,9 +289,6 @@ Callable CodeFactory::StringCompare(Isolate* isolate, Token::Value token) { ...@@ -291,9 +289,6 @@ Callable CodeFactory::StringCompare(Isolate* isolate, Token::Value token) {
case Token::EQ: case Token::EQ:
case Token::EQ_STRICT: case Token::EQ_STRICT:
return StringEqual(isolate); return StringEqual(isolate);
case Token::NE:
case Token::NE_STRICT:
return StringNotEqual(isolate);
case Token::LT: case Token::LT:
return StringLessThan(isolate); return StringLessThan(isolate);
case Token::GT: case Token::GT:
......
...@@ -117,7 +117,6 @@ class V8_EXPORT_PRIVATE CodeFactory final { ...@@ -117,7 +117,6 @@ class V8_EXPORT_PRIVATE CodeFactory final {
static Callable GreaterThan(Isolate* isolate); static Callable GreaterThan(Isolate* isolate);
static Callable GreaterThanOrEqual(Isolate* isolate); static Callable GreaterThanOrEqual(Isolate* isolate);
static Callable Equal(Isolate* isolate); static Callable Equal(Isolate* isolate);
static Callable NotEqual(Isolate* isolate);
static Callable StrictEqual(Isolate* isolate); static Callable StrictEqual(Isolate* isolate);
static Callable StringAdd(Isolate* isolate, StringAddFlags flags, static Callable StringAdd(Isolate* isolate, StringAddFlags flags,
...@@ -126,7 +125,6 @@ class V8_EXPORT_PRIVATE CodeFactory final { ...@@ -126,7 +125,6 @@ class V8_EXPORT_PRIVATE CodeFactory final {
static Callable StringCharCodeAt(Isolate* isolate); static Callable StringCharCodeAt(Isolate* isolate);
static Callable StringCompare(Isolate* isolate, Token::Value token); static Callable StringCompare(Isolate* isolate, Token::Value token);
static Callable StringEqual(Isolate* isolate); static Callable StringEqual(Isolate* isolate);
static Callable StringNotEqual(Isolate* isolate);
static Callable StringLessThan(Isolate* isolate); static Callable StringLessThan(Isolate* isolate);
static Callable StringLessThanOrEqual(Isolate* isolate); static Callable StringLessThanOrEqual(Isolate* isolate);
static Callable StringGreaterThan(Isolate* isolate); static Callable StringGreaterThan(Isolate* isolate);
......
...@@ -6871,8 +6871,7 @@ void GenerateEqual_Same(CodeStubAssembler* assembler, Node* value, ...@@ -6871,8 +6871,7 @@ void GenerateEqual_Same(CodeStubAssembler* assembler, Node* value,
} // namespace } // namespace
// ES6 section 7.2.12 Abstract Equality Comparison // ES6 section 7.2.12 Abstract Equality Comparison
Node* CodeStubAssembler::Equal(ResultMode mode, Node* lhs, Node* rhs, Node* CodeStubAssembler::Equal(Node* lhs, Node* rhs, Node* context) {
Node* context) {
// This is a slightly optimized version of Object::Equals represented as // This is a slightly optimized version of Object::Equals represented as
// scheduled TurboFan graph utilizing the CodeStubAssembler. Whenever you // scheduled TurboFan graph utilizing the CodeStubAssembler. Whenever you
// change something functionality wise in here, remember to update the // change something functionality wise in here, remember to update the
...@@ -7071,9 +7070,7 @@ Node* CodeStubAssembler::Equal(ResultMode mode, Node* lhs, Node* rhs, ...@@ -7071,9 +7070,7 @@ Node* CodeStubAssembler::Equal(ResultMode mode, Node* lhs, Node* rhs,
{ {
// Both {lhs} and {rhs} are of type String, just do the // Both {lhs} and {rhs} are of type String, just do the
// string comparison then. // string comparison then.
Callable callable = (mode == kDontNegateResult) Callable callable = CodeFactory::StringEqual(isolate());
? CodeFactory::StringEqual(isolate())
: CodeFactory::StringNotEqual(isolate());
result.Bind(CallStub(callable, context, lhs, rhs)); result.Bind(CallStub(callable, context, lhs, rhs));
Goto(&end); Goto(&end);
} }
...@@ -7309,13 +7306,13 @@ Node* CodeStubAssembler::Equal(ResultMode mode, Node* lhs, Node* rhs, ...@@ -7309,13 +7306,13 @@ Node* CodeStubAssembler::Equal(ResultMode mode, Node* lhs, Node* rhs,
Bind(&if_equal); Bind(&if_equal);
{ {
result.Bind(BooleanConstant(mode == kDontNegateResult)); result.Bind(TrueConstant());
Goto(&end); Goto(&end);
} }
Bind(&if_notequal); Bind(&if_notequal);
{ {
result.Bind(BooleanConstant(mode == kNegateResult)); result.Bind(FalseConstant());
Goto(&end); Goto(&end);
} }
......
...@@ -1209,9 +1209,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -1209,9 +1209,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
void GotoUnlessNumberLessThan(Node* lhs, Node* rhs, Label* if_false); void GotoUnlessNumberLessThan(Node* lhs, Node* rhs, Label* if_false);
enum ResultMode { kDontNegateResult, kNegateResult }; Node* Equal(Node* lhs, Node* rhs, Node* context);
Node* Equal(ResultMode mode, Node* lhs, Node* rhs, Node* context);
Node* StrictEqual(Node* lhs, Node* rhs, Node* context); Node* StrictEqual(Node* lhs, Node* rhs, Node* context);
......
...@@ -1990,9 +1990,6 @@ void AstGraphBuilder::VisitCompareOperation(CompareOperation* expr) { ...@@ -1990,9 +1990,6 @@ void AstGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
case Token::EQ: case Token::EQ:
op = javascript()->Equal(hint); op = javascript()->Equal(hint);
break; break;
case Token::NE:
op = javascript()->NotEqual(hint);
break;
case Token::EQ_STRICT: case Token::EQ_STRICT:
op = javascript()->StrictEqual(hint); op = javascript()->StrictEqual(hint);
break; break;
...@@ -2811,7 +2808,6 @@ Node* AstGraphBuilder::TryFastToBoolean(Node* input) { ...@@ -2811,7 +2808,6 @@ Node* AstGraphBuilder::TryFastToBoolean(Node* input) {
return jsgraph_->BooleanConstant(object->BooleanValue()); return jsgraph_->BooleanConstant(object->BooleanValue());
} }
case IrOpcode::kJSEqual: case IrOpcode::kJSEqual:
case IrOpcode::kJSNotEqual:
case IrOpcode::kJSStrictEqual: case IrOpcode::kJSStrictEqual:
case IrOpcode::kJSLessThan: case IrOpcode::kJSLessThan:
case IrOpcode::kJSLessThanOrEqual: case IrOpcode::kJSLessThanOrEqual:
......
...@@ -1771,10 +1771,6 @@ void BytecodeGraphBuilder::VisitTestEqual() { ...@@ -1771,10 +1771,6 @@ void BytecodeGraphBuilder::VisitTestEqual() {
BuildCompareOp(javascript()->Equal(GetCompareOperationHint())); BuildCompareOp(javascript()->Equal(GetCompareOperationHint()));
} }
void BytecodeGraphBuilder::VisitTestNotEqual() {
BuildCompareOp(javascript()->NotEqual(GetCompareOperationHint()));
}
void BytecodeGraphBuilder::VisitTestEqualStrict() { void BytecodeGraphBuilder::VisitTestEqualStrict() {
BuildCompareOp(javascript()->StrictEqual(GetCompareOperationHint())); BuildCompareOp(javascript()->StrictEqual(GetCompareOperationHint()));
} }
......
...@@ -73,7 +73,6 @@ REPLACE_STUB_CALL(GreaterThan) ...@@ -73,7 +73,6 @@ REPLACE_STUB_CALL(GreaterThan)
REPLACE_STUB_CALL(GreaterThanOrEqual) REPLACE_STUB_CALL(GreaterThanOrEqual)
REPLACE_STUB_CALL(HasProperty) REPLACE_STUB_CALL(HasProperty)
REPLACE_STUB_CALL(Equal) REPLACE_STUB_CALL(Equal)
REPLACE_STUB_CALL(NotEqual)
REPLACE_STUB_CALL(ToInteger) REPLACE_STUB_CALL(ToInteger)
REPLACE_STUB_CALL(ToLength) REPLACE_STUB_CALL(ToLength)
REPLACE_STUB_CALL(ToNumber) REPLACE_STUB_CALL(ToNumber)
......
...@@ -523,7 +523,6 @@ BinaryOperationHint BinaryOperationHintOf(const Operator* op) { ...@@ -523,7 +523,6 @@ BinaryOperationHint BinaryOperationHintOf(const Operator* op) {
CompareOperationHint CompareOperationHintOf(const Operator* op) { CompareOperationHint CompareOperationHintOf(const Operator* op) {
DCHECK(op->opcode() == IrOpcode::kJSEqual || DCHECK(op->opcode() == IrOpcode::kJSEqual ||
op->opcode() == IrOpcode::kJSNotEqual ||
op->opcode() == IrOpcode::kJSStrictEqual || op->opcode() == IrOpcode::kJSStrictEqual ||
op->opcode() == IrOpcode::kJSLessThan || op->opcode() == IrOpcode::kJSLessThan ||
op->opcode() == IrOpcode::kJSGreaterThan || op->opcode() == IrOpcode::kJSGreaterThan ||
...@@ -570,7 +569,6 @@ CompareOperationHint CompareOperationHintOf(const Operator* op) { ...@@ -570,7 +569,6 @@ CompareOperationHint CompareOperationHintOf(const Operator* op) {
#define COMPARE_OP_LIST(V) \ #define COMPARE_OP_LIST(V) \
V(Equal, Operator::kNoProperties) \ V(Equal, Operator::kNoProperties) \
V(NotEqual, Operator::kNoProperties) \
V(StrictEqual, Operator::kPure) \ V(StrictEqual, Operator::kPure) \
V(LessThan, Operator::kNoProperties) \ V(LessThan, Operator::kNoProperties) \
V(GreaterThan, Operator::kNoProperties) \ V(GreaterThan, Operator::kNoProperties) \
......
...@@ -563,7 +563,6 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final ...@@ -563,7 +563,6 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final
explicit JSOperatorBuilder(Zone* zone); explicit JSOperatorBuilder(Zone* zone);
const Operator* Equal(CompareOperationHint hint); const Operator* Equal(CompareOperationHint hint);
const Operator* NotEqual(CompareOperationHint hint);
const Operator* StrictEqual(CompareOperationHint hint); const Operator* StrictEqual(CompareOperationHint hint);
const Operator* LessThan(CompareOperationHint hint); const Operator* LessThan(CompareOperationHint hint);
const Operator* GreaterThan(CompareOperationHint hint); const Operator* GreaterThan(CompareOperationHint hint);
......
...@@ -190,7 +190,6 @@ Reduction JSTypeHintLowering::ReduceBinaryOperation(const Operator* op, ...@@ -190,7 +190,6 @@ Reduction JSTypeHintLowering::ReduceBinaryOperation(const Operator* op,
switch (op->opcode()) { switch (op->opcode()) {
case IrOpcode::kJSEqual: case IrOpcode::kJSEqual:
case IrOpcode::kJSStrictEqual: case IrOpcode::kJSStrictEqual:
case IrOpcode::kJSNotEqual:
break; break;
case IrOpcode::kJSLessThan: case IrOpcode::kJSLessThan:
case IrOpcode::kJSGreaterThan: case IrOpcode::kJSGreaterThan:
......
...@@ -221,9 +221,8 @@ class JSBinopReduction final { ...@@ -221,9 +221,8 @@ class JSBinopReduction final {
} }
// Remove all effect and control inputs and outputs to this node and change // Remove all effect and control inputs and outputs to this node and change
// to the pure operator {op}, possibly inserting a boolean inversion. // to the pure operator {op}.
Reduction ChangeToPureOperator(const Operator* op, bool invert = false, Reduction ChangeToPureOperator(const Operator* op, Type* type = Type::Any()) {
Type* type = Type::Any()) {
DCHECK_EQ(0, op->EffectInputCount()); DCHECK_EQ(0, op->EffectInputCount());
DCHECK_EQ(false, OperatorProperties::HasContextInput(op)); DCHECK_EQ(false, OperatorProperties::HasContextInput(op));
DCHECK_EQ(0, op->ControlInputCount()); DCHECK_EQ(0, op->ControlInputCount());
...@@ -243,19 +242,10 @@ class JSBinopReduction final { ...@@ -243,19 +242,10 @@ class JSBinopReduction final {
Type* node_type = NodeProperties::GetType(node_); Type* node_type = NodeProperties::GetType(node_);
NodeProperties::SetType(node_, Type::Intersect(node_type, type, zone())); NodeProperties::SetType(node_, Type::Intersect(node_type, type, zone()));
if (invert) {
// Insert an boolean not to invert the value.
Node* value = graph()->NewNode(simplified()->BooleanNot(), node_);
node_->ReplaceUses(value);
// Note: ReplaceUses() smashes all uses, so smash it back here.
value->ReplaceInput(0, node_);
return lowering_->Replace(value);
}
return lowering_->Changed(node_); return lowering_->Changed(node_);
} }
Reduction ChangeToSpeculativeOperator(const Operator* op, bool invert, Reduction ChangeToSpeculativeOperator(const Operator* op, Type* upper_bound) {
Type* upper_bound) {
DCHECK_EQ(1, op->EffectInputCount()); DCHECK_EQ(1, op->EffectInputCount());
DCHECK_EQ(1, op->EffectOutputCount()); DCHECK_EQ(1, op->EffectOutputCount());
DCHECK_EQ(false, OperatorProperties::HasContextInput(op)); DCHECK_EQ(false, OperatorProperties::HasContextInput(op));
...@@ -298,25 +288,9 @@ class JSBinopReduction final { ...@@ -298,25 +288,9 @@ class JSBinopReduction final {
NodeProperties::SetType(node_, NodeProperties::SetType(node_,
Type::Intersect(node_type, upper_bound, zone())); Type::Intersect(node_type, upper_bound, zone()));
if (invert) {
// Insert an boolean not to invert the value.
Node* value = graph()->NewNode(simplified()->BooleanNot(), node_);
node_->ReplaceUses(value);
// Note: ReplaceUses() smashes all uses, so smash it back here.
value->ReplaceInput(0, node_);
return lowering_->Replace(value);
}
return lowering_->Changed(node_); return lowering_->Changed(node_);
} }
Reduction ChangeToPureOperator(const Operator* op, Type* type) {
return ChangeToPureOperator(op, false, type);
}
Reduction ChangeToSpeculativeOperator(const Operator* op, Type* type) {
return ChangeToSpeculativeOperator(op, false, type);
}
const Operator* NumberOp() { const Operator* NumberOp() {
switch (node_->opcode()) { switch (node_->opcode()) {
case IrOpcode::kJSAdd: case IrOpcode::kJSAdd:
...@@ -878,7 +852,7 @@ Reduction JSTypedLowering::ReduceJSTypeOf(Node* node) { ...@@ -878,7 +852,7 @@ Reduction JSTypedLowering::ReduceJSTypeOf(Node* node) {
return NoChange(); return NoChange();
} }
Reduction JSTypedLowering::ReduceJSEqualTypeOf(Node* node, bool invert) { Reduction JSTypedLowering::ReduceJSEqualTypeOf(Node* node) {
Node* input; Node* input;
Handle<String> type; Handle<String> type;
HeapObjectBinopMatcher m(node); HeapObjectBinopMatcher m(node);
...@@ -925,66 +899,55 @@ Reduction JSTypedLowering::ReduceJSEqualTypeOf(Node* node, bool invert) { ...@@ -925,66 +899,55 @@ Reduction JSTypedLowering::ReduceJSEqualTypeOf(Node* node, bool invert) {
} else { } else {
return NoChange(); return NoChange();
} }
if (invert) {
value = graph()->NewNode(simplified()->BooleanNot(), value);
}
ReplaceWithValue(node, value); ReplaceWithValue(node, value);
return Replace(value); return Replace(value);
} }
Reduction JSTypedLowering::ReduceJSEqual(Node* node, bool invert) { Reduction JSTypedLowering::ReduceJSEqual(Node* node) {
Reduction const reduction = ReduceJSEqualTypeOf(node, invert); Reduction const reduction = ReduceJSEqualTypeOf(node);
if (reduction.Changed()) return reduction; if (reduction.Changed()) return reduction;
JSBinopReduction r(this, node); JSBinopReduction r(this, node);
if (r.BothInputsAre(Type::UniqueName())) { if (r.BothInputsAre(Type::UniqueName())) {
return r.ChangeToPureOperator(simplified()->ReferenceEqual(), invert); return r.ChangeToPureOperator(simplified()->ReferenceEqual());
} }
if (r.IsInternalizedStringCompareOperation()) { if (r.IsInternalizedStringCompareOperation()) {
r.CheckInputsToInternalizedString(); r.CheckInputsToInternalizedString();
return r.ChangeToPureOperator(simplified()->ReferenceEqual(), invert); return r.ChangeToPureOperator(simplified()->ReferenceEqual());
} }
if (r.BothInputsAre(Type::String())) { if (r.BothInputsAre(Type::String())) {
return r.ChangeToPureOperator(simplified()->StringEqual(), invert); return r.ChangeToPureOperator(simplified()->StringEqual());
} }
if (r.BothInputsAre(Type::Boolean())) { if (r.BothInputsAre(Type::Boolean())) {
return r.ChangeToPureOperator(simplified()->ReferenceEqual(), invert); return r.ChangeToPureOperator(simplified()->ReferenceEqual());
} }
if (r.BothInputsAre(Type::Receiver())) { if (r.BothInputsAre(Type::Receiver())) {
return r.ChangeToPureOperator(simplified()->ReferenceEqual(), invert); return r.ChangeToPureOperator(simplified()->ReferenceEqual());
} }
if (r.OneInputIs(Type::Undetectable())) { if (r.OneInputIs(Type::Undetectable())) {
RelaxEffectsAndControls(node); RelaxEffectsAndControls(node);
node->RemoveInput(r.LeftInputIs(Type::Undetectable()) ? 0 : 1); node->RemoveInput(r.LeftInputIs(Type::Undetectable()) ? 0 : 1);
node->TrimInputCount(1); node->TrimInputCount(1);
NodeProperties::ChangeOp(node, simplified()->ObjectIsUndetectable()); NodeProperties::ChangeOp(node, simplified()->ObjectIsUndetectable());
if (invert) {
// Insert an boolean not to invert the value.
Node* value = graph()->NewNode(simplified()->BooleanNot(), node);
node->ReplaceUses(value);
// Note: ReplaceUses() smashes all uses, so smash it back here.
value->ReplaceInput(0, node);
return Replace(value);
}
return Changed(node); return Changed(node);
} }
NumberOperationHint hint; NumberOperationHint hint;
if (r.BothInputsAre(Type::Signed32()) || if (r.BothInputsAre(Type::Signed32()) ||
r.BothInputsAre(Type::Unsigned32())) { r.BothInputsAre(Type::Unsigned32())) {
return r.ChangeToPureOperator(simplified()->NumberEqual(), invert); return r.ChangeToPureOperator(simplified()->NumberEqual());
} else if (r.GetCompareNumberOperationHint(&hint)) { } else if (r.GetCompareNumberOperationHint(&hint)) {
return r.ChangeToSpeculativeOperator( return r.ChangeToSpeculativeOperator(
simplified()->SpeculativeNumberEqual(hint), invert, Type::Boolean()); simplified()->SpeculativeNumberEqual(hint), Type::Boolean());
} else if (r.BothInputsAre(Type::Number())) { } else if (r.BothInputsAre(Type::Number())) {
return r.ChangeToPureOperator(simplified()->NumberEqual(), invert); return r.ChangeToPureOperator(simplified()->NumberEqual());
} else if (r.IsReceiverCompareOperation()) { } else if (r.IsReceiverCompareOperation()) {
r.CheckInputsToReceiver(); r.CheckInputsToReceiver();
return r.ChangeToPureOperator(simplified()->ReferenceEqual(), invert); return r.ChangeToPureOperator(simplified()->ReferenceEqual());
} else if (r.IsStringCompareOperation()) { } else if (r.IsStringCompareOperation()) {
r.CheckInputsToString(); r.CheckInputsToString();
return r.ChangeToPureOperator(simplified()->StringEqual(), invert); return r.ChangeToPureOperator(simplified()->StringEqual());
} }
return NoChange(); return NoChange();
} }
...@@ -1010,7 +973,7 @@ Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node) { ...@@ -1010,7 +973,7 @@ Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node) {
} }
} }
Reduction const reduction = ReduceJSEqualTypeOf(node, false); Reduction const reduction = ReduceJSEqualTypeOf(node);
if (reduction.Changed()) return reduction; if (reduction.Changed()) return reduction;
if (r.BothInputsAre(Type::Unique())) { if (r.BothInputsAre(Type::Unique())) {
...@@ -1033,7 +996,7 @@ Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node) { ...@@ -1033,7 +996,7 @@ Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node) {
return r.ChangeToPureOperator(simplified()->NumberEqual()); return r.ChangeToPureOperator(simplified()->NumberEqual());
} else if (r.GetCompareNumberOperationHint(&hint)) { } else if (r.GetCompareNumberOperationHint(&hint)) {
return r.ChangeToSpeculativeOperator( return r.ChangeToSpeculativeOperator(
simplified()->SpeculativeNumberEqual(hint), false, Type::Boolean()); simplified()->SpeculativeNumberEqual(hint), Type::Boolean());
} else if (r.BothInputsAre(Type::Number())) { } else if (r.BothInputsAre(Type::Number())) {
return r.ChangeToPureOperator(simplified()->NumberEqual()); return r.ChangeToPureOperator(simplified()->NumberEqual());
} else if (r.IsReceiverCompareOperation()) { } else if (r.IsReceiverCompareOperation()) {
...@@ -2368,9 +2331,7 @@ Reduction JSTypedLowering::ReduceJSGeneratorRestoreRegister(Node* node) { ...@@ -2368,9 +2331,7 @@ Reduction JSTypedLowering::ReduceJSGeneratorRestoreRegister(Node* node) {
Reduction JSTypedLowering::Reduce(Node* node) { Reduction JSTypedLowering::Reduce(Node* node) {
switch (node->opcode()) { switch (node->opcode()) {
case IrOpcode::kJSEqual: case IrOpcode::kJSEqual:
return ReduceJSEqual(node, false); return ReduceJSEqual(node);
case IrOpcode::kJSNotEqual:
return ReduceJSEqual(node, true);
case IrOpcode::kJSStrictEqual: case IrOpcode::kJSStrictEqual:
return ReduceJSStrictEqual(node); return ReduceJSStrictEqual(node);
case IrOpcode::kJSLessThan: // fall through case IrOpcode::kJSLessThan: // fall through
......
...@@ -57,8 +57,8 @@ class V8_EXPORT_PRIVATE JSTypedLowering final ...@@ -57,8 +57,8 @@ class V8_EXPORT_PRIVATE JSTypedLowering final
Reduction ReduceJSStoreContext(Node* node); Reduction ReduceJSStoreContext(Node* node);
Reduction ReduceJSLoadModule(Node* node); Reduction ReduceJSLoadModule(Node* node);
Reduction ReduceJSStoreModule(Node* node); Reduction ReduceJSStoreModule(Node* node);
Reduction ReduceJSEqualTypeOf(Node* node, bool invert); Reduction ReduceJSEqualTypeOf(Node* node);
Reduction ReduceJSEqual(Node* node, bool invert); Reduction ReduceJSEqual(Node* node);
Reduction ReduceJSStrictEqual(Node* node); Reduction ReduceJSStrictEqual(Node* node);
Reduction ReduceJSToBoolean(Node* node); Reduction ReduceJSToBoolean(Node* node);
Reduction ReduceJSToInteger(Node* node); Reduction ReduceJSToInteger(Node* node);
......
...@@ -82,7 +82,6 @@ ...@@ -82,7 +82,6 @@
// Opcodes for JavaScript operators. // Opcodes for JavaScript operators.
#define JS_COMPARE_BINOP_LIST(V) \ #define JS_COMPARE_BINOP_LIST(V) \
V(JSEqual) \ V(JSEqual) \
V(JSNotEqual) \
V(JSStrictEqual) \ V(JSStrictEqual) \
V(JSLessThan) \ V(JSLessThan) \
V(JSGreaterThan) \ V(JSGreaterThan) \
......
...@@ -53,7 +53,6 @@ bool OperatorProperties::HasFrameStateInput(const Operator* op) { ...@@ -53,7 +53,6 @@ bool OperatorProperties::HasFrameStateInput(const Operator* op) {
// Compare operations // Compare operations
case IrOpcode::kJSEqual: case IrOpcode::kJSEqual:
case IrOpcode::kJSNotEqual:
case IrOpcode::kJSGreaterThan: case IrOpcode::kJSGreaterThan:
case IrOpcode::kJSGreaterThanOrEqual: case IrOpcode::kJSGreaterThanOrEqual:
case IrOpcode::kJSLessThan: case IrOpcode::kJSLessThan:
......
...@@ -259,7 +259,6 @@ class Typer::Visitor : public Reducer { ...@@ -259,7 +259,6 @@ class Typer::Visitor : public Reducer {
typedef base::Flags<ComparisonOutcomeFlags> ComparisonOutcome; typedef base::Flags<ComparisonOutcomeFlags> ComparisonOutcome;
static ComparisonOutcome Invert(ComparisonOutcome, Typer*); static ComparisonOutcome Invert(ComparisonOutcome, Typer*);
static Type* Invert(Type*, Typer*);
static Type* FalsifyUndefined(ComparisonOutcome, Typer*); static Type* FalsifyUndefined(ComparisonOutcome, Typer*);
static Type* ToPrimitive(Type*, Typer*); static Type* ToPrimitive(Type*, Typer*);
...@@ -391,15 +390,6 @@ Type* Typer::Visitor::TypeBinaryOp(Node* node, BinaryTyperFun f) { ...@@ -391,15 +390,6 @@ Type* Typer::Visitor::TypeBinaryOp(Node* node, BinaryTyperFun f) {
} }
Type* Typer::Visitor::Invert(Type* type, Typer* t) {
DCHECK(type->Is(Type::Boolean()));
DCHECK(type->IsInhabited());
if (type->Is(t->singleton_false_)) return t->singleton_true_;
if (type->Is(t->singleton_true_)) return t->singleton_false_;
return type;
}
Typer::Visitor::ComparisonOutcome Typer::Visitor::Invert( Typer::Visitor::ComparisonOutcome Typer::Visitor::Invert(
ComparisonOutcome outcome, Typer* t) { ComparisonOutcome outcome, Typer* t) {
ComparisonOutcome result(0); ComparisonOutcome result(0);
...@@ -899,11 +889,6 @@ Type* Typer::Visitor::JSEqualTyper(Type* lhs, Type* rhs, Typer* t) { ...@@ -899,11 +889,6 @@ Type* Typer::Visitor::JSEqualTyper(Type* lhs, Type* rhs, Typer* t) {
} }
Type* Typer::Visitor::JSNotEqualTyper(Type* lhs, Type* rhs, Typer* t) {
return Invert(JSEqualTyper(lhs, rhs, t), t);
}
static Type* JSType(Type* type) { static Type* JSType(Type* type) {
if (type->Is(Type::Boolean())) return Type::Boolean(); if (type->Is(Type::Boolean())) return Type::Boolean();
if (type->Is(Type::String())) return Type::String(); if (type->Is(Type::String())) return Type::String();
......
...@@ -513,7 +513,6 @@ void Verifier::Visitor::Check(Node* node) { ...@@ -513,7 +513,6 @@ void Verifier::Visitor::Check(Node* node) {
// JavaScript operators // JavaScript operators
// -------------------- // --------------------
case IrOpcode::kJSEqual: case IrOpcode::kJSEqual:
case IrOpcode::kJSNotEqual:
case IrOpcode::kJSStrictEqual: case IrOpcode::kJSStrictEqual:
case IrOpcode::kJSLessThan: case IrOpcode::kJSLessThan:
case IrOpcode::kJSGreaterThan: case IrOpcode::kJSGreaterThan:
......
...@@ -337,9 +337,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CompareOperation( ...@@ -337,9 +337,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CompareOperation(
case Token::Value::EQ: case Token::Value::EQ:
OutputTestEqual(reg, feedback_slot); OutputTestEqual(reg, feedback_slot);
break; break;
case Token::Value::NE:
OutputTestNotEqual(reg, feedback_slot);
break;
case Token::Value::EQ_STRICT: case Token::Value::EQ_STRICT:
OutputTestEqualStrict(reg, feedback_slot); OutputTestEqualStrict(reg, feedback_slot);
break; break;
......
...@@ -180,8 +180,6 @@ namespace interpreter { ...@@ -180,8 +180,6 @@ namespace interpreter {
/* Test Operators */ \ /* Test Operators */ \
V(TestEqual, AccumulatorUse::kReadWrite, OperandType::kReg, \ V(TestEqual, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx) \ OperandType::kIdx) \
V(TestNotEqual, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx) \
V(TestEqualStrict, AccumulatorUse::kReadWrite, OperandType::kReg, \ V(TestEqualStrict, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx) \ OperandType::kIdx) \
V(TestLessThan, AccumulatorUse::kReadWrite, OperandType::kReg, \ V(TestLessThan, AccumulatorUse::kReadWrite, OperandType::kReg, \
...@@ -487,7 +485,6 @@ class V8_EXPORT_PRIVATE Bytecodes final { ...@@ -487,7 +485,6 @@ class V8_EXPORT_PRIVATE Bytecodes final {
case Bytecode::kToBooleanLogicalNot: case Bytecode::kToBooleanLogicalNot:
case Bytecode::kLogicalNot: case Bytecode::kLogicalNot:
case Bytecode::kTestEqual: case Bytecode::kTestEqual:
case Bytecode::kTestNotEqual:
case Bytecode::kTestEqualStrict: case Bytecode::kTestEqualStrict:
case Bytecode::kTestLessThan: case Bytecode::kTestLessThan:
case Bytecode::kTestLessThanOrEqual: case Bytecode::kTestLessThanOrEqual:
......
...@@ -1297,12 +1297,7 @@ void Interpreter::DoCompareOpWithFeedback(Token::Value compare_op, ...@@ -1297,12 +1297,7 @@ void Interpreter::DoCompareOpWithFeedback(Token::Value compare_op,
Node* result; Node* result;
switch (compare_op) { switch (compare_op) {
case Token::EQ: case Token::EQ:
result = assembler->Equal(CodeStubAssembler::kDontNegateResult, lhs, rhs, result = assembler->Equal(lhs, rhs, context);
context);
break;
case Token::NE:
result =
assembler->Equal(CodeStubAssembler::kNegateResult, lhs, rhs, context);
break; break;
case Token::EQ_STRICT: case Token::EQ_STRICT:
result = assembler->StrictEqual(lhs, rhs, context); result = assembler->StrictEqual(lhs, rhs, context);
...@@ -2347,13 +2342,6 @@ void Interpreter::DoTestEqual(InterpreterAssembler* assembler) { ...@@ -2347,13 +2342,6 @@ void Interpreter::DoTestEqual(InterpreterAssembler* assembler) {
DoCompareOpWithFeedback(Token::Value::EQ, assembler); DoCompareOpWithFeedback(Token::Value::EQ, assembler);
} }
// TestNotEqual <src>
//
// Test if the value in the <src> register is not equal to the accumulator.
void Interpreter::DoTestNotEqual(InterpreterAssembler* assembler) {
DoCompareOpWithFeedback(Token::Value::NE, assembler);
}
// TestEqualStrict <src> // TestEqualStrict <src>
// //
// Test if the value in the <src> register is strictly equal to the accumulator. // Test if the value in the <src> register is strictly equal to the accumulator.
......
...@@ -1689,9 +1689,8 @@ TEST(InterpreterJumpWith32BitOperand) { ...@@ -1689,9 +1689,8 @@ TEST(InterpreterJumpWith32BitOperand) {
} }
static const Token::Value kComparisonTypes[] = { static const Token::Value kComparisonTypes[] = {
Token::Value::EQ, Token::Value::NE, Token::Value::EQ_STRICT, Token::Value::EQ, Token::Value::EQ_STRICT, Token::Value::LT,
Token::Value::LT, Token::Value::LTE, Token::Value::GT, Token::Value::LTE, Token::Value::GT, Token::Value::GTE};
Token::Value::GTE};
template <typename T> template <typename T>
bool CompareC(Token::Value op, T lhs, T rhs, bool types_differed = false) { bool CompareC(Token::Value op, T lhs, T rhs, bool types_differed = false) {
......
...@@ -343,12 +343,6 @@ TEST_F(TyperTest, TypeJSEqual) { ...@@ -343,12 +343,6 @@ TEST_F(TyperTest, TypeJSEqual) {
} }
TEST_F(TyperTest, TypeJSNotEqual) {
TestBinaryCompareOp(javascript_.NotEqual(CompareOperationHint::kAny),
std::not_equal_to<double>());
}
// For numbers there's no difference between strict and non-strict equality. // For numbers there's no difference between strict and non-strict equality.
TEST_F(TyperTest, TypeJSStrictEqual) { TEST_F(TyperTest, TypeJSStrictEqual) {
TestBinaryCompareOp(javascript_.StrictEqual(CompareOperationHint::kAny), TestBinaryCompareOp(javascript_.StrictEqual(CompareOperationHint::kAny),
...@@ -364,7 +358,6 @@ TEST_F(TyperTest, TypeJSStrictEqual) { ...@@ -364,7 +358,6 @@ TEST_F(TyperTest, TypeJSStrictEqual) {
TestBinaryMonotonicity(javascript_.name(CompareOperationHint::kAny)); \ TestBinaryMonotonicity(javascript_.name(CompareOperationHint::kAny)); \
} }
TEST_BINARY_MONOTONICITY(Equal) TEST_BINARY_MONOTONICITY(Equal)
TEST_BINARY_MONOTONICITY(NotEqual)
TEST_BINARY_MONOTONICITY(StrictEqual) TEST_BINARY_MONOTONICITY(StrictEqual)
TEST_BINARY_MONOTONICITY(LessThan) TEST_BINARY_MONOTONICITY(LessThan)
TEST_BINARY_MONOTONICITY(GreaterThan) TEST_BINARY_MONOTONICITY(GreaterThan)
......
...@@ -49,7 +49,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { ...@@ -49,7 +49,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
builder.LoadLiteral(Smi::kZero) builder.LoadLiteral(Smi::kZero)
.StoreAccumulatorInRegister(reg) .StoreAccumulatorInRegister(reg)
.LoadLiteral(Smi::FromInt(8)) .LoadLiteral(Smi::FromInt(8))
.CompareOperation(Token::Value::NE, reg, .CompareOperation(Token::Value::EQ, reg,
1) // Prevent peephole optimization 1) // Prevent peephole optimization
// LdaSmi, Star -> LdrSmi. // LdaSmi, Star -> LdrSmi.
.StoreAccumulatorInRegister(reg) .StoreAccumulatorInRegister(reg)
...@@ -201,14 +201,13 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { ...@@ -201,14 +201,13 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
// Emit test operator invocations. // Emit test operator invocations.
builder.CompareOperation(Token::Value::EQ, reg, 1) builder.CompareOperation(Token::Value::EQ, reg, 1)
.CompareOperation(Token::Value::NE, reg, 2) .CompareOperation(Token::Value::EQ_STRICT, reg, 2)
.CompareOperation(Token::Value::EQ_STRICT, reg, 3) .CompareOperation(Token::Value::LT, reg, 3)
.CompareOperation(Token::Value::LT, reg, 4) .CompareOperation(Token::Value::GT, reg, 4)
.CompareOperation(Token::Value::GT, reg, 5) .CompareOperation(Token::Value::LTE, reg, 5)
.CompareOperation(Token::Value::LTE, reg, 6) .CompareOperation(Token::Value::GTE, reg, 6)
.CompareOperation(Token::Value::GTE, reg, 7) .CompareOperation(Token::Value::INSTANCEOF, reg, 7)
.CompareOperation(Token::Value::INSTANCEOF, reg, 8) .CompareOperation(Token::Value::IN, reg, 8);
.CompareOperation(Token::Value::IN, reg, 9);
// Emit peephole optimizations of equality with Null or Undefined. // Emit peephole optimizations of equality with Null or Undefined.
builder.LoadUndefined() builder.LoadUndefined()
......
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