Bug 1533890: Create template objects for native constructors called without "new" r=mgaudet
authorIain Ireland <iireland@mozilla.com>
Wed, 01 May 2019 20:13:07 +0000
changeset 531356 2ee2a6c2095d3dd7e56a87f44742cb2f63c950b9
parent 531355 274e684c7979b29f1df7a5232248daa05643f714
child 531357 5d03ed4eeeb06b1bd28306e47ec0b0327690de25
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmgaudet
bugs1533890
milestone68.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 1533890: Create template objects for native constructors called without "new" r=mgaudet Some native functions (for example, the Array constructor) have constructor-like behaviour even when called in a non-constructing context. We still want to create template objects for these cases. This fixes a noticeable regression in Speedometer (particularly in EmberJS-debug). Depends on D29533 Differential Revision: https://phabricator.services.mozilla.com/D29534
js/src/jit/CacheIR.cpp
--- a/js/src/jit/CacheIR.cpp
+++ b/js/src/jit/CacheIR.cpp
@@ -5275,18 +5275,17 @@ AttachDecision CallIRGenerator::tryAttac
   if (isSpecialized) {
     TRY_ATTACH(tryAttachSpecialCaseCallNative(calleeFunc));
   }
   if (JitOptions.disableCacheIRCalls) {
     return AttachDecision::NoAction;
   }
 
   RootedObject templateObj(cx_);
-  if (isConstructing && isSpecialized &&
-      !getTemplateObjectForNative(calleeFunc, &templateObj)) {
+  if (isSpecialized && !getTemplateObjectForNative(calleeFunc, &templateObj)) {
     cx_->clearPendingException();
     return AttachDecision::NoAction;
   }
 
   // Load argc.
   Int32OperandId argcId(writer.setInputOperandId(0));
 
   // Load the callee and ensure it is an object