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

Unified Diff: src/compiler/typed-optimization.cc

Issue 2666543002: [turbofan] Optimize ReferenceEqual based on input types. (Closed)
Patch Set: 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
« no previous file with comments | « src/compiler/typed-optimization.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/typed-optimization.cc
diff --git a/src/compiler/typed-optimization.cc b/src/compiler/typed-optimization.cc
index 8149a1bee4492903d33cacaffe62ad098e633db9..e130a10e4eb8e196e9b153d7c52f5f0792b534b6 100644
--- a/src/compiler/typed-optimization.cc
+++ b/src/compiler/typed-optimization.cc
@@ -92,6 +92,8 @@ Reduction TypedOptimization::Reduce(Node* node) {
return ReduceNumberToUint8Clamped(node);
case IrOpcode::kPhi:
return ReducePhi(node);
+ case IrOpcode::kReferenceEqual:
+ return ReduceReferenceEqual(node);
case IrOpcode::kSelect:
return ReduceSelect(node);
default:
@@ -258,6 +260,18 @@ Reduction TypedOptimization::ReducePhi(Node* node) {
return NoChange();
}
+Reduction TypedOptimization::ReduceReferenceEqual(Node* node) {
+ DCHECK_EQ(IrOpcode::kReferenceEqual, node->opcode());
+ Node* const lhs = NodeProperties::GetValueInput(node, 0);
+ Node* const rhs = NodeProperties::GetValueInput(node, 1);
+ Type* const lhs_type = NodeProperties::GetType(lhs);
+ Type* const rhs_type = NodeProperties::GetType(rhs);
+ if (!lhs_type->Maybe(rhs_type)) {
+ return Replace(jsgraph()->FalseConstant());
+ }
+ return NoChange();
+}
+
Reduction TypedOptimization::ReduceSelect(Node* node) {
DCHECK_EQ(IrOpcode::kSelect, node->opcode());
Node* const condition = NodeProperties::GetValueInput(node, 0);
« no previous file with comments | « src/compiler/typed-optimization.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698