Bug 1608994 part 3 - Remove class hook template object. r=iain

Ion no longer uses the template object after part 1.

Differential Revision: https://phabricator.services.mozilla.com/D62740

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan de Mooij 2020-02-13 15:11:48 +00:00
parent c95ae57b9a
commit 4461035d9d
4 changed files with 3 additions and 74 deletions

View File

@ -798,26 +798,6 @@ JSObject* BaselineInspector::getTemplateObjectForNative(jsbytecode* pc,
return nullptr;
}
JSObject* BaselineInspector::getTemplateObjectForClassHook(
jsbytecode* pc, const JSClass* clasp) {
const ICEntry& entry = icEntryFromPC(pc);
for (ICStub* stub = entry.firstStub(); stub; stub = stub->next()) {
if (ICStub::IsCacheIRKind(stub->kind())) {
auto filter = [stub, clasp](CacheIRReader& args,
const CacheIRStubInfo* info) {
return info->getStubField<JSClass*>(stub, args.stubOffset()) == clasp;
};
JSObject* result = MaybeTemplateObject(
stub, MetaTwoByteKind::ClassTemplateObject, filter);
if (result) {
return result;
}
}
}
return nullptr;
}
LexicalEnvironmentObject* BaselineInspector::templateNamedLambdaObject() {
JSObject* res = jitScript()->templateEnvironment();
if (script->bodyScope()->hasEnvironment()) {

View File

@ -95,7 +95,6 @@ class BaselineInspector {
JSObject* getTemplateObject(jsbytecode* pc);
JSObject* getTemplateObjectForNative(jsbytecode* pc, Native native);
JSObject* getTemplateObjectForClassHook(jsbytecode* pc, const JSClass* clasp);
// Sometimes the group a template object will have is known, even if the
// object itself isn't.

View File

@ -5430,33 +5430,6 @@ AttachDecision CallIRGenerator::tryAttachCallNative(HandleFunction calleeFunc) {
return AttachDecision::Attach;
}
bool CallIRGenerator::getTemplateObjectForClassHook(
HandleObject calleeObj, MutableHandleObject result) {
MOZ_ASSERT(IsConstructPC(pc_));
JSNative hook = calleeObj->constructHook();
// Don't allocate a template object for super() calls as Ion doesn't support
// super() yet.
bool isSuper = op_ == JSOp::SuperCall || op_ == JSOp::SpreadSuperCall;
if (isSuper) {
return true;
}
if (calleeObj->nonCCWRealm() != cx_->realm()) {
return true;
}
if (hook == TypedObject::construct) {
Rooted<TypeDescr*> descr(cx_, calleeObj.as<TypeDescr>());
result.set(TypedObject::createZeroed(cx_, descr, gc::TenuredHeap));
if (!result) {
return false;
}
}
return true;
}
AttachDecision CallIRGenerator::tryAttachCallHook(HandleObject calleeObj) {
if (op_ == JSOp::FunApply) {
return AttachDecision::NoAction;
@ -5478,13 +5451,6 @@ AttachDecision CallIRGenerator::tryAttachCallHook(HandleObject calleeObj) {
return AttachDecision::NoAction;
}
RootedObject templateObj(cx_);
if (isConstructing &&
!getTemplateObjectForClassHook(calleeObj, &templateObj)) {
cx_->clearPendingException();
return AttachDecision::NoAction;
}
// Load argc.
Int32OperandId argcId(writer.setInputOperandId(0));
@ -5494,16 +5460,11 @@ AttachDecision CallIRGenerator::tryAttachCallHook(HandleObject calleeObj) {
ObjOperandId calleeObjId = writer.guardToObject(calleeValId);
// Ensure the callee's class matches the one in this stub.
FieldOffset classOffset =
writer.guardAnyClass(calleeObjId, calleeObj->getClass());
writer.guardAnyClass(calleeObjId, calleeObj->getClass());
writer.callClassHook(calleeObjId, argcId, hook, flags);
writer.typeMonitorResult();
if (templateObj) {
writer.metaClassTemplateObject(templateObj, classOffset);
}
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("Call native func");

View File

@ -665,7 +665,6 @@ void LoadShapeWrapperContents(MacroAssembler& masm, Register obj, Register dst,
enum class MetaTwoByteKind : uint8_t {
NativeTemplateObject,
ScriptedTemplateObject,
ClassTemplateObject,
};
#ifdef JS_SIMULATOR
@ -1022,9 +1021,9 @@ class MOZ_RAII CacheIRWriter : public JS::CustomAutoRooter {
buffer_.writeByte(uint32_t(kind));
}
FieldOffset guardAnyClass(ObjOperandId obj, const JSClass* clasp) {
void guardAnyClass(ObjOperandId obj, const JSClass* clasp) {
writeOpWithOperandId(CacheOp::GuardAnyClass, obj);
return addStubField(uintptr_t(clasp), StubField::Type::RawWord);
addStubField(uintptr_t(clasp), StubField::Type::RawWord);
}
void guardFunctionIsNative(ObjOperandId obj) {
@ -1573,14 +1572,6 @@ class MOZ_RAII CacheIRWriter : public JS::CustomAutoRooter {
addStubField(uintptr_t(templateObject), StubField::Type::JSObject);
}
void metaClassTemplateObject(JSObject* templateObject,
FieldOffset classOffset) {
writeOp(CacheOp::MetaTwoByte);
buffer_.writeByte(uint32_t(MetaTwoByteKind::ClassTemplateObject));
reuseStubField(classOffset);
addStubField(uintptr_t(templateObject), StubField::Type::JSObject);
}
void megamorphicLoadSlotResult(ObjOperandId obj, PropertyName* name,
bool handleMissing) {
writeOpWithOperandId(CacheOp::MegamorphicLoadSlotResult, obj);
@ -2746,8 +2737,6 @@ class MOZ_RAII CallIRGenerator : public IRGenerator {
bool* skipAttach);
bool getTemplateObjectForNative(HandleFunction calleeFunc,
MutableHandleObject result);
bool getTemplateObjectForClassHook(HandleObject calleeObj,
MutableHandleObject result);
AttachDecision tryAttachArrayPush();
AttachDecision tryAttachArrayJoin();