From d733874de6b7583bbbf8e9c8e9ea5ccef9681407 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Thu, 23 May 2019 10:46:27 +0000 Subject: [PATCH] Bug 1551796 part 4 - Remove unnecessary hasJitScript() checks in BaselineInspector. r=tcampbell These have been unnecessary since the ICScript introduction: when performing the arguments analysis we have a JitScript but not a BaselineScript. Depends on D32103 Differential Revision: https://phabricator.services.mozilla.com/D32126 --HG-- extra : moz-landing-system : lando --- js/src/jit/BaselineInspector.cpp | 76 -------------------------------- js/src/jit/BaselineInspector.h | 9 +--- 2 files changed, 2 insertions(+), 83 deletions(-) diff --git a/js/src/jit/BaselineInspector.cpp b/js/src/jit/BaselineInspector.cpp index 39f9dd8a113f..d946fcf198d5 100644 --- a/js/src/jit/BaselineInspector.cpp +++ b/js/src/jit/BaselineInspector.cpp @@ -139,7 +139,6 @@ ICEntry& BaselineInspector::icEntryFromPC(jsbytecode* pc) { } ICEntry* BaselineInspector::maybeICEntryFromPC(jsbytecode* pc) { - MOZ_ASSERT(hasJitScript()); MOZ_ASSERT(isValidPC(pc)); ICEntry* ent = jitScript()->maybeICEntryFromPCOffset(script->pcToOffset(pc), prevLookedUpEntry); @@ -159,10 +158,6 @@ bool BaselineInspector::maybeInfoForPropertyOp(jsbytecode* pc, // uncacheable access. MOZ_ASSERT(receivers.empty()); - if (!hasJitScript()) { - return true; - } - MOZ_ASSERT(isValidPC(pc)); const ICEntry& entry = icEntryFromPC(pc); @@ -206,10 +201,6 @@ bool BaselineInspector::maybeInfoForPropertyOp(jsbytecode* pc, } ICStub* BaselineInspector::monomorphicStub(jsbytecode* pc) { - if (!hasJitScript()) { - return nullptr; - } - // IonBuilder::analyzeNewLoopTypes may call this (via expectedResultType // below) on code that's unreachable, according to BytecodeAnalysis. Use // maybeICEntryFromPC to handle this. @@ -230,10 +221,6 @@ ICStub* BaselineInspector::monomorphicStub(jsbytecode* pc) { bool BaselineInspector::dimorphicStub(jsbytecode* pc, ICStub** pfirst, ICStub** psecond) { - if (!hasJitScript()) { - return false; - } - const ICEntry& entry = icEntryFromPC(pc); ICStub* stub = entry.firstStub(); @@ -578,10 +565,6 @@ static bool TryToSpecializeBinaryArithOp(ICStub** stubs, uint32_t nstubs, } MIRType BaselineInspector::expectedBinaryArithSpecialization(jsbytecode* pc) { - if (!hasJitScript()) { - return MIRType::None; - } - MIRType result; ICStub* stubs[2]; @@ -613,10 +596,6 @@ MIRType BaselineInspector::expectedBinaryArithSpecialization(jsbytecode* pc) { } bool BaselineInspector::hasSeenNonIntegerIndex(jsbytecode* pc) { - if (!hasJitScript()) { - return false; - } - const ICEntry& entry = icEntryFromPC(pc); ICStub* stub = entry.fallbackStub(); @@ -626,10 +605,6 @@ bool BaselineInspector::hasSeenNonIntegerIndex(jsbytecode* pc) { } bool BaselineInspector::hasSeenNegativeIndexGetElement(jsbytecode* pc) { - if (!hasJitScript()) { - return false; - } - const ICEntry& entry = icEntryFromPC(pc); ICStub* stub = entry.fallbackStub(); @@ -640,10 +615,6 @@ bool BaselineInspector::hasSeenNegativeIndexGetElement(jsbytecode* pc) { } bool BaselineInspector::hasSeenAccessedGetter(jsbytecode* pc) { - if (!hasJitScript()) { - return false; - } - const ICEntry& entry = icEntryFromPC(pc); ICStub* stub = entry.fallbackStub(); @@ -654,10 +625,6 @@ bool BaselineInspector::hasSeenAccessedGetter(jsbytecode* pc) { } bool BaselineInspector::hasSeenDoubleResult(jsbytecode* pc) { - if (!hasJitScript()) { - return false; - } - const ICEntry& entry = icEntryFromPC(pc); ICStub* stub = entry.fallbackStub(); @@ -723,10 +690,6 @@ JSObject* MaybeTemplateObject(ICStub* stub, MetaTwoByteKind kind, } JSObject* BaselineInspector::getTemplateObject(jsbytecode* pc) { - if (!hasJitScript()) { - return nullptr; - } - const ICEntry& entry = icEntryFromPC(pc); for (ICStub* stub = entry.firstStub(); stub; stub = stub->next()) { switch (stub->kind()) { @@ -763,10 +726,6 @@ JSObject* BaselineInspector::getTemplateObject(jsbytecode* pc) { } ObjectGroup* BaselineInspector::getTemplateObjectGroup(jsbytecode* pc) { - if (!hasJitScript()) { - return nullptr; - } - const ICEntry& entry = icEntryFromPC(pc); for (ICStub* stub = entry.firstStub(); stub; stub = stub->next()) { switch (stub->kind()) { @@ -783,10 +742,6 @@ ObjectGroup* BaselineInspector::getTemplateObjectGroup(jsbytecode* pc) { JSFunction* BaselineInspector::getSingleCallee(jsbytecode* pc) { MOZ_ASSERT(*pc == JSOP_NEW); - if (!hasJitScript()) { - return nullptr; - } - const ICEntry& entry = icEntryFromPC(pc); ICStub* stub = entry.firstStub(); @@ -818,10 +773,6 @@ JSFunction* BaselineInspector::getSingleCallee(jsbytecode* pc) { JSObject* BaselineInspector::getTemplateObjectForNative(jsbytecode* pc, Native native) { - if (!hasJitScript()) { - return nullptr; - } - const ICEntry& entry = icEntryFromPC(pc); for (ICStub* stub = entry.firstStub(); stub; stub = stub->next()) { if (stub->isCall_Native() && @@ -848,10 +799,6 @@ JSObject* BaselineInspector::getTemplateObjectForNative(jsbytecode* pc, JSObject* BaselineInspector::getTemplateObjectForClassHook(jsbytecode* pc, const Class* clasp) { - if (!hasJitScript()) { - return nullptr; - } - const ICEntry& entry = icEntryFromPC(pc); for (ICStub* stub = entry.firstStub(); stub; stub = stub->next()) { if (stub->isCall_ClassHook() && @@ -1207,10 +1154,6 @@ bool BaselineInspector::commonGetPropFunction( jsbytecode* pc, jsid id, bool innerized, JSObject** holder, Shape** holderShape, JSFunction** commonGetter, Shape** globalShape, bool* isOwnProperty, ReceiverVector& receivers) { - if (!hasJitScript()) { - return false; - } - MOZ_ASSERT(IsGetPropPC(pc) || IsGetElemPC(pc) || JSOp(*pc) == JSOP_GETGNAME); MOZ_ASSERT(receivers.empty()); @@ -1289,10 +1232,6 @@ static JSFunction* GetMegamorphicGetterSetterFunction( bool BaselineInspector::megamorphicGetterSetterFunction( jsbytecode* pc, jsid id, bool isGetter, JSFunction** getterOrSetter) { - if (!hasJitScript()) { - return false; - } - MOZ_ASSERT(IsGetPropPC(pc) || IsGetElemPC(pc) || IsSetPropPC(pc) || JSOp(*pc) == JSOP_GETGNAME || JSOp(*pc) == JSOP_INITGLEXICAL || JSOp(*pc) == JSOP_INITPROP || JSOp(*pc) == JSOP_INITLOCKEDPROP || @@ -1454,10 +1393,6 @@ bool BaselineInspector::commonSetPropFunction(jsbytecode* pc, JSObject** holder, JSFunction** commonSetter, bool* isOwnProperty, ReceiverVector& receivers) { - if (!hasJitScript()) { - return false; - } - MOZ_ASSERT(IsSetPropPC(pc) || JSOp(*pc) == JSOP_INITGLEXICAL || JSOp(*pc) == JSOP_INITPROP || JSOp(*pc) == JSOP_INITLOCKEDPROP || JSOp(*pc) == JSOP_INITHIDDENPROP); @@ -1554,10 +1489,6 @@ bool BaselineInspector::maybeInfoForProtoReadSlot(jsbytecode* pc, MOZ_ASSERT(receivers.empty()); MOZ_ASSERT(!*holder); - if (!hasJitScript()) { - return true; - } - MOZ_ASSERT(isValidPC(pc)); const ICEntry& entry = icEntryFromPC(pc); @@ -1617,10 +1548,6 @@ static MIRType GetCacheIRExpectedInputType(ICCacheIR_Monitored* stub) { } MIRType BaselineInspector::expectedPropertyAccessInputType(jsbytecode* pc) { - if (!hasJitScript()) { - return MIRType::Value; - } - const ICEntry& entry = icEntryFromPC(pc); MIRType type = MIRType::None; @@ -1656,9 +1583,6 @@ bool BaselineInspector::instanceOfData(jsbytecode* pc, Shape** shape, uint32_t* slot, JSObject** prototypeObject) { MOZ_ASSERT(*pc == JSOP_INSTANCEOF); - if (!hasJitScript()) { - return false; - } const ICEntry& entry = icEntryFromPC(pc); ICStub* firstStub = entry.firstStub(); diff --git a/js/src/jit/BaselineInspector.h b/js/src/jit/BaselineInspector.h index 26ba42a6d063..04dabdb81a0a 100644 --- a/js/src/jit/BaselineInspector.h +++ b/js/src/jit/BaselineInspector.h @@ -47,8 +47,6 @@ class BaselineInspector { MOZ_ASSERT(script); } - bool hasJitScript() const { return script->hasJitScript(); } - JitScript* jitScript() const; private: @@ -62,11 +60,8 @@ class BaselineInspector { template ICInspectorType makeICInspector(jsbytecode* pc, ICStub::Kind expectedFallbackKind) { - ICEntry* ent = nullptr; - if (hasJitScript()) { - ent = &icEntryFromPC(pc); - MOZ_ASSERT(ent->fallbackStub()->kind() == expectedFallbackKind); - } + ICEntry* ent = &icEntryFromPC(pc); + MOZ_ASSERT(ent->fallbackStub()->kind() == expectedFallbackKind); return ICInspectorType(this, pc, ent); }