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); |
} |