Bug 1661256 part 35 - Convert various analysis functions called with callWithABI. r=jandem

Differential Revision: https://phabricator.services.mozilla.com/D91815
This commit is contained in:
Nicolas B. Pierron 2020-10-05 16:54:59 +00:00
Родитель f842eb0ac4
Коммит 6899644a28
7 изменённых файлов: 46 добавлений и 27 удалений

Просмотреть файл

@ -112,6 +112,7 @@ namespace jit {
_(js::jit::CreateMatchResultFallbackFunc) \
_(js::jit::EqualStringsHelperPure) \
_(js::jit::FinishBailoutToBaseline) \
_(js::jit::FrameIsDebuggeeCheck) \
_(js::jit::GetDynamicNamePure) \
_(js::jit::GetIndexFromString) \
_(js::jit::GetInt32FromStringPure) \
@ -119,6 +120,8 @@ namespace jit {
_(js::jit::GetNativeDataPropertyByValuePure<true>) \
_(js::jit::GetNativeDataPropertyPure<false>) \
_(js::jit::GetNativeDataPropertyPure<true>) \
_(js::jit::GlobalHasLiveOnDebuggerStatement) \
_(js::jit::GroupHasPropertyTypes) \
_(js::jit::HandleCodeCoverageAtPC) \
_(js::jit::HandleCodeCoverageAtPrologue) \
_(js::jit::HandleException) \
@ -129,6 +132,9 @@ namespace jit {
_(js::jit::InvalidationBailout) \
_(js::jit::InvokeFromInterpreterStub) \
_(js::jit::LazyLinkTopActivation) \
_(js::jit::ObjectHasGetterSetterPure) \
_(js::jit::ObjectIsCallable) \
_(js::jit::ObjectIsConstructor) \
_(js::jit::PostGlobalWriteBarrier) \
_(js::jit::PostWriteBarrier) \
_(js::jit::PostWriteElementBarrier<IndexInBounds::Yes>) \
@ -138,6 +144,7 @@ namespace jit {
_(js::jit::SetNativeDataPropertyPure<false>) \
_(js::jit::SetNativeDataPropertyPure<true>) \
_(js::jit::StringFromCharCodeNoGC) \
_(js::jit::TypeOfObject) \
_(js::jit::WrapObjectPure) \
_(js::MapIteratorObject::next) \
_(js::NativeObject::addDenseElementPure) \

Просмотреть файл

@ -759,10 +759,11 @@ bool BaselineCodeGen<Handler>::emitStackCheck() {
}
static void EmitCallFrameIsDebuggeeCheck(MacroAssembler& masm) {
using Fn = void (*)(BaselineFrame * frame);
masm.setupUnalignedABICall(R0.scratchReg());
masm.loadBaselineFramePtr(BaselineFrameReg, R0.scratchReg());
masm.passABIArg(R0.scratchReg());
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, jit::FrameIsDebuggeeCheck));
masm.callWithABI<Fn, FrameIsDebuggeeCheck>();
}
template <>

Просмотреть файл

@ -3930,9 +3930,10 @@ bool CacheIRCompiler::emitIsCallableResult(ValOperandId inputId) {
liveVolatileFloatRegs());
masm.PushRegsInMask(volatileRegs);
using Fn = bool (*)(JSObject * obj);
masm.setupUnalignedABICall(scratch2);
masm.passABIArg(scratch1);
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, ObjectIsCallable));
masm.callWithABI<Fn, ObjectIsCallable>();
masm.storeCallBoolResult(scratch2);
LiveRegisterSet ignore;
@ -3963,9 +3964,10 @@ bool CacheIRCompiler::emitIsConstructorResult(ObjOperandId objId) {
liveVolatileFloatRegs());
masm.PushRegsInMask(volatileRegs);
using Fn = bool (*)(JSObject * obj);
masm.setupUnalignedABICall(scratch);
masm.passABIArg(obj);
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, ObjectIsConstructor));
masm.callWithABI<Fn, ObjectIsConstructor>();
masm.storeCallBoolResult(scratch);
LiveRegisterSet ignore;
@ -5714,11 +5716,12 @@ bool CacheIRCompiler::emitLoadTypeOfObjectResult(ObjOperandId objId) {
liveVolatileFloatRegs());
masm.PushRegsInMask(save);
using Fn = JSString* (*)(JSObject * obj, JSRuntime * rt);
masm.setupUnalignedABICall(scratch);
masm.passABIArg(obj);
masm.movePtr(ImmPtr(cx_->runtime()), scratch);
masm.passABIArg(scratch);
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, TypeOfObject));
masm.callWithABI<Fn, TypeOfObject>();
masm.mov(ReturnReg, scratch);
LiveRegisterSet ignore;
@ -7208,13 +7211,14 @@ bool CacheIRCompiler::emitGuardHasGetterSetter(ObjOperandId objId,
volatileRegs.takeUnchecked(scratch2);
masm.PushRegsInMask(volatileRegs);
using Fn = bool (*)(JSContext* cx, JSObject* obj, Shape* propShape);
masm.setupUnalignedABICall(scratch1);
masm.loadJSContext(scratch1);
masm.passABIArg(scratch1);
masm.passABIArg(obj);
emitLoadStubField(shape, scratch2);
masm.passABIArg(scratch2);
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, ObjectHasGetterSetterPure));
masm.callWithABI<Fn, ObjectHasGetterSetterPure>();
masm.mov(ReturnReg, scratch1);
masm.PopRegsInMask(volatileRegs);

Просмотреть файл

@ -12623,11 +12623,12 @@ void CodeGenerator::visitOutOfLineTypeOfV(OutOfLineTypeOfV* ool) {
masm.bind(&slowCheck);
saveVolatile(output);
using Fn = JSString* (*)(JSObject * obj, JSRuntime * rt);
masm.setupUnalignedABICall(output);
masm.passABIArg(obj);
masm.movePtr(ImmPtr(gen->runtime), output);
masm.passABIArg(output);
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, jit::TypeOfObject));
masm.callWithABI<Fn, TypeOfObject>();
masm.storeCallPointerResult(output);
restoreVolatile(output);
@ -14022,9 +14023,10 @@ void CodeGenerator::visitOutOfLineIsCallable(OutOfLineIsCallable* ool) {
Register output = ool->output();
saveVolatile(output);
using Fn = bool (*)(JSObject * obj);
masm.setupUnalignedABICall(output);
masm.passABIArg(object);
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, ObjectIsCallable));
masm.callWithABI<Fn, ObjectIsCallable>();
masm.storeCallBoolResult(output);
restoreVolatile(output);
masm.jump(ool->rejoin());
@ -14060,9 +14062,10 @@ void CodeGenerator::visitOutOfLineIsConstructor(OutOfLineIsConstructor* ool) {
Register output = ToRegister(ins->output());
saveVolatile(output);
using Fn = bool (*)(JSObject * obj);
masm.setupUnalignedABICall(output);
masm.passABIArg(object);
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, ObjectIsConstructor));
masm.callWithABI<Fn, ObjectIsConstructor>();
masm.storeCallBoolResult(output);
restoreVolatile(output);
masm.jump(ool->rejoin());
@ -14668,10 +14671,10 @@ void CodeGenerator::visitDebugger(LDebugger* ins) {
Register temp = ToRegister(ins->getTemp(1));
masm.loadJSContext(cx);
using Fn = bool (*)(JSContext * cx);
masm.setupUnalignedABICall(temp);
masm.passABIArg(cx);
masm.callWithABI(
JS_FUNC_TO_DATA_PTR(void*, GlobalHasLiveOnDebuggerStatement));
masm.callWithABI<Fn, GlobalHasLiveOnDebuggerStatement>();
Label bail;
masm.branchIfTrueBool(ReturnReg, &bail);
@ -15200,12 +15203,13 @@ void CodeGenerator::visitGuardHasGetterSetter(LGuardHasGetterSetter* lir) {
masm.movePtr(ImmGCPtr(lir->mir()->shape()), temp2);
using Fn = bool (*)(JSContext* cx, JSObject* obj, Shape* propShape);
masm.setupUnalignedABICall(temp1);
masm.loadJSContext(temp1);
masm.passABIArg(temp1);
masm.passABIArg(object);
masm.passABIArg(temp2);
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, ObjectHasGetterSetterPure));
masm.callWithABI<Fn, ObjectHasGetterSetterPure>();
bailoutIfFalseBool(ReturnReg, lir->snapshot());
}

Просмотреть файл

@ -1276,21 +1276,6 @@ bool IonCacheIRCompiler::emitCompareStringResult(JSOp op, StringOperandId lhsId,
return true;
}
static bool GroupHasPropertyTypes(ObjectGroup* group, jsid* id, Value* v) {
AutoUnsafeCallWithABI unsafe;
if (group->unknownPropertiesDontCheckGeneration()) {
return true;
}
HeapTypeSet* propTypes = group->maybeGetPropertyDontCheckGeneration(*id);
if (!propTypes) {
return true;
}
if (!propTypes->nonConstantProperty()) {
return false;
}
return propTypes->hasType(TypeSet::GetValueType(*v));
}
static void EmitCheckPropertyTypes(MacroAssembler& masm,
const PropertyTypeCheckInfo* typeCheckInfo,
Register obj, const ConstantOrRegister& val,
@ -1404,12 +1389,13 @@ static void EmitCheckPropertyTypes(MacroAssembler& masm,
masm.Push(id, scratch3);
masm.moveStackPtrTo(scratch3);
using Fn = bool (*)(ObjectGroup * group, jsid * id, Value * v);
masm.setupUnalignedABICall(scratch1);
masm.movePtr(ImmGCPtr(group), scratch1);
masm.passABIArg(scratch1);
masm.passABIArg(scratch3);
masm.passABIArg(scratch2);
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, GroupHasPropertyTypes));
masm.callWithABI<Fn, GroupHasPropertyTypes>();
masm.mov(ReturnReg, scratch1);
masm.adjustStack(sizeof(Value) + sizeof(jsid));

Просмотреть файл

@ -2469,6 +2469,21 @@ AtomicsReadWriteModifyFn AtomicsXor(Scalar::Type elementType) {
}
}
bool GroupHasPropertyTypes(ObjectGroup* group, jsid* id, Value* v) {
AutoUnsafeCallWithABI unsafe;
if (group->unknownPropertiesDontCheckGeneration()) {
return true;
}
HeapTypeSet* propTypes = group->maybeGetPropertyDontCheckGeneration(*id);
if (!propTypes) {
return true;
}
if (!propTypes->nonConstantProperty()) {
return false;
}
return propTypes->hasType(TypeSet::GetValueType(*v));
}
void AssumeUnreachable(const char* output) {
MOZ_ReportAssertionFailure(output, __FILE__, __LINE__);
}

Просмотреть файл

@ -1173,6 +1173,8 @@ AtomicsReadWriteModifyFn AtomicsAnd(Scalar::Type elementType);
AtomicsReadWriteModifyFn AtomicsOr(Scalar::Type elementType);
AtomicsReadWriteModifyFn AtomicsXor(Scalar::Type elementType);
bool GroupHasPropertyTypes(ObjectGroup* group, jsid* id, Value* v);
// Functions used when JS_MASM_VERBOSE is enabled.
void AssumeUnreachable(const char* output);
void Printf0(const char* output);