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

Unified Diff: src/compiler/js-typed-lowering.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/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
index ab1c6d037909c93e750cf092d0d14d97e7bd7914..4584be6edcdcfc9b1c2934418760763a5bedc63d 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -903,6 +903,13 @@ Reduction JSTypedLowering::ReduceJSEqualTypeOf(Node* node, bool invert) {
value = graph()->NewNode(simplified()->ObjectIsCallable(), input);
} else if (String::Equals(type, factory()->number_string())) {
value = graph()->NewNode(simplified()->ObjectIsNumber(), input);
+ } else if (String::Equals(type, factory()->object_string())) {
+ value = graph()->NewNode(
+ common()->Select(MachineRepresentation::kTagged),
+ graph()->NewNode(simplified()->ObjectIsNonCallable(), input),
+ jsgraph()->TrueConstant(),
+ graph()->NewNode(simplified()->ReferenceEqual(), input,
+ jsgraph()->NullConstant()));
} else if (String::Equals(type, factory()->string_string())) {
value = graph()->NewNode(simplified()->ObjectIsString(), input);
} else if (String::Equals(type, factory()->undefined_string())) {

Powered by Google App Engine
This is Rietveld 408576698