[turbofan] Only symbols can be strictly equal to symbols.
For strict equality `a === b` with Symbol feedback we need to check only one side via CheckSymbol, since the resulting comparison can only be true if both sides are symbols. For consistency with the receivers case we check the left side, so CheckSymbol(a). This significantly reduces the number of CheckSymbol operations in optimized code for the ARES-6 Air benchmark. Bug: v8:6344 Change-Id: I50420f8d862fec31214b7e86b17919edcfc1f23e Reviewed-on: https://chromium-review.googlesource.com/1213173 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Commit-Queue: Georg Neis <neis@chromium.org> Reviewed-by: Georg Neis <neis@chromium.org> Cr-Commit-Position: refs/heads/master@{#55731}
This commit is contained in:
parent
c3dce78c1f
commit
c2a3d24b24
@ -137,15 +137,20 @@ class JSBinopReduction final {
|
||||
}
|
||||
}
|
||||
|
||||
// Inserts a CheckSymbol for the left input.
|
||||
void CheckLeftInputToSymbol() {
|
||||
Node* left_input = graph()->NewNode(simplified()->CheckSymbol(), left(),
|
||||
effect(), control());
|
||||
node_->ReplaceInput(0, left_input);
|
||||
update_effect(left_input);
|
||||
}
|
||||
|
||||
// Checks that both inputs are Symbol, and if we don't know
|
||||
// statically that one side is already a Symbol, insert a
|
||||
// CheckSymbol node.
|
||||
void CheckInputsToSymbol() {
|
||||
if (!left_type().Is(Type::Symbol())) {
|
||||
Node* left_input = graph()->NewNode(simplified()->CheckSymbol(), left(),
|
||||
effect(), control());
|
||||
node_->ReplaceInput(0, left_input);
|
||||
update_effect(left_input);
|
||||
CheckLeftInputToSymbol();
|
||||
}
|
||||
if (!right_type().Is(Type::Symbol())) {
|
||||
Node* right_input = graph()->NewNode(simplified()->CheckSymbol(), right(),
|
||||
@ -871,14 +876,17 @@ Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node) {
|
||||
} 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.
|
||||
// both sides refer to the same Receiver.
|
||||
r.CheckLeftInputToReceiver();
|
||||
return r.ChangeToPureOperator(simplified()->ReferenceEqual());
|
||||
} else if (r.IsStringCompareOperation()) {
|
||||
r.CheckInputsToString();
|
||||
return r.ChangeToPureOperator(simplified()->StringEqual());
|
||||
} else if (r.IsSymbolCompareOperation()) {
|
||||
r.CheckInputsToSymbol();
|
||||
// For strict equality, it's enough to know that one input is a Symbol,
|
||||
// as a strict equality comparison with a Symbol can only yield true if
|
||||
// both sides refer to the same Symbol.
|
||||
r.CheckLeftInputToSymbol();
|
||||
return r.ChangeToPureOperator(simplified()->ReferenceEqual());
|
||||
}
|
||||
return NoChange();
|
||||
|
Loading…
Reference in New Issue
Block a user