Просмотр исходного кода

move GenerateFastIsInst to MI Lowerer

Matt Gardner 8 лет назад
Родитель
Сommit
9428936446

+ 135 - 1
lib/Backend/Lower.cpp

@@ -1529,7 +1529,7 @@ Lowerer::LowerRange(IR::Instr *instrStart, IR::Instr *instrEnd, bool defaultDoFa
             break;
 
         case Js::OpCode::IsInst:
-            m_lowererMD.GenerateFastIsInst(instr);
+            this->GenerateFastIsInst(instr);
             instrPrev = this->LowerIsInst(instr, IR::HelperScrObj_OP_IsInst);
             break;
 
@@ -20975,6 +20975,140 @@ Lowerer::GenerateLdThisStrict(IR::Instr* instr)
     return true;
 }
 
+// given object instanceof function, functionReg is a register with function,
+// objectReg is a register with instance and inlineCache is an InstIsInlineCache.
+// We want to generate:
+//
+// fallback on helper (will patch the inline cache) if function does not match the cache
+// MOV dst, Js::false
+// CMP functionReg, [&(inlineCache->function)]
+// JNE helper
+//
+// fallback if object is a tagged int
+// TEST objectReg, Js::AtomTag
+// JNE done
+//
+
+// return false if object is a primitive
+// CMP [typeReg + offsetof(Type::typeid)], TypeIds_LastJavascriptPrimitiveType
+// JLE done
+
+// fallback if object's type is not the cached type
+// MOV typeReg, objectSrc + offsetof(RecyclableObject::type)
+// CMP typeReg, [&(inlineCache->type]
+// JNE checkPrimType
+
+// use the cached result and fallthrough
+// MOV dst, [&(inlineCache->result)]
+// JMP done
+
+//
+//
+// $helper
+// $done
+bool
+Lowerer::GenerateFastIsInst(IR::Instr * instr)
+{
+    IR::LabelInstr * helper = IR::LabelInstr::New(Js::OpCode::Label, m_func, true);
+    IR::LabelInstr * done = IR::LabelInstr::New(Js::OpCode::Label, m_func);
+    IR::RegOpnd * typeReg = IR::RegOpnd::New(TyMachReg, this->m_func);
+    IR::Opnd * objectSrc;
+    IR::RegOpnd * objectReg;
+    IR::Opnd * functionSrc;
+    IR::RegOpnd * functionReg;
+    intptr_t inlineCache;
+    IR::Instr * instrArg;
+
+    // We are going to use the extra ArgOut_A instructions to lower the helper call later,
+    // so we leave them alone here and clean them up then.
+    inlineCache = instr->m_func->GetJITFunctionBody()->GetIsInstInlineCache(instr->GetSrc1()->AsIntConstOpnd()->AsUint32());
+    Assert(instr->GetSrc2()->AsRegOpnd()->m_sym->m_isSingleDef);
+    instrArg = instr->GetSrc2()->AsRegOpnd()->m_sym->m_instrDef;
+
+    objectSrc = instrArg->GetSrc1();
+    Assert(instrArg->GetSrc2()->AsRegOpnd()->m_sym->m_isSingleDef);
+    instrArg = instrArg->GetSrc2()->AsRegOpnd()->m_sym->m_instrDef;
+
+    functionSrc = instrArg->GetSrc1();
+    Assert(instrArg->GetSrc2() == nullptr);
+
+    // MOV dst, Js::false
+    InsertMove(instr->GetDst(), LoadLibraryValueOpnd(instr, LibraryValue::ValueFalse), instr);
+
+    if (functionSrc->IsRegOpnd())
+    {
+        functionReg = functionSrc->AsRegOpnd();
+    }
+    else
+    {
+        functionReg = IR::RegOpnd::New(TyMachReg, this->m_func);
+        // MOV functionReg, functionSrc
+        InsertMove(functionReg, functionSrc, instr);
+    }
+
+    // CMP functionReg, [&(inlineCache->function)]
+    {
+        IR::Opnd* cacheFunction = IR::MemRefOpnd::New(inlineCache + Js::IsInstInlineCache::OffsetOfFunction(), TyMachReg, m_func, IR::AddrOpndKindDynamicIsInstInlineCacheFunctionRef);
+        InsertCompare(functionReg, cacheFunction, instr);
+    }
+
+    // JNE helper
+    InsertBranch(Js::OpCode::BrNeq_A, helper, instr);
+
+    if (objectSrc->IsRegOpnd())
+    {
+        objectReg = objectSrc->AsRegOpnd();
+    }
+    else
+    {
+        objectReg = IR::RegOpnd::New(TyMachReg, this->m_func);
+        // MOV objectReg, objectSrc
+        InsertMove(objectReg, objectSrc, instr);
+    }
+
+    // TEST objectReg, Js::AtomTag
+    // JNE done
+    m_lowererMD.GenerateObjectTest(objectReg, instr, done);
+
+    // MOV typeReg, objectSrc + offsetof(RecyclableObject::type)
+    InsertMove(typeReg, IR::IndirOpnd::New(objectReg, Js::RecyclableObject::GetOffsetOfType(), TyMachReg, m_func), instr);
+
+    // CMP [typeReg + offsetof(Type::typeid)], TypeIds_LastJavascriptPrimitiveType
+    {
+        IR::IndirOpnd * typeId = IR::IndirOpnd::New(typeReg, Js::Type::GetOffsetOfTypeId(), TyInt32, m_func);
+        IR::IntConstOpnd * lastPrimitive = IR::IntConstOpnd::New(Js::TypeId::TypeIds_LastJavascriptPrimitiveType, TyInt32, m_func);
+        InsertCompare(typeId, lastPrimitive, instr);
+    }
+
+    // JLE done
+    InsertBranch(Js::OpCode::BrLe_A, done, instr);
+
+    // CMP typeReg, [&(inlineCache->type]
+    {
+        IR::Opnd * cacheType = IR::MemRefOpnd::New(inlineCache + Js::IsInstInlineCache::OffsetOfType(), TyMachReg, m_func, IR::AddrOpndKindDynamicIsInstInlineCacheTypeRef);
+        InsertCompare(typeReg, cacheType, instr);
+    }
+
+    // JNE helper
+    InsertBranch(Js::OpCode::BrNeq_A, helper, instr);
+
+    // MOV dst, [&(inlineCache->result)]
+    {
+        IR::Opnd * cacheResult = IR::MemRefOpnd::New(inlineCache + Js::IsInstInlineCache::OffsetOfResult(), TyMachReg, m_func, IR::AddrOpndKindDynamicIsInstInlineCacheResultRef);
+        InsertMove(instr->GetDst(), cacheResult, instr);
+    }
+
+    // JMP done
+    InsertBranch(Js::OpCode::Br, done, instr);
+
+    // LABEL helper
+    instr->InsertBefore(helper);
+
+    instr->InsertAfter(done);
+
+    return true;
+}
+
 void Lowerer::GenerateBooleanNegate(IR::Instr * instr, IR::Opnd * srcBool, IR::Opnd * dst)
 {
     // dst = src

+ 1 - 2
lib/Backend/Lower.h

@@ -156,8 +156,7 @@ private:
     void            GenerateIsRecyclableObject(IR::RegOpnd *regOpnd, IR::Instr *insertInstr, IR::LabelInstr *labelHelper, bool checkObjectAndDynamicObject = true);
     bool            GenerateLdThisCheck(IR::Instr * instr);
     bool            GenerateLdThisStrict(IR::Instr * instr);
-
-
+    bool            GenerateFastIsInst(IR::Instr * instr);
 
     void            EnsureStackFunctionListStackSym();
     void            EnsureZeroLastStackFunctionNext();

+ 0 - 147
lib/Backend/LowerMDShared.cpp

@@ -7637,153 +7637,6 @@ bool LowererMD::GenerateFastShiftRight(IR::Instr * instrShift)
     return this->lowererMDArch.GenerateFastShiftRight(instrShift);
 }
 
-// given object instanceof function, functionReg is a register with function,
-// objectReg is a register with instance and inlineCache is an InstIsInlineCache.
-// We want to generate:
-//
-// fallback on helper (will patch the inline cache) if function does not match the cache
-// MOV dst, Js::false
-// CMP functionReg, [&(inlineCache->function)]
-// JNE helper
-//
-// fallback if object is a tagged int
-// TEST objectReg, Js::AtomTag
-// JNE done
-//
-
-// fallback if object's type is not the cached type
-// MOV typeReg, objectSrc + offsetof(RecyclableObject::type)
-// CMP typeReg, [&(inlineCache->type]
-// JNE checkPrimType
-
-// use the cached result and fallthrough
-// MOV dst, [&(inlineCache->result)]
-// JMP done
-
-// return false if object is a primitive
-// $checkPrimType
-// CMP [typeReg + offsetof(Type::typeid)], TypeIds_LastJavascriptPrimitiveType
-// JLE done
-//
-//
-// $helper
-// $done
-bool
-LowererMD::GenerateFastIsInst(IR::Instr * instr)
-{
-    IR::LabelInstr * helper = IR::LabelInstr::New(Js::OpCode::Label, m_func, true);
-    IR::LabelInstr * checkPrimType = IR::LabelInstr::New(Js::OpCode::Label, m_func, true);
-    IR::LabelInstr * done = IR::LabelInstr::New(Js::OpCode::Label, m_func);
-    IR::RegOpnd * typeReg = IR::RegOpnd::New(TyMachReg, this->m_func);
-    IR::Opnd * objectSrc;
-    IR::RegOpnd * objectReg;
-    IR::Opnd * functionSrc;
-    IR::RegOpnd * functionReg;
-    intptr_t inlineCache;
-    IR::Instr * instrArg;
-
-    // We are going to use the extra ArgOut_A instructions to lower the helper call later,
-    // so we leave them alone here and clean them up then.
-    inlineCache = instr->m_func->GetJITFunctionBody()->GetIsInstInlineCache(instr->GetSrc1()->AsIntConstOpnd()->AsUint32());
-    Assert(instr->GetSrc2()->AsRegOpnd()->m_sym->m_isSingleDef);
-    instrArg = instr->GetSrc2()->AsRegOpnd()->m_sym->m_instrDef;
-
-    objectSrc = instrArg->GetSrc1();
-    Assert(instrArg->GetSrc2()->AsRegOpnd()->m_sym->m_isSingleDef);
-    instrArg = instrArg->GetSrc2()->AsRegOpnd()->m_sym->m_instrDef;
-
-    functionSrc = instrArg->GetSrc1();
-    Assert(instrArg->GetSrc2() == nullptr);
-
-    // MOV dst, Js::false
-    Lowerer::InsertMove(instr->GetDst(), m_lowerer->LoadLibraryValueOpnd(instr, LibraryValue::ValueFalse), instr);
-
-    if (functionSrc->IsRegOpnd())
-    {
-        functionReg = functionSrc->AsRegOpnd();
-    }
-    else
-    {
-        functionReg = IR::RegOpnd::New(TyMachReg, this->m_func);
-        // MOV functionReg, functionSrc
-        instr->InsertBefore(IR::Instr::New(Js::OpCode::MOV, functionReg, functionSrc, m_func));
-    }
-
-    // CMP functionReg, [&(inlineCache->function)]
-    {
-        IR::Instr * cmp = IR::Instr::New(Js::OpCode::CMP, m_func);
-        cmp->SetSrc1(functionReg);
-        cmp->SetSrc2(IR::MemRefOpnd::New(inlineCache + Js::IsInstInlineCache::OffsetOfFunction(), TyMachReg, m_func,
-            IR::AddrOpndKindDynamicIsInstInlineCacheFunctionRef));
-        instr->InsertBefore(cmp);
-        Legalize(cmp);
-    }
-
-    // JNE helper
-    instr->InsertBefore(IR::BranchInstr::New(Js::OpCode::JNE, helper, m_func));
-
-    if (objectSrc->IsRegOpnd())
-    {
-        objectReg = objectSrc->AsRegOpnd();
-    }
-    else
-    {
-        objectReg = IR::RegOpnd::New(TyMachReg, this->m_func);
-        // MOV objectReg, objectSrc
-        instr->InsertBefore(IR::Instr::New(Js::OpCode::MOV, objectReg, objectSrc, m_func));
-    }
-
-    // TEST objectReg, Js::AtomTag
-    // JNE done
-    GenerateObjectTest(objectReg, instr, done);
-
-    // MOV typeReg, objectSrc + offsetof(RecyclableObject::type)
-    instr->InsertBefore(IR::Instr::New(Js::OpCode::MOV, typeReg,
-        IR::IndirOpnd::New(objectReg, Js::RecyclableObject::GetOffsetOfType(), TyMachReg, m_func),
-        m_func));
-
-    // CMP typeReg, [&(inlineCache->type]
-    {
-        IR::Instr * cmp = IR::Instr::New(Js::OpCode::CMP, m_func);
-        cmp->SetSrc1(typeReg);
-        cmp->SetSrc2(IR::MemRefOpnd::New(inlineCache + Js::IsInstInlineCache::OffsetOfType(), TyMachReg, m_func,
-            IR::AddrOpndKindDynamicIsInstInlineCacheTypeRef));
-        instr->InsertBefore(cmp);
-        Legalize(cmp);
-    }
-
-    // JNE checkPrimType
-    instr->InsertBefore(IR::BranchInstr::New(Js::OpCode::JNE, checkPrimType, m_func));
-
-    // MOV dst, [&(inlineCache->result)]
-    Lowerer::InsertMove(instr->GetDst(), IR::MemRefOpnd::New(inlineCache + Js::IsInstInlineCache::OffsetOfResult(), TyMachReg, m_func,
-        IR::AddrOpndKindDynamicIsInstInlineCacheResultRef), instr);
-
-    // JMP done
-    instr->InsertBefore(IR::BranchInstr::New(Js::OpCode::JMP, done, m_func));
-
-    // LABEL checkPrimType
-    instr->InsertBefore(checkPrimType);
-
-    // CMP [typeReg + offsetof(Type::typeid)], TypeIds_LastJavascriptPrimitiveType
-    {
-        IR::Instr * cmp = IR::Instr::New(Js::OpCode::CMP, m_func);
-        cmp->SetSrc1(IR::IndirOpnd::New(typeReg, Js::Type::GetOffsetOfTypeId(), TyInt32, m_func));
-        cmp->SetSrc2(IR::IntConstOpnd::New(Js::TypeId::TypeIds_LastJavascriptPrimitiveType, TyInt32, m_func));
-        instr->InsertBefore(cmp);
-    }
-
-    // JLE done
-    instr->InsertBefore(IR::BranchInstr::New(Js::OpCode::JLE, done, m_func));
-
-    // LABEL helper
-    instr->InsertBefore(helper);
-
-    instr->InsertAfter(done);
-
-    return true;
-}
-
 void LowererMD::GenerateIsJsObjectTest(IR::RegOpnd* instanceReg, IR::Instr* insertInstr, IR::LabelInstr* labelHelper)
 {
     // TEST instanceReg, (Js::AtomTag_IntPtr | Js::FloatTag_Value )

+ 0 - 1
lib/Backend/LowerMDShared.h

@@ -234,7 +234,6 @@ public:
 
             Lowerer*        GetLowerer() { return m_lowerer; }
 
-            bool            GenerateFastIsInst(IR::Instr * instr);
             void            GenerateIsJsObjectTest(IR::RegOpnd* instanceReg, IR::Instr* insertInstr, IR::LabelInstr* labelHelper);
             void            LowerTypeof(IR::Instr * typeOfInstr);
 

+ 0 - 157
lib/Backend/arm/LowerMD.cpp

@@ -6564,163 +6564,6 @@ LowererMD::EnsureEpilogLabel()
     return labelInstr;
 }
 
-// given object instanceof function, functionReg is a register with function,
-// objectReg is a register with instance and inlineCache is an InstIsInlineCache.
-// We want to generate:
-//
-// fallback on helper (will patch the inline cache) if function does not match the cache
-// LDIMM dst, Js::false
-// LDR cache, [&(inlineCache->function)]
-// CMP functionReg, cache
-// BNE helper
-//
-// fallback if object is a tagged int
-// TST objectReg, Js::AtomTag
-// BNE done
-//
-// return false if object is a primitive
-// LDR typeReg, objectSrc + offsetof(RecyclableObject::type)
-// LDR typeID, [typeReg + offsetof(Type::typeid)]
-// CMP typeID, TypeIds_LastJavascriptPrimitiveType
-// BLE done
-//
-// fallback if object's type is not the cached type
-// CMP typeReg, [&(inlineCache->type]
-// BNE helper
-//
-// use the cached result and fallthrough
-// LDR dst, [&(inlineCache->result)]
-// B done
-//
-// $helper
-// $done
-bool
-LowererMD::GenerateFastIsInst(IR::Instr * instr)
-{
-    IR::LabelInstr * helper = IR::LabelInstr::New(Js::OpCode::Label, m_func, true);
-    IR::LabelInstr * done = IR::LabelInstr::New(Js::OpCode::Label, m_func);
-    IR::RegOpnd * typeReg = IR::RegOpnd::New(TyMachReg, this->m_func);
-    IR::Opnd * objectSrc;
-    IR::RegOpnd * objectReg;
-    IR::Opnd * functionSrc;
-    IR::RegOpnd * functionReg;
-    intptr_t inlineCache;
-    IR::Instr * instrArg;
-
-    // We are going to use the extra ArgOut_A instructions to lower the helper call later,
-    // so we leave them alone here and clean them up then.
-    inlineCache = instr->m_func->GetJITFunctionBody()->GetIsInstInlineCache(instr->GetSrc1()->AsIntConstOpnd()->GetValue());
-    Assert(instr->GetSrc2()->AsRegOpnd()->m_sym->m_isSingleDef);
-    instrArg = instr->GetSrc2()->AsRegOpnd()->m_sym->m_instrDef;
-
-    objectSrc = instrArg->GetSrc1();
-    Assert(instrArg->GetSrc2()->AsRegOpnd()->m_sym->m_isSingleDef);
-    instrArg = instrArg->GetSrc2()->AsRegOpnd()->m_sym->m_instrDef;
-
-    functionSrc = instrArg->GetSrc1();
-    Assert(instrArg->GetSrc2() == nullptr);
-
-    IR::Opnd* opndDst = instr->GetDst();
-    if (!opndDst->IsRegOpnd())
-    {
-        opndDst = IR::RegOpnd::New(opndDst->GetType(), this->m_func);
-    }
-
-    // LDR dst, Js::false
-    instr->InsertBefore(IR::Instr::New(Js::OpCode::LDR, opndDst,
-        m_lowerer->LoadLibraryValueOpnd(instr, LibraryValue::ValueFalse), m_func));
-
-    if (functionSrc->IsRegOpnd())
-    {
-        functionReg = functionSrc->AsRegOpnd();
-    }
-    else
-    {
-        functionReg = IR::RegOpnd::New(TyMachReg, this->m_func);
-        Lowerer::InsertMove(functionReg, functionSrc, instr);
-    }
-
-    // CMP functionReg, [&(inlineCache->function)]
-    {
-        IR::Instr * cmp = IR::Instr::New(Js::OpCode::CMP, m_func);
-        cmp->SetSrc1(functionReg);
-        cmp->SetSrc2(IR::MemRefOpnd::New(inlineCache + Js::IsInstInlineCache::OffsetOfFunction(), TyMachReg, m_func,
-            IR::AddrOpndKindDynamicIsInstInlineCacheFunctionRef));
-        instr->InsertBefore(cmp);
-        LegalizeMD::LegalizeInstr(cmp, false);
-    }
-
-    // BNE helper
-    instr->InsertBefore(IR::BranchInstr::New(Js::OpCode::BNE, helper, m_func));
-
-    if (objectSrc->IsRegOpnd())
-    {
-        objectReg = objectSrc->AsRegOpnd();
-    }
-    else
-    {
-        objectReg = IR::RegOpnd::New(TyMachReg, this->m_func);
-        Lowerer::InsertMove(objectReg, objectSrc, instr);
-    }
-
-    // TST objectReg, Js::AtomTag
-    // BNE done
-    if (!objectReg->m_sym->m_isNotInt)
-    {
-        GenerateObjectTest(objectReg, instr, done);
-    }
-
-    // LDR typeReg, objectSrc + offsetof(RecyclableObject::type)
-    instr->InsertBefore(IR::Instr::New(Js::OpCode::LDR, typeReg,
-        IR::IndirOpnd::New(objectReg, Js::RecyclableObject::GetOffsetOfType(), TyMachReg, m_func),
-        m_func));
-
-    // CMP [typeReg + offsetof(Type::typeid)], TypeIds_LastJavascriptPrimitiveType
-    {
-        IR::Instr * cmp = IR::Instr::New(Js::OpCode::CMP, m_func);
-        cmp->SetSrc1(IR::IndirOpnd::New(typeReg, Js::Type::GetOffsetOfTypeId(), TyInt32, m_func));
-        cmp->SetSrc2(IR::IntConstOpnd::New(Js::TypeId::TypeIds_LastJavascriptPrimitiveType, TyInt32, m_func));
-        instr->InsertBefore(cmp);
-        LegalizeMD::LegalizeInstr(cmp, false);
-    }
-
-    // BLE done
-    instr->InsertBefore(IR::BranchInstr::New(Js::OpCode::BLE, done, m_func));
-
-    // CMP typeReg, [&(inlineCache->type]
-    {
-        IR::Instr * cmp = IR::Instr::New(Js::OpCode::CMP, m_func);
-        cmp->SetSrc1(typeReg);
-        cmp->SetSrc2(IR::MemRefOpnd::New(inlineCache + Js::IsInstInlineCache::OffsetOfType(), TyMachReg, m_func));
-        instr->InsertBefore(cmp);
-        LegalizeMD::LegalizeInstr(cmp, false);
-    }
-
-    // BNE helper
-    instr->InsertBefore(IR::BranchInstr::New(Js::OpCode::BNE, helper, m_func));
-
-    // LDR dst, [&(inlineCache->result)]
-    IR::Instr *result = IR::Instr::New(Js::OpCode::LDR, opndDst,
-        IR::MemRefOpnd::New(inlineCache + Js::IsInstInlineCache::OffsetOfResult(), TyMachReg, m_func), m_func);
-    instr->InsertBefore(result);
-    LegalizeMD::LegalizeInstr(result, false);
-
-    if (opndDst != instr->GetDst())
-    {
-        Lowerer::InsertMove(instr->GetDst(), opndDst, instr);
-    }
-
-    // B done
-    instr->InsertBefore(IR::BranchInstr::New(Js::OpCode::B, done, m_func));
-
-    // LABEL helper
-    instr->InsertBefore(helper);
-
-    instr->InsertAfter(done);
-
-    return true;
-}
-
 // Helper method: inserts legalized assign for given srcOpnd into RegD0 in front of given instr in the following way:
 //   dstReg = InsertMove srcOpnd
 // Used to put args of inline built-in call into RegD0 and RegD1 before we call actual CRT function.

+ 0 - 2
lib/Backend/arm/LowerMD.h

@@ -152,10 +152,8 @@ public:
             IR::LabelInstr *GetBailOutStackRestoreLabel(BailOutInfo * bailOutInfo, IR::LabelInstr * exitTargetInstr);
             StackSym *      GetImplicitParamSlotSym(Js::ArgSlot argSlot);
      static StackSym *      GetImplicitParamSlotSym(Js::ArgSlot argSlot, Func * func);
-            bool            GenerateFastIsInst(IR::Instr * instr, Js::ScriptContext * scriptContext);
 
             IR::Instr *     LowerDivI4AndBailOnReminder(IR::Instr * instr, IR::LabelInstr * bailOutLabel);
-            bool            GenerateFastIsInst(IR::Instr * instr);
 public:
             IR::Instr *         LowerCall(IR::Instr * callInstr, Js::ArgSlot argCount);
             IR::Instr *         LowerCallI(IR::Instr * callInstr, ushort callFlags, bool isHelper = false, IR::Instr* insertBeforeInstrForCFG = nullptr);

+ 0 - 157
lib/Backend/arm64/LowerMD.cpp

@@ -6067,163 +6067,6 @@ LowererMD::EnsureEHEpilogLabel()
     return labelInstr;
 }
 
-// given object instanceof function, functionReg is a register with function,
-// objectReg is a register with instance and inlineCache is an InstIsInlineCache.
-// We want to generate:
-//
-// fallback on helper (will patch the inline cache) if function does not match the cache
-// LDIMM dst, Js::false
-// LDR cache, [&(inlineCache->function)]
-// CMP functionReg, cache
-// BNE helper
-//
-// fallback if object is a tagged int
-// TST objectReg, Js::AtomTag
-// BNE done
-//
-// return false if object is a primitive
-// LDR typeReg, objectSrc + offsetof(RecyclableObject::type)
-// LDR typeID, [typeReg + offsetof(Type::typeid)]
-// CMP typeID, TypeIds_LastJavascriptPrimitiveType
-// BLE done
-//
-// fallback if object's type is not the cached type
-// CMP typeReg, [&(inlineCache->type]
-// BNE helper
-//
-// use the cached result and fallthrough
-// LDR dst, [&(inlineCache->result)]
-// B done
-//
-// $helper
-// $done
-bool
-LowererMD::GenerateFastIsInst(IR::Instr * instr)
-{
-    IR::LabelInstr * helper = IR::LabelInstr::New(Js::OpCode::Label, m_func, true);
-    IR::LabelInstr * done = IR::LabelInstr::New(Js::OpCode::Label, m_func);
-    IR::RegOpnd * typeReg = IR::RegOpnd::New(TyMachReg, this->m_func);
-    IR::Opnd * objectSrc;
-    IR::RegOpnd * objectReg;
-    IR::Opnd * functionSrc;
-    IR::RegOpnd * functionReg;
-    intptr_t inlineCache;
-    IR::Instr * instrArg;
-
-    // We are going to use the extra ArgOut_A instructions to lower the helper call later,
-    // so we leave them alone here and clean them up then.
-    inlineCache = instr->m_func->GetJITFunctionBody()->GetIsInstInlineCache(uint(instr->GetSrc1()->AsIntConstOpnd()->GetValue()));
-    Assert(instr->GetSrc2()->AsRegOpnd()->m_sym->m_isSingleDef);
-    instrArg = instr->GetSrc2()->AsRegOpnd()->m_sym->m_instrDef;
-
-    objectSrc = instrArg->GetSrc1();
-    Assert(instrArg->GetSrc2()->AsRegOpnd()->m_sym->m_isSingleDef);
-    instrArg = instrArg->GetSrc2()->AsRegOpnd()->m_sym->m_instrDef;
-
-    functionSrc = instrArg->GetSrc1();
-    Assert(instrArg->GetSrc2() == nullptr);
-
-    IR::Opnd* opndDst = instr->GetDst();
-    if (!opndDst->IsRegOpnd())
-    {
-        opndDst = IR::RegOpnd::New(opndDst->GetType(), this->m_func);
-    }
-
-    // LDR dst, Js::false
-    instr->InsertBefore(IR::Instr::New(Js::OpCode::LDR, opndDst,
-        m_lowerer->LoadLibraryValueOpnd(instr, LibraryValue::ValueFalse), m_func));
-
-    if (functionSrc->IsRegOpnd())
-    {
-        functionReg = functionSrc->AsRegOpnd();
-    }
-    else
-    {
-        functionReg = IR::RegOpnd::New(TyMachReg, this->m_func);
-        Lowerer::InsertMove(functionReg, functionSrc, instr);
-    }
-
-    // CMP functionReg, [&(inlineCache->function)]
-    {
-        IR::Instr * cmp = IR::Instr::New(Js::OpCode::CMP, m_func);
-        cmp->SetSrc1(functionReg);
-        cmp->SetSrc2(IR::MemRefOpnd::New(inlineCache + Js::IsInstInlineCache::OffsetOfFunction(), TyMachReg, m_func,
-            IR::AddrOpndKindDynamicIsInstInlineCacheFunctionRef));
-        instr->InsertBefore(cmp);
-        LegalizeMD::LegalizeInstr(cmp, false);
-    }
-
-    // BNE helper
-    instr->InsertBefore(IR::BranchInstr::New(Js::OpCode::BNE, helper, m_func));
-
-    if (objectSrc->IsRegOpnd())
-    {
-        objectReg = objectSrc->AsRegOpnd();
-    }
-    else
-    {
-        objectReg = IR::RegOpnd::New(TyMachReg, this->m_func);
-        Lowerer::InsertMove(objectReg, objectSrc, instr);
-    }
-
-    // TST objectReg, Js::AtomTag
-    // BNE done
-    if (!objectReg->m_sym->m_isNotInt)
-    {
-        GenerateObjectTest(objectReg, instr, done);
-    }
-
-    // LDR typeReg, objectSrc + offsetof(RecyclableObject::type)
-    instr->InsertBefore(IR::Instr::New(Js::OpCode::LDR, typeReg,
-        IR::IndirOpnd::New(objectReg, Js::RecyclableObject::GetOffsetOfType(), TyMachReg, m_func),
-        m_func));
-
-    // CMP [typeReg + offsetof(Type::typeid)], TypeIds_LastJavascriptPrimitiveType
-    {
-        IR::Instr * cmp = IR::Instr::New(Js::OpCode::CMP, m_func);
-        cmp->SetSrc1(IR::IndirOpnd::New(typeReg, Js::Type::GetOffsetOfTypeId(), TyInt32, m_func));
-        cmp->SetSrc2(IR::IntConstOpnd::New(Js::TypeId::TypeIds_LastJavascriptPrimitiveType, TyInt32, m_func));
-        instr->InsertBefore(cmp);
-        LegalizeMD::LegalizeInstr(cmp, false);
-    }
-
-    // BLE done
-    instr->InsertBefore(IR::BranchInstr::New(Js::OpCode::BLE, done, m_func));
-
-    // CMP typeReg, [&(inlineCache->type]
-    {
-        IR::Instr * cmp = IR::Instr::New(Js::OpCode::CMP, m_func);
-        cmp->SetSrc1(typeReg);
-        cmp->SetSrc2(IR::MemRefOpnd::New(inlineCache + Js::IsInstInlineCache::OffsetOfType(), TyMachReg, m_func));
-        instr->InsertBefore(cmp);
-        LegalizeMD::LegalizeInstr(cmp, false);
-    }
-
-    // BNE helper
-    instr->InsertBefore(IR::BranchInstr::New(Js::OpCode::BNE, helper, m_func));
-
-    // LDR dst, [&(inlineCache->result)]
-    IR::Instr *result = IR::Instr::New(Js::OpCode::LDR, opndDst,
-        IR::MemRefOpnd::New(inlineCache + Js::IsInstInlineCache::OffsetOfResult(), TyMachReg, m_func), m_func);
-    instr->InsertBefore(result);
-    LegalizeMD::LegalizeInstr(result, false);
-
-    if (opndDst != instr->GetDst())
-    {
-        Lowerer::InsertMove(instr->GetDst(), opndDst, instr);
-    }
-
-    // B done
-    instr->InsertBefore(IR::BranchInstr::New(Js::OpCode::B, done, m_func));
-
-    // LABEL helper
-    instr->InsertBefore(helper);
-
-    instr->InsertAfter(done);
-
-    return true;
-}
-
 // Helper method: inserts legalized assign for given srcOpnd into RegD0 in front of given instr in the following way:
 //   dstReg = InsertMove srcOpnd
 // Used to put args of inline built-in call into RegD0 and RegD1 before we call actual CRT function.

+ 0 - 2
lib/Backend/arm64/LowerMD.h

@@ -151,10 +151,8 @@ public:
             IR::LabelInstr *GetBailOutStackRestoreLabel(BailOutInfo * bailOutInfo, IR::LabelInstr * exitTargetInstr);
             StackSym *      GetImplicitParamSlotSym(Js::ArgSlot argSlot);
      static StackSym *      GetImplicitParamSlotSym(Js::ArgSlot argSlot, Func * func);
-            bool            GenerateFastIsInst(IR::Instr * instr, Js::ScriptContext * scriptContext);
 
             IR::Instr *     LowerDivI4AndBailOnReminder(IR::Instr * instr, IR::LabelInstr * bailOutLabel);
-            bool            GenerateFastIsInst(IR::Instr * instr);
 public:
             IR::Instr *         LowerCall(IR::Instr * callInstr, Js::ArgSlot argCount);
             IR::Instr *         LowerCallI(IR::Instr * callInstr, ushort callFlags, bool isHelper = false, IR::Instr* insertBeforeInstrForCFG = nullptr);