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

Unified Diff: src/compiler/js-intrinsic-lowering.cc

Issue 2756463002: [Turbofan] Intrinsic lowering of ToString(<str>) should provide <str> (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-intrinsic-lowering.cc
diff --git a/src/compiler/js-intrinsic-lowering.cc b/src/compiler/js-intrinsic-lowering.cc
index a6f9850d6824e602d9a69a933aaed3a31a71e693..954eaad18e66d301804ceebf393e54f1986aab6e 100644
--- a/src/compiler/js-intrinsic-lowering.cc
+++ b/src/compiler/js-intrinsic-lowering.cc
@@ -298,6 +298,12 @@ Reduction JSIntrinsicLowering::ReduceToObject(Node* node) {
Reduction JSIntrinsicLowering::ReduceToString(Node* node) {
+ // ToString is unnecessary if the input is a string.
+ HeapObjectMatcher m(NodeProperties::GetValueInput(node, 0));
+ if (m.HasValue() && m.Value()->IsString()) {
+ ReplaceWithValue(node, m.node());
+ return Replace(m.node());
+ }
NodeProperties::ChangeOp(node, javascript()->ToString());
return Changed(node);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698