Bug 1040316 - Move AutoStableStringChars out of friendapi into public API. r=jandem

--HG--
extra : rebase_source : 3f66710e9517aba203a3d5365f6c3f0102c7baf8
This commit is contained in:
Jeff Walden 2018-08-20 07:44:44 -07:00
parent 407a8b6081
commit cd10720691
32 changed files with 202 additions and 102 deletions

View File

@ -20,6 +20,7 @@
#include "jsapi.h"
#include "jsfriendapi.h"
#include "js/Conversions.h"
#include "js/StableStringChars.h"
#include "nsString.h"
class nsIScriptContext;
@ -225,7 +226,7 @@ template<typename T>
inline bool
AssignJSString(JSContext *cx, T &dest, JSString *s)
{
size_t len = js::GetStringLength(s);
size_t len = JS::GetStringLength(s);
static_assert(js::MaxStringLength < (1 << 28),
"Shouldn't overflow here or in SetCapacity");
if (MOZ_UNLIKELY(!dest.SetLength(len, mozilla::fallible))) {

View File

@ -17,6 +17,7 @@
#include "mozilla/UseCounter.h"
#include "AccessCheck.h"
#include "js/StableStringChars.h"
#include "jsfriendapi.h"
#include "nsContentCreatorFunctions.h"
#include "nsContentUtils.h"
@ -2858,7 +2859,7 @@ ConvertJSValueToByteString(JSContext* cx, JS::Handle<JS::Value> v,
return false;
}
} else {
length = js::GetStringLength(s);
length = JS::GetStringLength(s);
}
static_assert(js::MaxStringLength < UINT32_MAX,

View File

@ -11,6 +11,7 @@
#include "mozilla/dom/WorkerPrivate.h"
#include "jsapi.h"
#include "js/StableStringChars.h"
#include "xpcpublic.h"
#include "nsIGlobalObject.h"
#include "nsIDocShell.h"
@ -710,7 +711,7 @@ AutoEntryScript::DocshellEntryMonitor::Entry(JSContext* aCx, JSFunction* aFuncti
nsString filename;
uint32_t lineNumber = 0;
js::AutoStableStringChars functionName(aCx);
JS::AutoStableStringChars functionName(aCx);
if (rootedFunction) {
JS::Rooted<JSString*> displayId(aCx, JS_GetFunctionDisplayId(rootedFunction));
if (displayId) {

View File

@ -0,0 +1,123 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Safely access the contents of a string even as GC can cause the string's
* contents to move around in memory.
*/
#ifndef js_StableStringChars_h
#define js_StableStringChars_h
#include "mozilla/Assertions.h" // MOZ_ASSERT
#include "mozilla/Attributes.h" // MOZ_INIT_OUTSIDE_CTOR, MOZ_STACK_CLASS, MOZ_MUST_USE
#include "mozilla/Maybe.h" // mozilla::Maybe
#include "mozilla/Range.h" // mozilla::Range
#include <stddef.h> // size_t
#include <stdint.h> // uint8_t
#include "jstypes.h" // JS_FRIEND_API
#include "js/HeapAPI.h" // JS::shadow::String
#include "js/RootingAPI.h" // JS::Handle, JS::Rooted
#include "js/TypeDecls.h" // JSContext, JS::Latin1Char, JSString
#include "js/Vector.h" // js::Vector
class JSLinearString;
namespace JS {
MOZ_ALWAYS_INLINE size_t
GetStringLength(JSString* s)
{
return reinterpret_cast<shadow::String*>(s)->length();
}
/**
* This class provides safe access to a string's chars across a GC. Once
* we allocate strings and chars in the nursery (bug 903519), this class
* will have to make a copy of the string's chars if they are allocated
* in the nursery, so it's best to avoid using this class unless you really
* need it. It's usually more efficient to use the latin1Chars/twoByteChars
* JSString methods and often the code can be rewritten so that only indexes
* instead of char pointers are used in parts of the code that can GC.
*/
class MOZ_STACK_CLASS JS_FRIEND_API(AutoStableStringChars) final
{
/*
* When copying string char, use this many bytes of inline storage. This is
* chosen to allow the inline string types to be copied without allocating.
* This is asserted in AutoStableStringChars::allocOwnChars.
*/
static const size_t InlineCapacity = 24;
/* Ensure the string is kept alive while we're using its chars. */
Rooted<JSString*> s_;
MOZ_INIT_OUTSIDE_CTOR union {
const char16_t* twoByteChars_;
const Latin1Char* latin1Chars_;
};
mozilla::Maybe<js::Vector<uint8_t, InlineCapacity>> ownChars_;
enum State { Uninitialized, Latin1, TwoByte };
State state_;
public:
explicit AutoStableStringChars(JSContext* cx)
: s_(cx), state_(Uninitialized)
{}
MOZ_MUST_USE bool init(JSContext* cx, JSString* s);
/* Like init(), but Latin1 chars are inflated to TwoByte. */
MOZ_MUST_USE bool initTwoByte(JSContext* cx, JSString* s);
bool isLatin1() const { return state_ == Latin1; }
bool isTwoByte() const { return state_ == TwoByte; }
const Latin1Char* latin1Chars() const {
MOZ_ASSERT(state_ == Latin1);
return latin1Chars_;
}
const char16_t* twoByteChars() const {
MOZ_ASSERT(state_ == TwoByte);
return twoByteChars_;
}
mozilla::Range<const Latin1Char> latin1Range() const {
MOZ_ASSERT(state_ == Latin1);
return mozilla::Range<const Latin1Char>(latin1Chars_, GetStringLength(s_));
}
mozilla::Range<const char16_t> twoByteRange() const {
MOZ_ASSERT(state_ == TwoByte);
return mozilla::Range<const char16_t>(twoByteChars_,
GetStringLength(s_));
}
/* If we own the chars, transfer ownership to the caller. */
bool maybeGiveOwnershipToCaller() {
MOZ_ASSERT(state_ != Uninitialized);
if (!ownChars_.isSome() || !ownChars_->extractRawBuffer())
return false;
state_ = Uninitialized;
ownChars_.reset();
return true;
}
private:
AutoStableStringChars(const AutoStableStringChars& other) = delete;
void operator=(const AutoStableStringChars& other) = delete;
bool baseIsInline(Handle<JSLinearString*> linearString);
template <typename T> T* allocOwnChars(JSContext* cx, size_t count);
bool copyLatin1Chars(JSContext* cx, Handle<JSLinearString*> linearString);
bool copyTwoByteChars(JSContext* cx, Handle<JSLinearString*> linearString);
bool copyAndInflateLatin1Chars(JSContext*, Handle<JSLinearString*> linearString);
};
} // namespace JS
#endif /* js_StableStringChars_h */

View File

@ -11,6 +11,7 @@
#include "frontend/BytecodeCompiler.h"
#include "gc/HashUtil.h"
#include "js/StableStringChars.h"
#include "vm/Debugger.h"
#include "vm/GlobalObject.h"
#include "vm/JSContext.h"
@ -25,6 +26,7 @@ using mozilla::HashString;
using mozilla::RangedPtr;
using JS::AutoCheckCannotGC;
using JS::AutoStableStringChars;
// We should be able to assert this for *any* fp->environmentChain().
static void

View File

@ -19,6 +19,7 @@
#include "builtin/BigInt.h"
#endif
#include "builtin/String.h"
#include "js/StableStringChars.h"
#include "util/StringBuffer.h"
#include "vm/Interpreter.h"
#include "vm/JSAtom.h"
@ -38,6 +39,8 @@ using mozilla::IsFinite;
using mozilla::Maybe;
using mozilla::RangedPtr;
using JS::AutoStableStringChars;
const Class js::JSONClass = {
js_JSON_str,
JSCLASS_HAS_CACHED_PROTO(JSProto_JSON)

View File

@ -19,6 +19,7 @@
#include "frontend/Parser.h"
#include "frontend/TokenStream.h"
#include "js/CharacterEncoding.h"
#include "js/StableStringChars.h"
#include "vm/JSAtom.h"
#include "vm/JSObject.h"
#include "vm/RegExpObject.h"
@ -29,6 +30,7 @@
using namespace js;
using namespace js::frontend;
using JS::AutoStableStringChars;
using JS::AutoValueArray;
using mozilla::DebugOnly;

View File

@ -31,6 +31,7 @@
#include "builtin/RegExp.h"
#include "jit/InlinableNatives.h"
#include "js/Conversions.h"
#include "js/StableStringChars.h"
#include "js/UniquePtr.h"
#if ENABLE_INTL_API
# include "unicode/uchar.h"
@ -68,6 +69,7 @@ using mozilla::PodCopy;
using mozilla::RangedPtr;
using JS::AutoCheckCannotGC;
using JS::AutoStableStringChars;
static JSLinearString*
ArgToLinearString(JSContext* cx, const CallArgs& args, unsigned argno)

View File

@ -43,6 +43,7 @@
#include "jit/JitRealm.h"
#include "js/Debug.h"
#include "js/HashTable.h"
#include "js/StableStringChars.h"
#include "js/StructuredClone.h"
#include "js/UbiNode.h"
#include "js/UbiNodeBreadthFirst.h"
@ -85,6 +86,8 @@ using namespace js;
using mozilla::ArrayLength;
using mozilla::Maybe;
using JS::AutoStableStringChars;
// If fuzzingSafe is set, remove functionality that could cause problems with
// fuzzers. Set this via the environment variable MOZ_FUZZING_SAFE.
mozilla::Atomic<bool> fuzzingSafe(false);

View File

@ -17,6 +17,7 @@
#include "builtin/intl/ScopedICUObject.h"
#include "builtin/intl/SharedIntlData.h"
#include "gc/FreeOp.h"
#include "js/StableStringChars.h"
#include "js/TypeDecls.h"
#include "vm/GlobalObject.h"
#include "vm/JSContext.h"
@ -27,6 +28,8 @@
using namespace js;
using JS::AutoStableStringChars;
using js::intl::GetAvailableLocales;
using js::intl::IcuLocale;
using js::intl::ReportInternalError;

View File

@ -19,6 +19,7 @@
#include "builtin/intl/SharedIntlData.h"
#include "builtin/intl/TimeZoneDataGenerated.h"
#include "gc/FreeOp.h"
#include "js/StableStringChars.h"
#include "vm/DateTime.h"
#include "vm/GlobalObject.h"
#include "vm/JSContext.h"
@ -29,6 +30,7 @@
using namespace js;
using JS::AutoStableStringChars;
using JS::ClippedTime;
using JS::TimeClip;

View File

@ -22,6 +22,7 @@
#include "builtin/intl/PluralRules.h"
#include "builtin/intl/ScopedICUObject.h"
#include "js/Class.h"
#include "js/StableStringChars.h"
#include "vm/GlobalObject.h"
#include "vm/JSContext.h"
#include "vm/JSObject.h"
@ -34,6 +35,8 @@ using namespace js;
using mozilla::Range;
using mozilla::RangedPtr;
using JS::AutoStableStringChars;
using js::intl::CallICU;
using js::intl::DateTimeFormatOptions;
using js::intl::IcuLocale;

View File

@ -21,6 +21,7 @@
#include "ds/Sort.h"
#include "gc/FreeOp.h"
#include "js/RootingAPI.h"
#include "js/StableStringChars.h"
#include "js/TypeDecls.h"
#include "vm/JSContext.h"
#include "vm/SelfHosting.h"
@ -40,6 +41,8 @@ using js::intl::DateTimeFormatOptions;
using js::intl::GetAvailableLocales;
using js::intl::IcuLocale;
using JS::AutoStableStringChars;
const ClassOps NumberFormatObject::classOps_ = {
nullptr, /* addProperty */
nullptr, /* delProperty */

View File

@ -40,6 +40,7 @@
#include "gc/Policy.h"
#include "gc/Zone.h"
#include "jit/AtomicOperations.h"
#include "js/StableStringChars.h"
#include "js/UniquePtr.h"
#include "js/Vector.h"
#include "util/Windows.h"
@ -54,6 +55,7 @@ using mozilla::IsAsciiAlpha;
using mozilla::IsAsciiDigit;
using JS::AutoCheckCannotGC;
using JS::AutoStableStringChars;
namespace js {
namespace ctypes {

View File

@ -10,6 +10,9 @@
#include "prlink.h"
#include "ctypes/CTypes.h"
#include "js/StableStringChars.h"
using JS::AutoStableStringChars;
namespace js {
namespace ctypes {

View File

@ -61,6 +61,7 @@
#include "js/Initialization.h"
#include "js/Proxy.h"
#include "js/SliceBudget.h"
#include "js/StableStringChars.h"
#include "js/StructuredClone.h"
#include "js/Utility.h"
#include "js/Wrapper.h"
@ -108,6 +109,8 @@ using mozilla::Maybe;
using mozilla::PodCopy;
using mozilla::Some;
using JS::AutoStableStringChars;
#ifdef HAVE_VA_LIST_AS_ARRAY
#define JS_ADDRESSOF_VA_LIST(ap) ((va_list*)(ap))
#else

View File

@ -20,6 +20,7 @@
#include "js/CallNonGenericMethod.h"
#include "js/Class.h"
#include "js/HeapAPI.h"
#include "js/StableStringChars.h"
#include "js/TypeDecls.h"
#include "js/Utility.h"
@ -38,7 +39,6 @@
#endif
struct JSErrorFormatString;
class JSLinearString;
struct JSJitInfo;
class JSErrorReport;
@ -800,12 +800,6 @@ GetAtomLength(JSAtom* atom)
static const uint32_t MaxStringLength = (1 << 28) - 1;
MOZ_ALWAYS_INLINE size_t
GetStringLength(JSString* s)
{
return reinterpret_cast<JS::shadow::String*>(s)->length();
}
MOZ_ALWAYS_INLINE size_t
GetFlatStringLength(JSFlatString* s)
{
@ -1398,94 +1392,6 @@ namespace js {
extern JS_FRIEND_API(const JSErrorFormatString*)
GetErrorMessage(void* userRef, const unsigned errorNumber);
// AutoStableStringChars is here so we can use it in ErrorReport. It
// should get moved out of here if we can manage it. See bug 1040316.
/**
* This class provides safe access to a string's chars across a GC. Once
* we allocate strings and chars in the nursery (bug 903519), this class
* will have to make a copy of the string's chars if they are allocated
* in the nursery, so it's best to avoid using this class unless you really
* need it. It's usually more efficient to use the latin1Chars/twoByteChars
* JSString methods and often the code can be rewritten so that only indexes
* instead of char pointers are used in parts of the code that can GC.
*/
class MOZ_STACK_CLASS JS_FRIEND_API(AutoStableStringChars)
{
/*
* When copying string char, use this many bytes of inline storage. This is
* chosen to allow the inline string types to be copied without allocating.
* This is asserted in AutoStableStringChars::allocOwnChars.
*/
static const size_t InlineCapacity = 24;
/* Ensure the string is kept alive while we're using its chars. */
JS::RootedString s_;
MOZ_INIT_OUTSIDE_CTOR union {
const char16_t* twoByteChars_;
const JS::Latin1Char* latin1Chars_;
};
mozilla::Maybe<Vector<uint8_t, InlineCapacity>> ownChars_;
enum State { Uninitialized, Latin1, TwoByte };
State state_;
public:
explicit AutoStableStringChars(JSContext* cx)
: s_(cx), state_(Uninitialized)
{}
MOZ_MUST_USE
bool init(JSContext* cx, JSString* s);
/* Like init(), but Latin1 chars are inflated to TwoByte. */
MOZ_MUST_USE
bool initTwoByte(JSContext* cx, JSString* s);
bool isLatin1() const { return state_ == Latin1; }
bool isTwoByte() const { return state_ == TwoByte; }
const JS::Latin1Char* latin1Chars() const {
MOZ_ASSERT(state_ == Latin1);
return latin1Chars_;
}
const char16_t* twoByteChars() const {
MOZ_ASSERT(state_ == TwoByte);
return twoByteChars_;
}
mozilla::Range<const JS::Latin1Char> latin1Range() const {
MOZ_ASSERT(state_ == Latin1);
return mozilla::Range<const JS::Latin1Char>(latin1Chars_,
GetStringLength(s_));
}
mozilla::Range<const char16_t> twoByteRange() const {
MOZ_ASSERT(state_ == TwoByte);
return mozilla::Range<const char16_t>(twoByteChars_,
GetStringLength(s_));
}
/* If we own the chars, transfer ownership to the caller. */
bool maybeGiveOwnershipToCaller() {
MOZ_ASSERT(state_ != Uninitialized);
if (!ownChars_.isSome() || !ownChars_->extractRawBuffer())
return false;
state_ = Uninitialized;
ownChars_.reset();
return true;
}
private:
AutoStableStringChars(const AutoStableStringChars& other) = delete;
void operator=(const AutoStableStringChars& other) = delete;
bool baseIsInline(JS::Handle<JSLinearString*> linearString);
template <typename T> T* allocOwnChars(JSContext* cx, size_t count);
bool copyLatin1Chars(JSContext* cx, JS::Handle<JSLinearString*> linearString);
bool copyTwoByteChars(JSContext* cx, JS::Handle<JSLinearString*> linearString);
bool copyAndInflateLatin1Chars(JSContext*, JS::Handle<JSLinearString*> linearString);
};
struct MOZ_STACK_CLASS JS_FRIEND_API(ErrorReport)
{
explicit ErrorReport(JSContext* cx);
@ -1561,7 +1467,7 @@ struct MOZ_STACK_CLASS JS_FRIEND_API(ErrorReport)
JS::RootedString str;
// And keep its chars alive too.
AutoStableStringChars strChars;
JS::AutoStableStringChars strChars;
// And we need to root our exception value.
JS::RootedObject exnObject;

View File

@ -154,6 +154,7 @@ EXPORTS.js += [
'../public/Result.h',
'../public/RootingAPI.h',
'../public/SliceBudget.h',
'../public/StableStringChars.h',
'../public/Stream.h',
'../public/StructuredClone.h',
'../public/SweepingAPI.h',

View File

@ -12,6 +12,7 @@
#include "jsapi.h"
#include "js/StableStringChars.h"
#include "js/Wrapper.h"
#include "proxy/DeadObjectProxy.h"
#include "proxy/ScriptedProxyHandler.h"
@ -27,6 +28,8 @@
using namespace js;
using namespace js::gc;
using JS::AutoStableStringChars;
void
js::AutoEnterPolicy::reportErrorIfExceptionIsNotPending(JSContext* cx, jsid id)
{

View File

@ -8,11 +8,14 @@
#include "jsfriendapi.h"
#include "NamespaceImports.h"
#include "js/StableStringChars.h"
#include "js/Wrapper.h"
#include "vm/StringType.h"
using namespace js;
using JS::AutoStableStringChars;
template <class Base>
bool
SecurityWrapper<Base>::enter(JSContext* cx, HandleObject wrapper, HandleId id,

View File

@ -81,6 +81,7 @@
#include "js/GCVector.h"
#include "js/Initialization.h"
#include "js/Printf.h"
#include "js/StableStringChars.h"
#include "js/StructuredClone.h"
#include "js/SweepingAPI.h"
#include "js/Wrapper.h"
@ -126,6 +127,8 @@ using namespace js;
using namespace js::cli;
using namespace js::shell;
using JS::AutoStableStringChars;
using js::shell::RCFile;
using mozilla::ArrayEqual;

View File

@ -10,6 +10,7 @@
#include "gc/FreeOp.h"
#include "jit/JitFrames.h"
#include "js/StableStringChars.h"
#include "vm/AsyncFunction.h"
#include "vm/GlobalObject.h"
#include "vm/Stack.h"
@ -22,6 +23,8 @@
using namespace js;
using namespace js::gc;
using JS::AutoStableStringChars;
/* static */ size_t
RareArgumentsData::bytesRequired(size_t numActuals)
{

View File

@ -17,6 +17,7 @@
#include "js/Date.h"
#include "js/Proxy.h"
#include "js/RootingAPI.h"
#include "js/StableStringChars.h"
#include "js/Wrapper.h"
#include "proxy/DeadObjectProxy.h"
#include "vm/Debugger.h"
@ -36,6 +37,8 @@
using namespace js;
using namespace js::gc;
using JS::AutoStableStringChars;
Compartment::Compartment(Zone* zone)
: zone_(zone),
runtime_(zone->runtimeFromAnyThread()),

View File

@ -26,6 +26,7 @@
#include "jit/BaselineDebugModeOSR.h"
#include "jit/BaselineJIT.h"
#include "js/Date.h"
#include "js/StableStringChars.h"
#include "js/UbiNodeBreadthFirst.h"
#include "js/Vector.h"
#include "js/Wrapper.h"
@ -55,6 +56,7 @@
using namespace js;
using JS::AutoStableStringChars;
using JS::dbg::AutoEntryMonitor;
using JS::dbg::Builder;
using js::frontend::IsIdentifier;
@ -5036,7 +5038,7 @@ Debugger::isCompilableUnit(JSContext* cx, unsigned argc, Value* vp)
}
JSString* str = args[0].toString();
size_t length = GetStringLength(str);
size_t length = str->length();
AutoStableStringChars chars(cx);
if (!chars.initTwoByte(cx, str))

View File

@ -33,6 +33,7 @@
#include "jit/Ion.h"
#include "js/CallNonGenericMethod.h"
#include "js/Proxy.h"
#include "js/StableStringChars.h"
#include "js/Wrapper.h"
#include "util/StringBuffer.h"
#include "vm/AsyncFunction.h"
@ -64,6 +65,8 @@ using mozilla::CheckedInt;
using mozilla::Maybe;
using mozilla::Some;
using JS::AutoStableStringChars;
static bool
fun_enumerate(JSContext* cx, HandleObject obj)
{

View File

@ -22,6 +22,7 @@
#endif
#include "irregexp/RegExpParser.h"
#include "jit/VMFunctions.h"
#include "js/StableStringChars.h"
#include "util/StringBuffer.h"
#include "vm/MatchPairs.h"
#include "vm/RegExpStatics.h"
@ -41,6 +42,7 @@ using namespace js;
using mozilla::ArrayLength;
using mozilla::DebugOnly;
using mozilla::PodCopy;
using JS::AutoStableStringChars;
using js::frontend::TokenStream;
using JS::AutoCheckCannotGC;

View File

@ -38,6 +38,7 @@
#include "js/Date.h"
#include "js/MemoryMetrics.h"
#include "js/SliceBudget.h"
#include "js/StableStringChars.h"
#include "js/Wrapper.h"
#include "util/Windows.h"
#include "vm/DateTime.h"
@ -59,6 +60,7 @@ using mozilla::DebugOnly;
using mozilla::NegativeInfinity;
using mozilla::PodZero;
using mozilla::PositiveInfinity;
using JS::AutoStableStringChars;
using JS::DoubleNaNValue;
/* static */ MOZ_THREAD_LOCAL(JSContext*) js::TlsContext;

View File

@ -40,6 +40,7 @@
#include "jit/InlinableNatives.h"
#include "js/CharacterEncoding.h"
#include "js/Date.h"
#include "js/StableStringChars.h"
#include "js/Wrapper.h"
#include "util/StringBuffer.h"
#include "vm/ArgumentsObject.h"
@ -70,6 +71,7 @@ using namespace js;
using namespace js::selfhosted;
using JS::AutoCheckCannotGC;
using JS::AutoStableStringChars;
using mozilla::IsInRange;
using mozilla::Maybe;

View File

@ -20,6 +20,7 @@
#include "gc/GCInternals.h"
#include "gc/Marking.h"
#include "gc/Nursery.h"
#include "js/StableStringChars.h"
#include "js/UbiNode.h"
#include "util/StringBuffer.h"
#include "vm/GeckoProfiler.h"
@ -41,6 +42,7 @@ using mozilla::RoundUpPow2;
using mozilla::Unused;
using JS::AutoCheckCannotGC;
using JS::AutoStableStringChars;
using UniqueLatin1Chars = UniquePtr<Latin1Char[], JS::FreePolicy>;

View File

@ -32,9 +32,14 @@ class JSExternalString;
class JSInlineString;
class JSRope;
namespace js {
namespace JS {
class AutoStableStringChars;
} // namespace JS
namespace js {
class StaticStrings;
class PropertyName;
@ -810,7 +815,7 @@ static_assert(sizeof(JSRope) == sizeof(JSString),
class JSLinearString : public JSString
{
friend class JSString;
friend class js::AutoStableStringChars;
friend class JS::AutoStableStringChars;
friend class js::TenuringTracer;
/* Vacuous and therefore unimplemented. */

View File

@ -6,6 +6,7 @@
#include "js/UbiNodeCensus.h"
#include "js/StableStringChars.h"
#include "util/Text.h"
#include "vm/JSContext.h"
#include "vm/Realm.h"

View File

@ -34,6 +34,7 @@
#include "gc/Policy.h"
#include "js/MemoryMetrics.h"
#include "js/Printf.h"
#include "js/StableStringChars.h"
#include "js/Wrapper.h"
#include "util/StringBuffer.h"
#include "util/Text.h"
@ -70,6 +71,7 @@ using mozilla::PodZero;
using mozilla::PositiveInfinity;
using mozilla::Unused;
using JS::AsmJSOption;
using JS::AutoStableStringChars;
using JS::GenericNaN;
/*****************************************************************************/