зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1037756 - Move cloneSingletons to CompartmentOptions. r=jandem
This commit is contained in:
Родитель
d5bc7cc4b8
Коммит
aa5f852abc
|
@ -1239,7 +1239,7 @@ static const VMFunction DeepCloneObjectLiteralInfo =
|
|||
bool
|
||||
BaselineCompiler::emit_JSOP_OBJECT()
|
||||
{
|
||||
if (JS::CompartmentOptionsRef(cx).cloneSingletons(cx)) {
|
||||
if (JS::CompartmentOptionsRef(cx).cloneSingletons()) {
|
||||
RootedObject obj(cx, script->getObject(GET_UINT32_INDEX(pc)));
|
||||
if (!obj)
|
||||
return false;
|
||||
|
|
|
@ -280,7 +280,7 @@ JitCompileOptions::JitCompileOptions()
|
|||
JitCompileOptions::JitCompileOptions(JSContext *cx)
|
||||
{
|
||||
JS::CompartmentOptions &options = cx->compartment()->options();
|
||||
cloneSingletons_ = options.cloneSingletons(cx);
|
||||
cloneSingletons_ = options.cloneSingletons();
|
||||
spsSlowAssertionsEnabled_ = cx->runtime()->spsProfiler.enabled() &&
|
||||
cx->runtime()->spsProfiler.slowAssertionsEnabled();
|
||||
}
|
||||
|
|
|
@ -2367,12 +2367,6 @@ class AutoCompartmentRooter : private JS::CustomAutoRooter
|
|||
|
||||
} /* anonymous namespace */
|
||||
|
||||
bool
|
||||
JS::CompartmentOptions::cloneSingletons(JSContext *cx) const
|
||||
{
|
||||
return cloneSingletonsOverride_.get(cx->options().cloneSingletons());
|
||||
}
|
||||
|
||||
JS::CompartmentOptions &
|
||||
JS::CompartmentOptions::setZone(ZoneSpecifier spec)
|
||||
{
|
||||
|
|
|
@ -1506,8 +1506,7 @@ class JS_PUBLIC_API(ContextOptions) {
|
|||
privateIsNSISupports_(false),
|
||||
dontReportUncaught_(false),
|
||||
noDefaultCompartmentObject_(false),
|
||||
noScriptRval_(false),
|
||||
cloneSingletons_(false)
|
||||
noScriptRval_(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1571,16 +1570,6 @@ class JS_PUBLIC_API(ContextOptions) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool cloneSingletons() const { return cloneSingletons_; }
|
||||
ContextOptions &setCloneSingletons(bool flag) {
|
||||
cloneSingletons_ = flag;
|
||||
return *this;
|
||||
}
|
||||
ContextOptions &toggleCloneSingletons() {
|
||||
cloneSingletons_ = !cloneSingletons_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
bool extraWarnings_ : 1;
|
||||
bool varObjFix_ : 1;
|
||||
|
@ -1588,7 +1577,6 @@ class JS_PUBLIC_API(ContextOptions) {
|
|||
bool dontReportUncaught_ : 1;
|
||||
bool noDefaultCompartmentObject_ : 1;
|
||||
bool noScriptRval_ : 1;
|
||||
bool cloneSingletons_ : 1;
|
||||
};
|
||||
|
||||
JS_PUBLIC_API(ContextOptions &)
|
||||
|
@ -2571,6 +2559,7 @@ class JS_PUBLIC_API(CompartmentOptions)
|
|||
, invisibleToDebugger_(false)
|
||||
, mergeable_(false)
|
||||
, discardSource_(false)
|
||||
, cloneSingletons_(false)
|
||||
, traceGlobal_(nullptr)
|
||||
, singletonsAsTemplates_(true)
|
||||
, addonId_(nullptr)
|
||||
|
@ -2614,8 +2603,11 @@ class JS_PUBLIC_API(CompartmentOptions)
|
|||
}
|
||||
|
||||
|
||||
bool cloneSingletons(JSContext *cx) const;
|
||||
Override &cloneSingletonsOverride() { return cloneSingletonsOverride_; }
|
||||
bool cloneSingletons() const { return cloneSingletons_; }
|
||||
CompartmentOptions &setCloneSingletons(bool flag) {
|
||||
cloneSingletons_ = flag;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void *zonePointer() const {
|
||||
JS_ASSERT(uintptr_t(zone_.pointer) > uintptr_t(JS::SystemZone));
|
||||
|
@ -2653,7 +2645,7 @@ class JS_PUBLIC_API(CompartmentOptions)
|
|||
bool invisibleToDebugger_;
|
||||
bool mergeable_;
|
||||
bool discardSource_;
|
||||
Override cloneSingletonsOverride_;
|
||||
bool cloneSingletons_;
|
||||
union {
|
||||
ZoneSpecifier spec;
|
||||
void *pointer; // js::Zone* is not exposed in the API.
|
||||
|
|
|
@ -1261,7 +1261,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp)
|
|||
JSSMSG_CACHE_SINGLETON_FAILED);
|
||||
return false;
|
||||
}
|
||||
JS::CompartmentOptionsRef(cx).cloneSingletonsOverride().set(true);
|
||||
JS::CompartmentOptionsRef(cx).setCloneSingletons(true);
|
||||
}
|
||||
|
||||
if (loadBytecode) {
|
||||
|
|
|
@ -2733,7 +2733,7 @@ CASE(JSOP_OBJECT)
|
|||
{
|
||||
RootedObject &ref = rootObject0;
|
||||
ref = script->getObject(REGS.pc);
|
||||
if (JS::CompartmentOptionsRef(cx).cloneSingletons(cx)) {
|
||||
if (JS::CompartmentOptionsRef(cx).cloneSingletons()) {
|
||||
JSObject *obj = js::DeepCloneObjectLiteral(cx, ref, js::MaybeSingletonObject);
|
||||
if (!obj)
|
||||
goto error;
|
||||
|
|
Загрузка…
Ссылка в новой задаче