Bug 1658279 - Part 3: Don't create a template object for String when not constructing. r=jandem
☠☠ backed out by 06e4f8547d78 ☠ ☠
authorAndré Bargull <andre.bargull@gmail.com>
Thu, 13 Aug 2020 09:28:52 +0000
changeset 544509 728d9864385864dece4c4f6beaa3375ccd357606
parent 544508 761efef13026f4d6e1d873c515bea9efad5e33e8
child 544510 f9f7ff74b5b8ffff192b0b8f015cdbce1fa8d3a6
push id124078
push userrmaries@mozilla.com
push dateThu, 13 Aug 2020 09:48:10 +0000
treeherderautoland@728d98643858 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1658279
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 1658279 - Part 3: Don't create a template object for String when not constructing. r=jandem Calling `String()` shouldn't create a template object. Differential Revision: https://phabricator.services.mozilla.com/D86534
js/src/jit/CacheIR.cpp
--- a/js/src/jit/CacheIR.cpp
+++ b/js/src/jit/CacheIR.cpp
@@ -8805,16 +8805,18 @@ bool CallIRGenerator::getTemplateObjectF
     return true;
   }
 
   if (!calleeFunc->hasJitInfo() ||
       calleeFunc->jitInfo()->type() != JSJitInfo::InlinableNative) {
     return true;
   }
 
+  bool isConstructing = IsConstructOp(op_);
+
   // Check for natives to which template objects can be attached. This is
   // done to provide templates to Ion for inlining these natives later on.
   switch (calleeFunc->jitInfo()->inlinableNative) {
     case InlinableNative::Array: {
       // Note: the template array won't be used if its length is inaccurately
       // computed here.  (We allocate here because compilation may occur on a
       // separate thread where allocation is impossible.)
 
@@ -8856,16 +8858,20 @@ bool CallIRGenerator::getTemplateObjectF
         return true;
       }
 
       res.set(NewFullyAllocatedArrayTryReuseGroup(cx_, obj, 0, TenuredObject));
       return !!res;
     }
 
     case InlinableNative::String: {
+      if (!isConstructing) {
+        return true;
+      }
+
       RootedString emptyString(cx_, cx_->runtime()->emptyString);
       res.set(StringObject::create(cx_, emptyString, /* proto = */ nullptr,
                                    TenuredObject));
       return !!res;
     }
 
     default:
       return true;