Bug 1655465 - Part 9: Avoid MToString on string-typed inputs in Warp. r=jandem
☠☠ backed out by 801b59414882 ☠ ☠
authorAndré Bargull <andre.bargull@gmail.com>
Fri, 31 Jul 2020 14:07:58 +0000
changeset 542941 5ead4048955fa24b83dc4a6f407d1db9ebd886f2
parent 542940 8b030b7d13aba732ad792cacb17a4dbee294fd9a
child 542942 a5491d62d560707214291f1cef2f157a602f6a17
push id37657
push usernerli@mozilla.com
push dateSat, 01 Aug 2020 09:48:10 +0000
treeherdermozilla-central@750bc4c5c4ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1655465
milestone81.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1655465 - Part 9: Avoid MToString on string-typed inputs in Warp. r=jandem Warp can't currently fold away `MToString`, as a workaround handle the already string case in WarpBuilder. Differential Revision: https://phabricator.services.mozilla.com/D84988
js/src/jit/WarpBuilder.cpp
--- a/js/src/jit/WarpBuilder.cpp
+++ b/js/src/jit/WarpBuilder.cpp
@@ -1499,16 +1499,25 @@ bool WarpBuilder::build_Not(BytecodeLoca
   MNot* ins = MNot::New(alloc(), value, /* constraints = */ nullptr);
   current->add(ins);
   current->push(ins);
   return true;
 }
 
 bool WarpBuilder::build_ToString(BytecodeLocation loc) {
   MDefinition* value = current->pop();
+
+  // TODO: Consider making MToString non-effectul similar to Ion. That way GVN
+  // will be able to fold away MToString(string) automatically. For now simply
+  // handle this case here.
+  if (value->type() == MIRType::String) {
+    current->push(value);
+    return true;
+  }
+
   MToString* ins =
       MToString::New(alloc(), value, MToString::SideEffectHandling::Supported);
   current->add(ins);
   current->push(ins);
   MOZ_ASSERT(ins->isEffectful());
   return resumeAfter(ins, loc);
 }