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