Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Unified Diff: src/compiler/effect-control-linearizer.cc

Issue 2646763003: [turbofan] Optimize typeof o === "object" checks. (Closed)
Patch Set: Address comment. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/compiler/effect-control-linearizer.cc
diff --git a/src/compiler/effect-control-linearizer.cc b/src/compiler/effect-control-linearizer.cc
index 5be185236c7d3ef13fc4163918919352ddc8a609..1c882517970b89d03d8bf4a4e2fd978b2dc8705b 100644
--- a/src/compiler/effect-control-linearizer.cc
+++ b/src/compiler/effect-control-linearizer.cc
@@ -717,6 +717,9 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node,
case IrOpcode::kObjectIsCallable:
result = LowerObjectIsCallable(node);
break;
+ case IrOpcode::kObjectIsNonCallable:
+ result = LowerObjectIsNonCallable(node);
+ break;
case IrOpcode::kObjectIsNumber:
result = LowerObjectIsNumber(node);
break;
@@ -1688,6 +1691,37 @@ Node* EffectControlLinearizer::LowerObjectIsCallable(Node* node) {
return done.PhiAt(0);
}
+Node* EffectControlLinearizer::LowerObjectIsNonCallable(Node* node) {
+ Node* value = node->InputAt(0);
+
+ auto if_primitive = __ MakeDeferredLabel<2>();
+ auto done = __ MakeLabel<2>(MachineRepresentation::kBit);
+
+ Node* check0 = ObjectIsSmi(value);
+ __ GotoIf(check0, &if_primitive);
+
+ Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
+ Node* value_instance_type =
+ __ LoadField(AccessBuilder::ForMapInstanceType(), value_map);
+ STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE);
+ Node* check1 = __ Uint32LessThanOrEqual(
+ __ Uint32Constant(FIRST_JS_RECEIVER_TYPE), value_instance_type);
+ __ GotoUnless(check1, &if_primitive);
+
+ Node* value_bit_field =
+ __ LoadField(AccessBuilder::ForMapBitField(), value_map);
+ Node* check2 = __ Word32Equal(
+ __ Int32Constant(0),
+ __ Word32And(value_bit_field, __ Int32Constant(1 << Map::kIsCallable)));
+ __ Goto(&done, check2);
+
+ __ Bind(&if_primitive);
+ __ Goto(&done, __ Int32Constant(0));
+
+ __ Bind(&done);
+ return done.PhiAt(0);
+}
+
Node* EffectControlLinearizer::LowerObjectIsNumber(Node* node) {
Node* value = node->InputAt(0);

Powered by Google App Engine
This is Rietveld 408576698