зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1384513 - Change all public APIs to take JS::AutoRequireNoGC instead of JS::AutoCheckCannotGC. r=jonco
Additionally, change the base class of AutoSuppressGCAnalysis from AutoAssertNoAlloc to AutoAssertNoGC. In combination, these chances enable passing either JS::AutoCheckCannotGC or JS::AutoSuppressGCAnalysis, depending on whether suppressing the GC analysis is desired or not. MozReview-Commit-ID: Eg1cl28ezeJ
This commit is contained in:
Родитель
bf07c0c605
Коммит
128de681e1
|
@ -531,28 +531,6 @@ class JS_PUBLIC_API(AutoAssertNoGC) : public AutoRequireNoGC
|
|||
~AutoAssertNoGC();
|
||||
};
|
||||
|
||||
/**
|
||||
* Assert if an allocation of a GC thing occurs while this class is live. This
|
||||
* class does not disable the static rooting hazard analysis.
|
||||
*/
|
||||
class JS_PUBLIC_API(AutoAssertNoAlloc)
|
||||
{
|
||||
#ifdef JS_DEBUG
|
||||
js::gc::GCRuntime* gc;
|
||||
|
||||
public:
|
||||
AutoAssertNoAlloc() : gc(nullptr) {}
|
||||
explicit AutoAssertNoAlloc(JSContext* cx);
|
||||
void disallowAlloc(JSRuntime* rt);
|
||||
~AutoAssertNoAlloc();
|
||||
#else
|
||||
public:
|
||||
AutoAssertNoAlloc() {}
|
||||
explicit AutoAssertNoAlloc(JSContext* cx) {}
|
||||
void disallowAlloc(JSRuntime* rt) {}
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* Disable the static rooting hazard analysis in the live region and assert if
|
||||
* any allocation that could potentially trigger a GC occurs while this guard
|
||||
|
@ -567,11 +545,11 @@ class JS_PUBLIC_API(AutoAssertNoAlloc)
|
|||
* that the hazard analysis is correct for that code, rather than relying
|
||||
* on this class.
|
||||
*/
|
||||
class JS_PUBLIC_API(AutoSuppressGCAnalysis) : public AutoAssertNoAlloc
|
||||
class JS_PUBLIC_API(AutoSuppressGCAnalysis) : public AutoAssertNoGC
|
||||
{
|
||||
public:
|
||||
AutoSuppressGCAnalysis() : AutoAssertNoAlloc() {}
|
||||
explicit AutoSuppressGCAnalysis(JSContext* cx) : AutoAssertNoAlloc(cx) {}
|
||||
AutoSuppressGCAnalysis() : AutoAssertNoGC() {}
|
||||
explicit AutoSuppressGCAnalysis(JSContext* cx) : AutoAssertNoGC(cx) {}
|
||||
} JS_HAZ_GC_SUPPRESSED;
|
||||
|
||||
/**
|
||||
|
|
|
@ -83,7 +83,7 @@ struct BreadthFirst {
|
|||
//
|
||||
// We do nothing with noGC, other than require it to exist, with a lifetime
|
||||
// that encloses our own.
|
||||
BreadthFirst(JSContext* cx, Handler& handler, const JS::AutoCheckCannotGC& noGC)
|
||||
BreadthFirst(JSContext* cx, Handler& handler, const JS::AutoRequireNoGC& noGC)
|
||||
: wantNames(true), cx(cx), visited(), handler(handler), pending(),
|
||||
traversalBegun(false), stopRequested(false), abandonRequested(false)
|
||||
{ }
|
||||
|
|
|
@ -1013,7 +1013,7 @@ JS_GetDataViewByteOffset(JSObject* obj)
|
|||
}
|
||||
|
||||
JS_FRIEND_API(void*)
|
||||
JS_GetDataViewData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
|
||||
JS_GetDataViewData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
|
||||
{
|
||||
obj = CheckedUnwrap(obj);
|
||||
if (!obj)
|
||||
|
|
|
@ -73,7 +73,7 @@ BEGIN_TEST(testTypedArrays)
|
|||
|
||||
template<JSObject* Create(JSContext*, uint32_t),
|
||||
typename Element,
|
||||
Element* GetData(JSObject*, bool* isShared, const JS::AutoCheckCannotGC&)>
|
||||
Element* GetData(JSObject*, bool* isShared, const JS::AutoRequireNoGC&)>
|
||||
bool
|
||||
TestPlainTypedArray(JSContext* cx)
|
||||
{
|
||||
|
@ -111,7 +111,7 @@ template<JSObject* CreateWithBuffer(JSContext*, JS::HandleObject, uint32_t, int3
|
|||
JSObject* CreateFromArray(JSContext*, JS::HandleObject),
|
||||
typename Element,
|
||||
bool Shared,
|
||||
Element* GetData(JSObject*, bool*, const JS::AutoCheckCannotGC&)>
|
||||
Element* GetData(JSObject*, bool*, const JS::AutoRequireNoGC&)>
|
||||
bool
|
||||
TestArrayFromBuffer(JSContext* cx)
|
||||
{
|
||||
|
|
|
@ -5452,7 +5452,7 @@ JS_StringHasLatin1Chars(JSString* str)
|
|||
}
|
||||
|
||||
JS_PUBLIC_API(const JS::Latin1Char*)
|
||||
JS_GetLatin1StringCharsAndLength(JSContext* cx, const JS::AutoCheckCannotGC& nogc, JSString* str,
|
||||
JS_GetLatin1StringCharsAndLength(JSContext* cx, const JS::AutoRequireNoGC& nogc, JSString* str,
|
||||
size_t* plength)
|
||||
{
|
||||
MOZ_ASSERT(plength);
|
||||
|
@ -5467,7 +5467,7 @@ JS_GetLatin1StringCharsAndLength(JSContext* cx, const JS::AutoCheckCannotGC& nog
|
|||
}
|
||||
|
||||
JS_PUBLIC_API(const char16_t*)
|
||||
JS_GetTwoByteStringCharsAndLength(JSContext* cx, const JS::AutoCheckCannotGC& nogc, JSString* str,
|
||||
JS_GetTwoByteStringCharsAndLength(JSContext* cx, const JS::AutoRequireNoGC& nogc, JSString* str,
|
||||
size_t* plength)
|
||||
{
|
||||
MOZ_ASSERT(plength);
|
||||
|
@ -5525,7 +5525,7 @@ JS_CopyStringChars(JSContext* cx, mozilla::Range<char16_t> dest, JSString* str)
|
|||
}
|
||||
|
||||
JS_PUBLIC_API(const Latin1Char*)
|
||||
JS_GetLatin1InternedStringChars(const JS::AutoCheckCannotGC& nogc, JSString* str)
|
||||
JS_GetLatin1InternedStringChars(const JS::AutoRequireNoGC& nogc, JSString* str)
|
||||
{
|
||||
MOZ_ASSERT(str->isAtom());
|
||||
JSFlatString* flat = str->ensureFlat(nullptr);
|
||||
|
@ -5535,7 +5535,7 @@ JS_GetLatin1InternedStringChars(const JS::AutoCheckCannotGC& nogc, JSString* str
|
|||
}
|
||||
|
||||
JS_PUBLIC_API(const char16_t*)
|
||||
JS_GetTwoByteInternedStringChars(const JS::AutoCheckCannotGC& nogc, JSString* str)
|
||||
JS_GetTwoByteInternedStringChars(const JS::AutoRequireNoGC& nogc, JSString* str)
|
||||
{
|
||||
MOZ_ASSERT(str->isAtom());
|
||||
JSFlatString* flat = str->ensureFlat(nullptr);
|
||||
|
@ -5557,13 +5557,13 @@ JS_FlattenString(JSContext* cx, JSString* str)
|
|||
}
|
||||
|
||||
extern JS_PUBLIC_API(const Latin1Char*)
|
||||
JS_GetLatin1FlatStringChars(const JS::AutoCheckCannotGC& nogc, JSFlatString* str)
|
||||
JS_GetLatin1FlatStringChars(const JS::AutoRequireNoGC& nogc, JSFlatString* str)
|
||||
{
|
||||
return str->latin1Chars(nogc);
|
||||
}
|
||||
|
||||
extern JS_PUBLIC_API(const char16_t*)
|
||||
JS_GetTwoByteFlatStringChars(const JS::AutoCheckCannotGC& nogc, JSFlatString* str)
|
||||
JS_GetTwoByteFlatStringChars(const JS::AutoRequireNoGC& nogc, JSFlatString* str)
|
||||
{
|
||||
return str->twoByteChars(nogc);
|
||||
}
|
||||
|
|
|
@ -5005,11 +5005,11 @@ extern JS_PUBLIC_API(bool)
|
|||
JS_StringHasLatin1Chars(JSString* str);
|
||||
|
||||
extern JS_PUBLIC_API(const JS::Latin1Char*)
|
||||
JS_GetLatin1StringCharsAndLength(JSContext* cx, const JS::AutoCheckCannotGC& nogc, JSString* str,
|
||||
JS_GetLatin1StringCharsAndLength(JSContext* cx, const JS::AutoRequireNoGC& nogc, JSString* str,
|
||||
size_t* length);
|
||||
|
||||
extern JS_PUBLIC_API(const char16_t*)
|
||||
JS_GetTwoByteStringCharsAndLength(JSContext* cx, const JS::AutoCheckCannotGC& nogc, JSString* str,
|
||||
JS_GetTwoByteStringCharsAndLength(JSContext* cx, const JS::AutoRequireNoGC& nogc, JSString* str,
|
||||
size_t* length);
|
||||
|
||||
extern JS_PUBLIC_API(bool)
|
||||
|
@ -5028,10 +5028,10 @@ extern JS_PUBLIC_API(JSFlatString*)
|
|||
JS_FlattenString(JSContext* cx, JSString* str);
|
||||
|
||||
extern JS_PUBLIC_API(const JS::Latin1Char*)
|
||||
JS_GetLatin1FlatStringChars(const JS::AutoCheckCannotGC& nogc, JSFlatString* str);
|
||||
JS_GetLatin1FlatStringChars(const JS::AutoRequireNoGC& nogc, JSFlatString* str);
|
||||
|
||||
extern JS_PUBLIC_API(const char16_t*)
|
||||
JS_GetTwoByteFlatStringChars(const JS::AutoCheckCannotGC& nogc, JSFlatString* str);
|
||||
JS_GetTwoByteFlatStringChars(const JS::AutoRequireNoGC& nogc, JSFlatString* str);
|
||||
|
||||
static MOZ_ALWAYS_INLINE JSFlatString*
|
||||
JSID_TO_FLAT_STRING(jsid id)
|
||||
|
|
|
@ -818,7 +818,7 @@ StringHasLatin1Chars(JSString* s)
|
|||
}
|
||||
|
||||
MOZ_ALWAYS_INLINE const JS::Latin1Char*
|
||||
GetLatin1LinearStringChars(const JS::AutoCheckCannotGC& nogc, JSLinearString* linear)
|
||||
GetLatin1LinearStringChars(const JS::AutoRequireNoGC& nogc, JSLinearString* linear)
|
||||
{
|
||||
MOZ_ASSERT(LinearStringHasLatin1Chars(linear));
|
||||
|
||||
|
@ -830,7 +830,7 @@ GetLatin1LinearStringChars(const JS::AutoCheckCannotGC& nogc, JSLinearString* li
|
|||
}
|
||||
|
||||
MOZ_ALWAYS_INLINE const char16_t*
|
||||
GetTwoByteLinearStringChars(const JS::AutoCheckCannotGC& nogc, JSLinearString* linear)
|
||||
GetTwoByteLinearStringChars(const JS::AutoRequireNoGC& nogc, JSLinearString* linear)
|
||||
{
|
||||
MOZ_ASSERT(!LinearStringHasLatin1Chars(linear));
|
||||
|
||||
|
@ -860,13 +860,13 @@ FlatStringToLinearString(JSFlatString* s)
|
|||
}
|
||||
|
||||
MOZ_ALWAYS_INLINE const JS::Latin1Char*
|
||||
GetLatin1AtomChars(const JS::AutoCheckCannotGC& nogc, JSAtom* atom)
|
||||
GetLatin1AtomChars(const JS::AutoRequireNoGC& nogc, JSAtom* atom)
|
||||
{
|
||||
return GetLatin1LinearStringChars(nogc, AtomToLinearString(atom));
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_INLINE const char16_t*
|
||||
GetTwoByteAtomChars(const JS::AutoCheckCannotGC& nogc, JSAtom* atom)
|
||||
GetTwoByteAtomChars(const JS::AutoRequireNoGC& nogc, JSAtom* atom)
|
||||
{
|
||||
return GetTwoByteLinearStringChars(nogc, AtomToLinearString(atom));
|
||||
}
|
||||
|
@ -1954,7 +1954,7 @@ GetSharedArrayBufferLengthAndData(JSObject* obj, uint32_t* length, bool* isShare
|
|||
} // namespace js
|
||||
|
||||
JS_FRIEND_API(uint8_t*)
|
||||
JS_GetSharedArrayBufferData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
|
||||
JS_GetSharedArrayBufferData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
||||
|
||||
/*
|
||||
* Unwrap Typed arrays all at once. Return nullptr without throwing if the
|
||||
|
@ -2052,7 +2052,7 @@ JS_ArrayBufferHasData(JSObject* obj);
|
|||
* its use from code that also interacts with SharedArrayBuffer.
|
||||
*/
|
||||
extern JS_FRIEND_API(uint8_t*)
|
||||
JS_GetArrayBufferData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
|
||||
JS_GetArrayBufferData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
||||
|
||||
/**
|
||||
* Check whether the obj is ArrayBufferObject and memory mapped. Note that this
|
||||
|
@ -2123,30 +2123,30 @@ JS_GetArrayBufferViewByteLength(JSObject* obj);
|
|||
*/
|
||||
|
||||
extern JS_FRIEND_API(int8_t*)
|
||||
JS_GetInt8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
|
||||
JS_GetInt8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
||||
extern JS_FRIEND_API(uint8_t*)
|
||||
JS_GetUint8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
|
||||
JS_GetUint8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
||||
extern JS_FRIEND_API(uint8_t*)
|
||||
JS_GetUint8ClampedArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
|
||||
JS_GetUint8ClampedArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
||||
extern JS_FRIEND_API(int16_t*)
|
||||
JS_GetInt16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
|
||||
JS_GetInt16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
||||
extern JS_FRIEND_API(uint16_t*)
|
||||
JS_GetUint16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
|
||||
JS_GetUint16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
||||
extern JS_FRIEND_API(int32_t*)
|
||||
JS_GetInt32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
|
||||
JS_GetInt32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
||||
extern JS_FRIEND_API(uint32_t*)
|
||||
JS_GetUint32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
|
||||
JS_GetUint32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
||||
extern JS_FRIEND_API(float*)
|
||||
JS_GetFloat32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
|
||||
JS_GetFloat32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
||||
extern JS_FRIEND_API(double*)
|
||||
JS_GetFloat64ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
|
||||
JS_GetFloat64ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
||||
|
||||
/**
|
||||
* Same as above, but for any kind of ArrayBufferView. Prefer the type-specific
|
||||
* versions when possible.
|
||||
*/
|
||||
extern JS_FRIEND_API(void*)
|
||||
JS_GetArrayBufferViewData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
|
||||
JS_GetArrayBufferViewData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
||||
|
||||
/**
|
||||
* Return the ArrayBuffer or SharedArrayBuffer underlying an ArrayBufferView.
|
||||
|
@ -2223,7 +2223,7 @@ JS_GetDataViewByteLength(JSObject* obj);
|
|||
* otherwise to false.
|
||||
*/
|
||||
JS_FRIEND_API(void*)
|
||||
JS_GetDataViewData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
|
||||
JS_GetDataViewData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
|
||||
|
||||
namespace js {
|
||||
|
||||
|
|
|
@ -7794,35 +7794,19 @@ js::gc::AssertGCThingHasType(js::gc::Cell* cell, JS::TraceKind kind)
|
|||
JS::AutoAssertNoGC::AutoAssertNoGC(JSContext* maybecx)
|
||||
: cx_(maybecx ? maybecx : TlsContext.get())
|
||||
{
|
||||
cx_->inUnsafeRegion++;
|
||||
if (cx_)
|
||||
cx_->inUnsafeRegion++;
|
||||
}
|
||||
|
||||
JS::AutoAssertNoGC::~AutoAssertNoGC()
|
||||
{
|
||||
MOZ_ASSERT(cx_->inUnsafeRegion > 0);
|
||||
cx_->inUnsafeRegion--;
|
||||
if (cx_) {
|
||||
MOZ_ASSERT(cx_->inUnsafeRegion > 0);
|
||||
cx_->inUnsafeRegion--;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
JS::AutoAssertNoAlloc::AutoAssertNoAlloc(JSContext* cx)
|
||||
: gc(nullptr)
|
||||
{
|
||||
disallowAlloc(cx->runtime());
|
||||
}
|
||||
|
||||
void JS::AutoAssertNoAlloc::disallowAlloc(JSRuntime* rt)
|
||||
{
|
||||
MOZ_ASSERT(!gc);
|
||||
gc = &rt->gc;
|
||||
TlsContext.get()->disallowAlloc();
|
||||
}
|
||||
|
||||
JS::AutoAssertNoAlloc::~AutoAssertNoAlloc()
|
||||
{
|
||||
if (gc)
|
||||
TlsContext.get()->allowAlloc();
|
||||
}
|
||||
|
||||
AutoAssertNoNurseryAlloc::AutoAssertNoNurseryAlloc()
|
||||
{
|
||||
TlsContext.get()->disallowNurseryAlloc();
|
||||
|
|
|
@ -1615,7 +1615,7 @@ JS_GetArrayBufferByteLength(JSObject* obj)
|
|||
}
|
||||
|
||||
JS_FRIEND_API(uint8_t*)
|
||||
JS_GetArrayBufferData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
|
||||
JS_GetArrayBufferData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
|
||||
{
|
||||
obj = CheckedUnwrap(obj);
|
||||
if (!obj)
|
||||
|
@ -1832,7 +1832,7 @@ JS_IsMappedArrayBufferObject(JSObject* obj)
|
|||
}
|
||||
|
||||
JS_FRIEND_API(void*)
|
||||
JS_GetArrayBufferViewData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
|
||||
JS_GetArrayBufferViewData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
|
||||
{
|
||||
obj = CheckedUnwrap(obj);
|
||||
if (!obj)
|
||||
|
|
|
@ -513,7 +513,7 @@ JS_IsSharedArrayBufferObject(JSObject* obj)
|
|||
}
|
||||
|
||||
JS_FRIEND_API(uint8_t*)
|
||||
JS_GetSharedArrayBufferData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
|
||||
JS_GetSharedArrayBufferData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
|
||||
{
|
||||
obj = CheckedUnwrap(obj);
|
||||
if (!obj)
|
||||
|
|
|
@ -652,17 +652,17 @@ class JSLinearString : public JSString
|
|||
public:
|
||||
template<typename CharT>
|
||||
MOZ_ALWAYS_INLINE
|
||||
const CharT* nonInlineChars(const JS::AutoCheckCannotGC& nogc) const;
|
||||
const CharT* nonInlineChars(const JS::AutoRequireNoGC& nogc) const;
|
||||
|
||||
MOZ_ALWAYS_INLINE
|
||||
const JS::Latin1Char* nonInlineLatin1Chars(const JS::AutoCheckCannotGC& nogc) const {
|
||||
const JS::Latin1Char* nonInlineLatin1Chars(const JS::AutoRequireNoGC& nogc) const {
|
||||
MOZ_ASSERT(!isInline());
|
||||
MOZ_ASSERT(hasLatin1Chars());
|
||||
return d.s.u2.nonInlineCharsLatin1;
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_INLINE
|
||||
const char16_t* nonInlineTwoByteChars(const JS::AutoCheckCannotGC& nogc) const {
|
||||
const char16_t* nonInlineTwoByteChars(const JS::AutoRequireNoGC& nogc) const {
|
||||
MOZ_ASSERT(!isInline());
|
||||
MOZ_ASSERT(hasTwoByteChars());
|
||||
return d.s.u2.nonInlineCharsTwoByte;
|
||||
|
@ -670,24 +670,24 @@ class JSLinearString : public JSString
|
|||
|
||||
template<typename CharT>
|
||||
MOZ_ALWAYS_INLINE
|
||||
const CharT* chars(const JS::AutoCheckCannotGC& nogc) const;
|
||||
const CharT* chars(const JS::AutoRequireNoGC& nogc) const;
|
||||
|
||||
MOZ_ALWAYS_INLINE
|
||||
const JS::Latin1Char* latin1Chars(const JS::AutoCheckCannotGC& nogc) const {
|
||||
const JS::Latin1Char* latin1Chars(const JS::AutoRequireNoGC& nogc) const {
|
||||
return rawLatin1Chars();
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_INLINE
|
||||
const char16_t* twoByteChars(const JS::AutoCheckCannotGC& nogc) const {
|
||||
const char16_t* twoByteChars(const JS::AutoRequireNoGC& nogc) const {
|
||||
return rawTwoByteChars();
|
||||
}
|
||||
|
||||
mozilla::Range<const JS::Latin1Char> latin1Range(const JS::AutoCheckCannotGC& nogc) const {
|
||||
mozilla::Range<const JS::Latin1Char> latin1Range(const JS::AutoRequireNoGC& nogc) const {
|
||||
MOZ_ASSERT(JSString::isLinear());
|
||||
return mozilla::Range<const JS::Latin1Char>(latin1Chars(nogc), length());
|
||||
}
|
||||
|
||||
mozilla::Range<const char16_t> twoByteRange(const JS::AutoCheckCannotGC& nogc) const {
|
||||
mozilla::Range<const char16_t> twoByteRange(const JS::AutoRequireNoGC& nogc) const {
|
||||
MOZ_ASSERT(JSString::isLinear());
|
||||
return mozilla::Range<const char16_t>(twoByteChars(nogc), length());
|
||||
}
|
||||
|
@ -864,14 +864,14 @@ class JSInlineString : public JSFlatString
|
|||
{
|
||||
public:
|
||||
MOZ_ALWAYS_INLINE
|
||||
const JS::Latin1Char* latin1Chars(const JS::AutoCheckCannotGC& nogc) const {
|
||||
const JS::Latin1Char* latin1Chars(const JS::AutoRequireNoGC& nogc) const {
|
||||
MOZ_ASSERT(JSString::isInline());
|
||||
MOZ_ASSERT(hasLatin1Chars());
|
||||
return d.inlineStorageLatin1;
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_INLINE
|
||||
const char16_t* twoByteChars(const JS::AutoCheckCannotGC& nogc) const {
|
||||
const char16_t* twoByteChars(const JS::AutoRequireNoGC& nogc) const {
|
||||
MOZ_ASSERT(JSString::isInline());
|
||||
MOZ_ASSERT(hasTwoByteChars());
|
||||
return d.inlineStorageTwoByte;
|
||||
|
@ -1424,28 +1424,28 @@ JSString::base() const
|
|||
|
||||
template<>
|
||||
MOZ_ALWAYS_INLINE const char16_t*
|
||||
JSLinearString::nonInlineChars(const JS::AutoCheckCannotGC& nogc) const
|
||||
JSLinearString::nonInlineChars(const JS::AutoRequireNoGC& nogc) const
|
||||
{
|
||||
return nonInlineTwoByteChars(nogc);
|
||||
}
|
||||
|
||||
template<>
|
||||
MOZ_ALWAYS_INLINE const JS::Latin1Char*
|
||||
JSLinearString::nonInlineChars(const JS::AutoCheckCannotGC& nogc) const
|
||||
JSLinearString::nonInlineChars(const JS::AutoRequireNoGC& nogc) const
|
||||
{
|
||||
return nonInlineLatin1Chars(nogc);
|
||||
}
|
||||
|
||||
template<>
|
||||
MOZ_ALWAYS_INLINE const char16_t*
|
||||
JSLinearString::chars(const JS::AutoCheckCannotGC& nogc) const
|
||||
JSLinearString::chars(const JS::AutoRequireNoGC& nogc) const
|
||||
{
|
||||
return rawTwoByteChars();
|
||||
}
|
||||
|
||||
template<>
|
||||
MOZ_ALWAYS_INLINE const JS::Latin1Char*
|
||||
JSLinearString::chars(const JS::AutoCheckCannotGC& nogc) const
|
||||
JSLinearString::chars(const JS::AutoRequireNoGC& nogc) const
|
||||
{
|
||||
return rawLatin1Chars();
|
||||
}
|
||||
|
|
|
@ -2349,7 +2349,7 @@ JS_GetArrayBufferViewType(JSObject* obj)
|
|||
}
|
||||
|
||||
JS_FRIEND_API(int8_t*)
|
||||
JS_GetInt8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
|
||||
JS_GetInt8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
|
||||
{
|
||||
obj = CheckedUnwrap(obj);
|
||||
if (!obj)
|
||||
|
@ -2361,7 +2361,7 @@ JS_GetInt8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCann
|
|||
}
|
||||
|
||||
JS_FRIEND_API(uint8_t*)
|
||||
JS_GetUint8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
|
||||
JS_GetUint8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
|
||||
{
|
||||
obj = CheckedUnwrap(obj);
|
||||
if (!obj)
|
||||
|
@ -2373,7 +2373,7 @@ JS_GetUint8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCan
|
|||
}
|
||||
|
||||
JS_FRIEND_API(uint8_t*)
|
||||
JS_GetUint8ClampedArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
|
||||
JS_GetUint8ClampedArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
|
||||
{
|
||||
obj = CheckedUnwrap(obj);
|
||||
if (!obj)
|
||||
|
@ -2385,7 +2385,7 @@ JS_GetUint8ClampedArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoC
|
|||
}
|
||||
|
||||
JS_FRIEND_API(int16_t*)
|
||||
JS_GetInt16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
|
||||
JS_GetInt16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
|
||||
{
|
||||
obj = CheckedUnwrap(obj);
|
||||
if (!obj)
|
||||
|
@ -2397,7 +2397,7 @@ JS_GetInt16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCan
|
|||
}
|
||||
|
||||
JS_FRIEND_API(uint16_t*)
|
||||
JS_GetUint16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
|
||||
JS_GetUint16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
|
||||
{
|
||||
obj = CheckedUnwrap(obj);
|
||||
if (!obj)
|
||||
|
@ -2409,7 +2409,7 @@ JS_GetUint16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCa
|
|||
}
|
||||
|
||||
JS_FRIEND_API(int32_t*)
|
||||
JS_GetInt32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
|
||||
JS_GetInt32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
|
||||
{
|
||||
obj = CheckedUnwrap(obj);
|
||||
if (!obj)
|
||||
|
@ -2421,7 +2421,7 @@ JS_GetInt32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCan
|
|||
}
|
||||
|
||||
JS_FRIEND_API(uint32_t*)
|
||||
JS_GetUint32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
|
||||
JS_GetUint32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
|
||||
{
|
||||
obj = CheckedUnwrap(obj);
|
||||
if (!obj)
|
||||
|
@ -2433,7 +2433,7 @@ JS_GetUint32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCa
|
|||
}
|
||||
|
||||
JS_FRIEND_API(float*)
|
||||
JS_GetFloat32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
|
||||
JS_GetFloat32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
|
||||
{
|
||||
obj = CheckedUnwrap(obj);
|
||||
if (!obj)
|
||||
|
@ -2445,7 +2445,7 @@ JS_GetFloat32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckC
|
|||
}
|
||||
|
||||
JS_FRIEND_API(double*)
|
||||
JS_GetFloat64ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
|
||||
JS_GetFloat64ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
|
||||
{
|
||||
obj = CheckedUnwrap(obj);
|
||||
if (!obj)
|
||||
|
|
Загрузка…
Ссылка в новой задаче