зеркало из https://github.com/mozilla/gecko-dev.git
Bug 765956 - Set Bindings' parent eagerly (r=bhackett)
--HG-- extra : rebase_source : 198757535745ab10f4bba192b163d38768e7260b
This commit is contained in:
Родитель
de8ea2a8cc
Коммит
45f9d72da4
|
@ -128,7 +128,7 @@ struct JSCompartment
|
||||||
//
|
//
|
||||||
// In contrast, JSObject::global() is infallible because marking a JSObject
|
// In contrast, JSObject::global() is infallible because marking a JSObject
|
||||||
// always marks its global as well.
|
// always marks its global as well.
|
||||||
// TODO: add infallible JSScript::global() and JSContext::global()
|
// TODO: add infallible JSScript::global()
|
||||||
//
|
//
|
||||||
js::GlobalObject *maybeGlobal() const {
|
js::GlobalObject *maybeGlobal() const {
|
||||||
JS_ASSERT_IF(global_, global_->compartment() == this);
|
JS_ASSERT_IF(global_, global_->compartment() == this);
|
||||||
|
|
|
@ -5040,14 +5040,6 @@ TypeScript::SetScope(JSContext *cx, JSScript *script_, JSObject *scope_)
|
||||||
JS_ASSERT_IF(fun && scope, fun->global() == scope->global());
|
JS_ASSERT_IF(fun && scope, fun->global() == scope->global());
|
||||||
script->types->global = fun ? &fun->global() : &scope->global();
|
script->types->global = fun ? &fun->global() : &scope->global();
|
||||||
|
|
||||||
/*
|
|
||||||
* Update the parent in the script's bindings. The bindings are created
|
|
||||||
* with a NULL parent, and fixing the parent now avoids the need to reshape
|
|
||||||
* every time a call object is created from the bindings.
|
|
||||||
*/
|
|
||||||
if (!script->bindings.setParent(cx, script->types->global))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!cx->typeInferenceEnabled())
|
if (!cx->typeInferenceEnabled())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -1207,31 +1207,6 @@ Bindings::setExtensibleParents(JSContext *cx)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
Bindings::setParent(JSContext *cx, JSObject *obj_)
|
|
||||||
{
|
|
||||||
RootedObject obj(cx, obj_);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This may be invoked on GC heap allocated bindings, in which case this
|
|
||||||
* is pointing to an internal value of a JSScript that can't itself be
|
|
||||||
* relocated. The script itself will be rooted, and will not be moved, so
|
|
||||||
* mark the stack value as non-relocatable for the stack root analysis.
|
|
||||||
*/
|
|
||||||
Bindings *self = this;
|
|
||||||
SkipRoot root(cx, &self);
|
|
||||||
|
|
||||||
if (!ensureShape(cx))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* This is only used for Block objects, which have a NULL proto. */
|
|
||||||
Shape *newShape = Shape::setObjectParent(cx, obj, NULL, self->lastBinding);
|
|
||||||
if (!newShape)
|
|
||||||
return false;
|
|
||||||
self->lastBinding = newShape;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
inline
|
||||||
InitialShapeEntry::InitialShapeEntry() : shape(NULL), proto(NULL)
|
InitialShapeEntry::InitialShapeEntry() : shape(NULL), proto(NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -124,7 +124,7 @@ Bindings::add(JSContext *cx, HandleAtom name, BindingKind kind)
|
||||||
id = AtomToId(name);
|
id = AtomToId(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
StackBaseShape base(&CallClass, NULL, BaseShape::VAROBJ);
|
StackBaseShape base(&CallClass, cx->global(), BaseShape::VAROBJ);
|
||||||
base.updateGetterSetter(attrs, getter, setter);
|
base.updateGetterSetter(attrs, getter, setter);
|
||||||
|
|
||||||
UnownedBaseShape *nbase = BaseShape::getUnowned(cx, base);
|
UnownedBaseShape *nbase = BaseShape::getUnowned(cx, base);
|
||||||
|
|
|
@ -128,8 +128,6 @@ class Bindings
|
||||||
inline bool extensibleParents();
|
inline bool extensibleParents();
|
||||||
bool setExtensibleParents(JSContext *cx);
|
bool setExtensibleParents(JSContext *cx);
|
||||||
|
|
||||||
bool setParent(JSContext *cx, JSObject *obj);
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
/* A script may have no more than this many arguments or variables. */
|
/* A script may have no more than this many arguments or variables. */
|
||||||
BINDING_COUNT_LIMIT = 0xFFFF
|
BINDING_COUNT_LIMIT = 0xFFFF
|
||||||
|
|
|
@ -55,8 +55,8 @@ Bindings::initialShape(JSContext *cx) const
|
||||||
gc::AllocKind kind = gc::FINALIZE_OBJECT2_BACKGROUND;
|
gc::AllocKind kind = gc::FINALIZE_OBJECT2_BACKGROUND;
|
||||||
JS_ASSERT(gc::GetGCKindSlots(kind) == CallObject::RESERVED_SLOTS);
|
JS_ASSERT(gc::GetGCKindSlots(kind) == CallObject::RESERVED_SLOTS);
|
||||||
|
|
||||||
return EmptyShape::getInitialShape(cx, &CallClass, NULL, NULL, kind,
|
return EmptyShape::getInitialShape(cx, &CallClass, NULL, cx->global(),
|
||||||
BaseShape::VAROBJ);
|
kind, BaseShape::VAROBJ);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
Загрузка…
Ссылка в новой задаче