Bug 1661256 part 18 - Convert js::jit::AssertValid* functions called with callWithABI. r=caroline

Differential Revision: https://phabricator.services.mozilla.com/D91798
This commit is contained in:
Nicolas B. Pierron 2020-10-05 16:55:49 +00:00
Родитель d2db13a608
Коммит d3688b138d
4 изменённых файлов: 45 добавлений и 30 удалений

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

@ -62,6 +62,12 @@ namespace jit {
_(js::irregexp::CaseInsensitiveCompareNonUnicode) \
_(js::irregexp::CaseInsensitiveCompareUnicode) \
_(js::irregexp::GrowBacktrackStack) \
_(js::jit::AssertValidBigIntPtr) \
_(js::jit::AssertValidObjectOrNullPtr) \
_(js::jit::AssertValidObjectPtr) \
_(js::jit::AssertValidStringPtr) \
_(js::jit::AssertValidSymbolPtr) \
_(js::jit::AssertValidValue) \
_(js::jit::AssumeUnreachable) \
_(js::jit::Bailout) \
_(js::jit::FinishBailoutToBaseline) \

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

@ -6995,28 +6995,36 @@ void CodeGenerator::emitAssertGCThingResult(Register input,
masm.passABIArg(temp);
masm.passABIArg(input);
void* callee;
switch (type) {
case MIRType::Object:
callee = JS_FUNC_TO_DATA_PTR(void*, AssertValidObjectPtr);
case MIRType::Object: {
using Fn = void (*)(JSContext * cx, JSObject * obj);
masm.callWithABI<Fn, AssertValidObjectPtr>();
break;
case MIRType::ObjectOrNull:
callee = JS_FUNC_TO_DATA_PTR(void*, AssertValidObjectOrNullPtr);
}
case MIRType::ObjectOrNull: {
using Fn = void (*)(JSContext * cx, JSObject * obj);
masm.callWithABI<Fn, AssertValidObjectOrNullPtr>();
break;
case MIRType::String:
callee = JS_FUNC_TO_DATA_PTR(void*, AssertValidStringPtr);
}
case MIRType::String: {
using Fn = void (*)(JSContext * cx, JSString * str);
masm.callWithABI<Fn, AssertValidStringPtr>();
break;
case MIRType::Symbol:
callee = JS_FUNC_TO_DATA_PTR(void*, AssertValidSymbolPtr);
}
case MIRType::Symbol: {
using Fn = void (*)(JSContext * cx, JS::Symbol * sym);
masm.callWithABI<Fn, AssertValidSymbolPtr>();
break;
case MIRType::BigInt:
callee = JS_FUNC_TO_DATA_PTR(void*, AssertValidBigIntPtr);
}
case MIRType::BigInt: {
using Fn = void (*)(JSContext * cx, JS::BigInt * bi);
masm.callWithABI<Fn, AssertValidBigIntPtr>();
break;
}
default:
MOZ_CRASH();
}
masm.callWithABI(callee);
restoreVolatile();
}
# endif
@ -7078,11 +7086,12 @@ void CodeGenerator::emitAssertResultV(const ValueOperand input,
masm.pushValue(input);
masm.moveStackPtrTo(temp1);
using Fn = void (*)(JSContext * cx, Value * v);
masm.setupUnalignedABICall(temp2);
masm.loadJSContext(temp2);
masm.passABIArg(temp2);
masm.passABIArg(temp1);
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, AssertValidValue));
masm.callWithABI<Fn, AssertValidValue>();
masm.popValue(input);
restoreVolatile();
}

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

@ -1315,6 +1315,21 @@ void AutoDetectInvalidation::setReturnOverride() {
cx_->setIonReturnOverride(rval_.get());
}
void AssertValidBigIntPtr(JSContext* cx, JS::BigInt* bi) {
AutoUnsafeCallWithABI unsafe;
// FIXME: check runtime?
MOZ_ASSERT(cx->zone() == bi->zone());
MOZ_ASSERT(bi->isAligned());
MOZ_ASSERT(bi->getAllocKind() == gc::AllocKind::BIGINT);
}
void AssertValidObjectOrNullPtr(JSContext* cx, JSObject* obj) {
AutoUnsafeCallWithABI unsafe;
if (obj) {
AssertValidObjectPtr(cx, obj);
}
}
void AssertValidObjectPtr(JSContext* cx, JSObject* obj) {
AutoUnsafeCallWithABI unsafe;
#ifdef DEBUG
@ -1335,13 +1350,6 @@ void AssertValidObjectPtr(JSContext* cx, JSObject* obj) {
#endif
}
void AssertValidObjectOrNullPtr(JSContext* cx, JSObject* obj) {
AutoUnsafeCallWithABI unsafe;
if (obj) {
AssertValidObjectPtr(cx, obj);
}
}
void AssertValidStringPtr(JSContext* cx, JSString* str) {
AutoUnsafeCallWithABI unsafe;
#ifdef DEBUG
@ -1395,14 +1403,6 @@ void AssertValidSymbolPtr(JSContext* cx, JS::Symbol* sym) {
MOZ_ASSERT(sym->getAllocKind() == gc::AllocKind::SYMBOL);
}
void AssertValidBigIntPtr(JSContext* cx, JS::BigInt* bi) {
AutoUnsafeCallWithABI unsafe;
// FIXME: check runtime?
MOZ_ASSERT(cx->zone() == bi->zone());
MOZ_ASSERT(bi->isAligned());
MOZ_ASSERT(bi->getAllocKind() == gc::AllocKind::BIGINT);
}
void AssertValidValue(JSContext* cx, Value* v) {
AutoUnsafeCallWithABI unsafe;
if (v->isObject()) {

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

@ -1030,11 +1030,11 @@ MOZ_MUST_USE bool SetDenseElement(JSContext* cx, HandleNativeObject obj,
int32_t index, HandleValue value,
bool strict);
void AssertValidObjectPtr(JSContext* cx, JSObject* obj);
void AssertValidBigIntPtr(JSContext* cx, JS::BigInt* bi);
void AssertValidObjectOrNullPtr(JSContext* cx, JSObject* obj);
void AssertValidObjectPtr(JSContext* cx, JSObject* obj);
void AssertValidStringPtr(JSContext* cx, JSString* str);
void AssertValidSymbolPtr(JSContext* cx, JS::Symbol* sym);
void AssertValidBigIntPtr(JSContext* cx, JS::BigInt* bi);
void AssertValidValue(JSContext* cx, Value* v);
void MarkValueFromJit(JSRuntime* rt, Value* vp);