JSObject * BaselineInspector::commonSetPropFunction(jsbytecode *pc, Shape **lastProperty, JSFunction **commonSetter) { if (!hasBaselineScript()) return nullptr; const ICEntry &entry = icEntryFromPC(pc); JSObject *holder = nullptr; Shape *holderShape = nullptr; JSFunction *setter = nullptr; for (ICStub *stub = entry.firstStub(); stub; stub = stub->next()) { if (stub->isSetProp_CallScripted() || stub->isSetProp_CallNative()) { ICSetPropCallSetter *nstub = static_cast<ICSetPropCallSetter *>(stub); if (!holder) { holder = nstub->holder(); holderShape = nstub->holderShape(); setter = nstub->setter(); } else if (nstub->holderShape() != holderShape) { return nullptr; } else { MOZ_ASSERT(setter == nstub->setter()); } } else if (stub->isSetProp_Fallback() && stub->toSetProp_Fallback()->hadUnoptimizableAccess()) { // We have an unoptimizable access, so don't try to optimize. return nullptr; } } *lastProperty = holderShape; *commonSetter = setter; return holder; }
bool BaselineInspector::commonSetPropFunction(jsbytecode* pc, JSObject** holder, Shape** holderShape, JSFunction** commonSetter, bool* isOwnProperty, ReceiverVector& receivers, ObjectGroupVector& convertUnboxedGroups) { if (!hasBaselineScript()) return false; MOZ_ASSERT(receivers.empty()); MOZ_ASSERT(convertUnboxedGroups.empty()); *holder = nullptr; const ICEntry& entry = icEntryFromPC(pc); for (ICStub* stub = entry.firstStub(); stub; stub = stub->next()) { if (stub->isSetProp_CallScripted() || stub->isSetProp_CallNative()) { ICSetPropCallSetter* nstub = static_cast<ICSetPropCallSetter*>(stub); bool isOwn = nstub->isOwnSetter(); if (!isOwn && !AddReceiver(nstub->receiverGuard(), receivers, convertUnboxedGroups)) return false; if (!*holder) { *holder = nstub->holder(); *holderShape = nstub->holderShape(); *commonSetter = nstub->setter(); *isOwnProperty = isOwn; } else if (nstub->holderShape() != *holderShape || isOwn != *isOwnProperty) { return false; } else { MOZ_ASSERT(*commonSetter == nstub->setter()); } } else if (!stub->isSetProp_Fallback() || stub->toSetProp_Fallback()->hadUnoptimizableAccess()) { // We have an unoptimizable access, so don't try to optimize. return false; } } if (!*holder) return false; return true; }
JSObject * BaselineInspector::commonSetPropFunction(jsbytecode *pc, Shape **lastProperty, JSFunction **commonSetter) { const ICEntry &entry = icEntryFromPC(pc); for (ICStub *stub = entry.firstStub(); stub; stub = stub->next()) { if (stub->isSetProp_CallScripted() || stub->isSetProp_CallNative()) { ICSetPropCallSetter *nstub = static_cast<ICSetPropCallSetter *>(stub); *lastProperty = nstub->holderShape(); *commonSetter = nstub->setter(); return nstub->holder(); } } return nullptr; }