Bug 1395927 - Part 4: Inline IsRegExpObject when called with MIRType::Value. r=jandem
authorAndré Bargull <andre.bargull@gmail.com>
Fri, 08 Sep 2017 16:41:07 +0200
changeset 429419 a3a57ed979fa3800c23824a198a804be305d7b7e
parent 429418 d84c57174485f540cd0d86e7dc449c47e92800c6
child 429420 0998107850f7973d1667e1c924a196decdbd7435
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1395927
milestone57.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 1395927 - Part 4: Inline IsRegExpObject when called with MIRType::Value. r=jandem
js/src/jit/MCallOptimize.cpp
js/src/jit/MIR.h
--- a/js/src/jit/MCallOptimize.cpp
+++ b/js/src/jit/MCallOptimize.cpp
@@ -2197,31 +2197,30 @@ IonBuilder::inlineIsRegExpObject(CallInf
 
     if (getInlineReturnType() != MIRType::Boolean)
         return InliningStatus_NotInlined;
 
     MDefinition* arg = callInfo.getArg(0);
 
     bool isRegExpObjectKnown = false;
     bool isRegExpObjectConstant;
-    if (!arg->mightBeType(MIRType::Object)) {
-        // NB: This case only happens when Phi-nodes flow into IsRegExpObject.
-        // IsRegExpObject itself will never be called with a non-Object value.
-        isRegExpObjectConstant = false;
-        isRegExpObjectKnown = true;
-    } else {
-        if (arg->type() != MIRType::Object)
-            return InliningStatus_NotInlined;
-
+    if (arg->type() == MIRType::Object) {
         TemporaryTypeSet* types = arg->resultTypeSet();
         const Class* clasp = types ? types->getKnownClass(constraints()) : nullptr;
         if (clasp) {
+            isRegExpObjectKnown = true;
             isRegExpObjectConstant = (clasp == &RegExpObject::class_);
-            isRegExpObjectKnown = true;
         }
+    } else if (!arg->mightBeType(MIRType::Object)) {
+        // NB: This case only happens when Phi-nodes flow into IsRegExpObject.
+        // IsRegExpObject itself will never be called with a non-Object value.
+        isRegExpObjectKnown = true;
+        isRegExpObjectConstant = false;
+    } else if (arg->type() != MIRType::Value) {
+        return InliningStatus_NotInlined;
     }
 
     if (isRegExpObjectKnown) {
         pushConstant(BooleanValue(isRegExpObjectConstant));
     } else {
         MHasClass* hasClass = MHasClass::New(alloc(), arg, &RegExpObject::class_);
         current->add(hasClass);
         current->push(hasClass);
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -13639,17 +13639,18 @@ class MHasClass
       public SingleObjectPolicy::Data
 {
     const Class* class_;
 
     MHasClass(MDefinition* object, const Class* clasp)
       : MUnaryInstruction(classOpcode, object)
       , class_(clasp)
     {
-        MOZ_ASSERT(object->type() == MIRType::Object);
+        MOZ_ASSERT(object->type() == MIRType::Object ||
+                   (object->type() == MIRType::Value && object->mightBeType(MIRType::Object)));
         setResultType(MIRType::Boolean);
         setMovable();
     }
 
   public:
     INSTRUCTION_HEADER(HasClass)
     TRIVIAL_NEW_WRAPPERS
     NAMED_OPERANDS((0, object))