Reviewers: Michael Starzinger,

Description:
[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.

[email protected]

Please review this at https://codereview.chromium.org/1163963003/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+11, -6 lines):
  M src/compiler/js-typed-lowering.cc
  M test/unittests/compiler/js-typed-lowering-unittest.cc


Index: src/compiler/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc index fb59ce06192cf33d5d8ca69c668defd2824cd333..0f6f38cb0f38f120163956faf008373631c0b6d1 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -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);
Index: test/unittests/compiler/js-typed-lowering-unittest.cc
diff --git a/test/unittests/compiler/js-typed-lowering-unittest.cc b/test/unittests/compiler/js-typed-lowering-unittest.cc index 2cc48e797dbbc2ea4ce7ec1089ef3f69e9488733..db62a119f2be4b699b42a12a852797c892a12972 100644
--- a/test/unittests/compiler/js-typed-lowering-unittest.cc
+++ b/test/unittests/compiler/js-typed-lowering-unittest.cc
@@ -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)),
+                  _)));
   }
 }



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to