Bug 1466118 part 3 - Replace assertSameCompartmentDebugOnly with JSContext::debugOnlyCheck. r=luke

--HG--
extra : rebase_source : d654bc0ce7ab4803ff73889281e2e07d16ae66a2
This commit is contained in:
Jan de Mooij 2018-08-21 12:11:52 +02:00
Родитель 4f14f33f62
Коммит aa66503708
5 изменённых файлов: 20 добавлений и 18 удалений

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

@ -33,8 +33,9 @@ const char* const js::jit::CacheKindNames[] = {
};
void
CacheIRWriter::assertSameCompartment(JSObject* obj) {
assertSameCompartmentDebugOnly(cx_, obj);
CacheIRWriter::assertSameCompartment(JSObject* obj)
{
cx_->debugOnlyCheck(obj);
}
StubField
@ -5721,4 +5722,4 @@ NewObjectIRGenerator::tryAttachStub()
trackAttached("NewObjectWithTemplate");
return true;
}
}

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

@ -527,7 +527,7 @@ GetObjectElementOperation(JSContext* cx, JSOp op, JS::HandleObject obj, JS::Hand
return false;
} while (false);
assertSameCompartmentDebugOnly(cx, res);
cx->debugOnlyCheck(res);
return true;
}
@ -574,7 +574,7 @@ GetPrimitiveElementOperation(JSContext* cx, JSOp op, JS::HandleValue receiver,
return false;
} while (false);
assertSameCompartmentDebugOnly(cx, res);
cx->debugOnlyCheck(res);
return true;
}

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

@ -1503,7 +1503,7 @@ HandleError(JSContext* cx, InterpreterRegs& regs)
}
#define REGS (activation.regs())
#define PUSH_COPY(v) do { *REGS.sp++ = (v); assertSameCompartmentDebugOnly(cx, REGS.sp[-1]); } while (0)
#define PUSH_COPY(v) do { *REGS.sp++ = (v); cx->debugOnlyCheck(REGS.sp[-1]); } while (0)
#define PUSH_COPY_SKIP_CHECK(v) *REGS.sp++ = (v)
#define PUSH_NULL() REGS.sp++->setNull()
#define PUSH_UNDEFINED() REGS.sp++->setUndefined()
@ -1511,9 +1511,9 @@ HandleError(JSContext* cx, InterpreterRegs& regs)
#define PUSH_DOUBLE(d) REGS.sp++->setDouble(d)
#define PUSH_INT32(i) REGS.sp++->setInt32(i)
#define PUSH_SYMBOL(s) REGS.sp++->setSymbol(s)
#define PUSH_STRING(s) do { REGS.sp++->setString(s); assertSameCompartmentDebugOnly(cx, REGS.sp[-1]); } while (0)
#define PUSH_OBJECT(obj) do { REGS.sp++->setObject(obj); assertSameCompartmentDebugOnly(cx, REGS.sp[-1]); } while (0)
#define PUSH_OBJECT_OR_NULL(obj) do { REGS.sp++->setObjectOrNull(obj); assertSameCompartmentDebugOnly(cx, REGS.sp[-1]); } while (0)
#define PUSH_STRING(s) do { REGS.sp++->setString(s); cx->debugOnlyCheck(REGS.sp[-1]); } while (0)
#define PUSH_OBJECT(obj) do { REGS.sp++->setObject(obj); cx->debugOnlyCheck(REGS.sp[-1]); } while (0)
#define PUSH_OBJECT_OR_NULL(obj) do { REGS.sp++->setObjectOrNull(obj); cx->debugOnlyCheck(REGS.sp[-1]); } while (0)
#define PUSH_MAGIC(magic) REGS.sp++->setMagic(magic)
#define POP_COPY_TO(v) (v) = *--REGS.sp
#define POP_RETURN_VALUE() REGS.fp()->setReturnValue(*--REGS.sp)
@ -2961,7 +2961,7 @@ CASE(JSOP_CALLPROP)
goto error;
TypeScript::Monitor(cx, script, REGS.pc, lval);
assertSameCompartmentDebugOnly(cx, lval);
cx->debugOnlyCheck(lval);
}
END_CASE(JSOP_GETPROP)
@ -2975,7 +2975,7 @@ CASE(JSOP_GETPROP_SUPER)
goto error;
TypeScript::Monitor(cx, script, REGS.pc, rref);
assertSameCompartmentDebugOnly(cx, rref);
cx->debugOnlyCheck(rref);
REGS.sp--;
}
@ -2990,7 +2990,7 @@ CASE(JSOP_GETBOUNDNAME)
goto error;
TypeScript::Monitor(cx, script, REGS.pc, rval);
assertSameCompartmentDebugOnly(cx, rval);
cx->debugOnlyCheck(rval);
}
END_CASE(JSOP_GETBOUNDNAME)
@ -3706,7 +3706,7 @@ CASE(JSOP_GETLOCAL)
* a use of the variable.
*/
if (REGS.pc[JSOP_GETLOCAL_LENGTH] != JSOP_POP)
assertSameCompartmentDebugOnly(cx, REGS.sp[-1]);
cx->debugOnlyCheck(REGS.sp[-1]);
}
END_CASE(JSOP_GETLOCAL)

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

@ -207,16 +207,16 @@ JSContext::releaseCheck(const Args&... args)
assertSameCompartmentImpl(this, 0, args...);
}
namespace js {
template <class... Args> inline void
assertSameCompartmentDebugOnly(JSContext* cx, const Args&... args)
template <class... Args> MOZ_ALWAYS_INLINE void
JSContext::debugOnlyCheck(const Args&... args)
{
#if defined(DEBUG) && defined(JS_CRASH_DIAGNOSTICS)
assertSameCompartmentImpl(cx, 1, args...);
assertSameCompartmentImpl(this, 0, args...);
#endif
}
namespace js {
STATIC_PRECONDITION_ASSUME(ubound(args.argv_) >= argc)
MOZ_ALWAYS_INLINE bool
CallNativeImpl(JSContext* cx, NativeImpl impl, const CallArgs& args)

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

@ -956,6 +956,7 @@ struct JSContext : public JS::RootingContext,
void removeUnhandledRejectedPromise(JSContext* cx, js::HandleObject promise);
template <class... Args> inline void releaseCheck(const Args&... args);
template <class... Args> MOZ_ALWAYS_INLINE void debugOnlyCheck(const Args&... args);
}; /* struct JSContext */
inline JS::Result<>