Commit e0fa8758 authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Use reference equal to zero instead of a smi check.

In typed lowering we can use the ReferenceEqual simplified operator
instead of ObjectIsSmi to check for context extensions. This generates
the desired code.

R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/1163963003

Cr-Commit-Position: refs/heads/master@{#28776}
parent ca806a38
......@@ -942,7 +942,8 @@ Reduction JSTypedLowering::ReduceJSLoadDynamicGlobal(Node* node) {
Node* load = graph()->NewNode(
javascript()->LoadContext(depth, Context::EXTENSION_INDEX, false),
context, context, effect);
Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), load);
Node* check = graph()->NewNode(simplified()->ReferenceEqual(Type::Tagged()),
load, jsgraph()->ZeroConstant());
Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), check,
check_true);
Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
......
......@@ -918,12 +918,16 @@ TEST_F(JSTypedLoweringTest, JSLoadDynamicGlobal) {
EXPECT_THAT(
r.replacement(),
IsPhi(kMachAnyTagged, _, _,
IsMerge(IsIfTrue(IsBranch(
IsObjectIsSmi(IsLoadContext(
IsMerge(
IsIfTrue(IsBranch(
IsReferenceEqual(
Type::Tagged(),
IsLoadContext(
ContextAccess(i, Context::EXTENSION_INDEX, false),
context)),
control)),
_)));
context),
IsNumberConstant(BitEq(0.0))),
control)),
_)));
}
}
......
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